summaryrefslogtreecommitdiff
path: root/gen/Network/AWS/MarketplaceEntitlement/Types/Product.hs
blob: 2b59f649999168f13c1a66622baaacf04c32d2b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}

{-# OPTIONS_GHC -fno-warn-unused-imports #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Network.AWS.MarketplaceEntitlement.Types.Product
-- Copyright   : (c) 2013-2018 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.AWS.MarketplaceEntitlement.Types.Product where

import Network.AWS.Lens
import Network.AWS.MarketplaceEntitlement.Types.Sum
import Network.AWS.Prelude

-- | An entitlement represents capacity in a product owned by the customer. For example, a customer might own some number of users or seats in an SaaS application or some amount of data capacity in a multi-tenant database.
--
--
--
-- /See:/ 'entitlement' smart constructor.
data Entitlement = Entitlement'
  { _eDimension          :: !(Maybe Text)
  , _eValue              :: !(Maybe EntitlementValue)
  , _eExpirationDate     :: !(Maybe POSIX)
  , _eCustomerIdentifier :: !(Maybe Text)
  , _eProductCode        :: !(Maybe Text)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'Entitlement' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eDimension' - The dimension for which the given entitlement applies. Dimensions represent categories of capacity in a product and are specified when the product is listed in AWS Marketplace.
--
-- * 'eValue' - The EntitlementValue represents the amount of capacity that the customer is entitled to for the product.
--
-- * 'eExpirationDate' - The expiration date represents the minimum date through which this entitlement is expected to remain valid. For contractual products listed on AWS Marketplace, the expiration date is the date at which the customer will renew or cancel their contract. Customers who are opting to renew their contract will still have entitlements with an expiration date.
--
-- * 'eCustomerIdentifier' - The customer identifier is a handle to each unique customer in an application. Customer identifiers are obtained through the ResolveCustomer operation in AWS Marketplace Metering Service.
--
-- * 'eProductCode' - The product code for which the given entitlement applies. Product codes are provided by AWS Marketplace when the product listing is created.
entitlement
    :: Entitlement
entitlement =
  Entitlement'
    { _eDimension = Nothing
    , _eValue = Nothing
    , _eExpirationDate = Nothing
    , _eCustomerIdentifier = Nothing
    , _eProductCode = Nothing
    }


-- | The dimension for which the given entitlement applies. Dimensions represent categories of capacity in a product and are specified when the product is listed in AWS Marketplace.
eDimension :: Lens' Entitlement (Maybe Text)
eDimension = lens _eDimension (\ s a -> s{_eDimension = a})

-- | The EntitlementValue represents the amount of capacity that the customer is entitled to for the product.
eValue :: Lens' Entitlement (Maybe EntitlementValue)
eValue = lens _eValue (\ s a -> s{_eValue = a})

-- | The expiration date represents the minimum date through which this entitlement is expected to remain valid. For contractual products listed on AWS Marketplace, the expiration date is the date at which the customer will renew or cancel their contract. Customers who are opting to renew their contract will still have entitlements with an expiration date.
eExpirationDate :: Lens' Entitlement (Maybe UTCTime)
eExpirationDate = lens _eExpirationDate (\ s a -> s{_eExpirationDate = a}) . mapping _Time

-- | The customer identifier is a handle to each unique customer in an application. Customer identifiers are obtained through the ResolveCustomer operation in AWS Marketplace Metering Service.
eCustomerIdentifier :: Lens' Entitlement (Maybe Text)
eCustomerIdentifier = lens _eCustomerIdentifier (\ s a -> s{_eCustomerIdentifier = a})

-- | The product code for which the given entitlement applies. Product codes are provided by AWS Marketplace when the product listing is created.
eProductCode :: Lens' Entitlement (Maybe Text)
eProductCode = lens _eProductCode (\ s a -> s{_eProductCode = a})

instance FromJSON Entitlement where
        parseJSON
          = withObject "Entitlement"
              (\ x ->
                 Entitlement' <$>
                   (x .:? "Dimension") <*> (x .:? "Value") <*>
                     (x .:? "ExpirationDate")
                     <*> (x .:? "CustomerIdentifier")
                     <*> (x .:? "ProductCode"))

instance Hashable Entitlement where

instance NFData Entitlement where

-- | The EntitlementValue represents the amount of capacity that the customer is entitled to for the product.
--
--
--
-- /See:/ 'entitlementValue' smart constructor.
data EntitlementValue = EntitlementValue'
  { _evIntegerValue :: !(Maybe Int)
  , _evDoubleValue  :: !(Maybe Double)
  , _evStringValue  :: !(Maybe Text)
  , _evBooleanValue :: !(Maybe Bool)
  } deriving (Eq, Read, Show, Data, Typeable, Generic)


-- | Creates a value of 'EntitlementValue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'evIntegerValue' - The IntegerValue field will be populated with an integer value when the entitlement is an integer type. Otherwise, the field will not be set.
--
-- * 'evDoubleValue' - The DoubleValue field will be populated with a double value when the entitlement is a double type. Otherwise, the field will not be set.
--
-- * 'evStringValue' - The StringValue field will be populated with a string value when the entitlement is a string type. Otherwise, the field will not be set.
--
-- * 'evBooleanValue' - The BooleanValue field will be populated with a boolean value when the entitlement is a boolean type. Otherwise, the field will not be set.
entitlementValue
    :: EntitlementValue
entitlementValue =
  EntitlementValue'
    { _evIntegerValue = Nothing
    , _evDoubleValue = Nothing
    , _evStringValue = Nothing
    , _evBooleanValue = Nothing
    }


-- | The IntegerValue field will be populated with an integer value when the entitlement is an integer type. Otherwise, the field will not be set.
evIntegerValue :: Lens' EntitlementValue (Maybe Int)
evIntegerValue = lens _evIntegerValue (\ s a -> s{_evIntegerValue = a})

-- | The DoubleValue field will be populated with a double value when the entitlement is a double type. Otherwise, the field will not be set.
evDoubleValue :: Lens' EntitlementValue (Maybe Double)
evDoubleValue = lens _evDoubleValue (\ s a -> s{_evDoubleValue = a})

-- | The StringValue field will be populated with a string value when the entitlement is a string type. Otherwise, the field will not be set.
evStringValue :: Lens' EntitlementValue (Maybe Text)
evStringValue = lens _evStringValue (\ s a -> s{_evStringValue = a})

-- | The BooleanValue field will be populated with a boolean value when the entitlement is a boolean type. Otherwise, the field will not be set.
evBooleanValue :: Lens' EntitlementValue (Maybe Bool)
evBooleanValue = lens _evBooleanValue (\ s a -> s{_evBooleanValue = a})

instance FromJSON EntitlementValue where
        parseJSON
          = withObject "EntitlementValue"
              (\ x ->
                 EntitlementValue' <$>
                   (x .:? "IntegerValue") <*> (x .:? "DoubleValue") <*>
                     (x .:? "StringValue")
                     <*> (x .:? "BooleanValue"))

instance Hashable EntitlementValue where

instance NFData EntitlementValue where