{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.LicenseManager.CheckoutLicense
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Checks out the specified license.
--
-- If the account that created the license is the same that is performing
-- the check out, you must specify the account as the beneficiary.
module Amazonka.LicenseManager.CheckoutLicense
  ( -- * Creating a Request
    CheckoutLicense (..),
    newCheckoutLicense,

    -- * Request Lenses
    checkoutLicense_beneficiary,
    checkoutLicense_nodeId,
    checkoutLicense_productSKU,
    checkoutLicense_checkoutType,
    checkoutLicense_keyFingerprint,
    checkoutLicense_entitlements,
    checkoutLicense_clientToken,

    -- * Destructuring the Response
    CheckoutLicenseResponse (..),
    newCheckoutLicenseResponse,

    -- * Response Lenses
    checkoutLicenseResponse_checkoutType,
    checkoutLicenseResponse_entitlementsAllowed,
    checkoutLicenseResponse_expiration,
    checkoutLicenseResponse_issuedAt,
    checkoutLicenseResponse_licenseArn,
    checkoutLicenseResponse_licenseConsumptionToken,
    checkoutLicenseResponse_nodeId,
    checkoutLicenseResponse_signedToken,
    checkoutLicenseResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCheckoutLicense' smart constructor.
data CheckoutLicense = CheckoutLicense'
  { -- | License beneficiary.
    CheckoutLicense -> Maybe Text
beneficiary :: Prelude.Maybe Prelude.Text,
    -- | Node ID.
    CheckoutLicense -> Maybe Text
nodeId :: Prelude.Maybe Prelude.Text,
    -- | Product SKU.
    CheckoutLicense -> Text
productSKU :: Prelude.Text,
    -- | Checkout type.
    CheckoutLicense -> CheckoutType
checkoutType :: CheckoutType,
    -- | Key fingerprint identifying the license.
    CheckoutLicense -> Text
keyFingerprint :: Prelude.Text,
    -- | License entitlements.
    CheckoutLicense -> [EntitlementData]
entitlements :: [EntitlementData],
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CheckoutLicense -> Text
clientToken :: Prelude.Text
  }
  deriving (CheckoutLicense -> CheckoutLicense -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckoutLicense -> CheckoutLicense -> Bool
$c/= :: CheckoutLicense -> CheckoutLicense -> Bool
== :: CheckoutLicense -> CheckoutLicense -> Bool
$c== :: CheckoutLicense -> CheckoutLicense -> Bool
Prelude.Eq, ReadPrec [CheckoutLicense]
ReadPrec CheckoutLicense
Int -> ReadS CheckoutLicense
ReadS [CheckoutLicense]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CheckoutLicense]
$creadListPrec :: ReadPrec [CheckoutLicense]
readPrec :: ReadPrec CheckoutLicense
$creadPrec :: ReadPrec CheckoutLicense
readList :: ReadS [CheckoutLicense]
$creadList :: ReadS [CheckoutLicense]
readsPrec :: Int -> ReadS CheckoutLicense
$creadsPrec :: Int -> ReadS CheckoutLicense
Prelude.Read, Int -> CheckoutLicense -> ShowS
[CheckoutLicense] -> ShowS
CheckoutLicense -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckoutLicense] -> ShowS
$cshowList :: [CheckoutLicense] -> ShowS
show :: CheckoutLicense -> String
$cshow :: CheckoutLicense -> String
showsPrec :: Int -> CheckoutLicense -> ShowS
$cshowsPrec :: Int -> CheckoutLicense -> ShowS
Prelude.Show, forall x. Rep CheckoutLicense x -> CheckoutLicense
forall x. CheckoutLicense -> Rep CheckoutLicense x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CheckoutLicense x -> CheckoutLicense
$cfrom :: forall x. CheckoutLicense -> Rep CheckoutLicense x
Prelude.Generic)

-- |
-- Create a value of 'CheckoutLicense' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'beneficiary', 'checkoutLicense_beneficiary' - License beneficiary.
--
-- 'nodeId', 'checkoutLicense_nodeId' - Node ID.
--
-- 'productSKU', 'checkoutLicense_productSKU' - Product SKU.
--
-- 'checkoutType', 'checkoutLicense_checkoutType' - Checkout type.
--
-- 'keyFingerprint', 'checkoutLicense_keyFingerprint' - Key fingerprint identifying the license.
--
-- 'entitlements', 'checkoutLicense_entitlements' - License entitlements.
--
-- 'clientToken', 'checkoutLicense_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
newCheckoutLicense ::
  -- | 'productSKU'
  Prelude.Text ->
  -- | 'checkoutType'
  CheckoutType ->
  -- | 'keyFingerprint'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  CheckoutLicense
newCheckoutLicense :: Text -> CheckoutType -> Text -> Text -> CheckoutLicense
newCheckoutLicense
  Text
pProductSKU_
  CheckoutType
pCheckoutType_
  Text
pKeyFingerprint_
  Text
pClientToken_ =
    CheckoutLicense'
      { $sel:beneficiary:CheckoutLicense' :: Maybe Text
beneficiary = forall a. Maybe a
Prelude.Nothing,
        $sel:nodeId:CheckoutLicense' :: Maybe Text
nodeId = forall a. Maybe a
Prelude.Nothing,
        $sel:productSKU:CheckoutLicense' :: Text
productSKU = Text
pProductSKU_,
        $sel:checkoutType:CheckoutLicense' :: CheckoutType
checkoutType = CheckoutType
pCheckoutType_,
        $sel:keyFingerprint:CheckoutLicense' :: Text
keyFingerprint = Text
pKeyFingerprint_,
        $sel:entitlements:CheckoutLicense' :: [EntitlementData]
entitlements = forall a. Monoid a => a
Prelude.mempty,
        $sel:clientToken:CheckoutLicense' :: Text
clientToken = Text
pClientToken_
      }

-- | License beneficiary.
checkoutLicense_beneficiary :: Lens.Lens' CheckoutLicense (Prelude.Maybe Prelude.Text)
checkoutLicense_beneficiary :: Lens' CheckoutLicense (Maybe Text)
checkoutLicense_beneficiary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {Maybe Text
beneficiary :: Maybe Text
$sel:beneficiary:CheckoutLicense' :: CheckoutLicense -> Maybe Text
beneficiary} -> Maybe Text
beneficiary) (\s :: CheckoutLicense
s@CheckoutLicense' {} Maybe Text
a -> CheckoutLicense
s {$sel:beneficiary:CheckoutLicense' :: Maybe Text
beneficiary = Maybe Text
a} :: CheckoutLicense)

-- | Node ID.
checkoutLicense_nodeId :: Lens.Lens' CheckoutLicense (Prelude.Maybe Prelude.Text)
checkoutLicense_nodeId :: Lens' CheckoutLicense (Maybe Text)
checkoutLicense_nodeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {Maybe Text
nodeId :: Maybe Text
$sel:nodeId:CheckoutLicense' :: CheckoutLicense -> Maybe Text
nodeId} -> Maybe Text
nodeId) (\s :: CheckoutLicense
s@CheckoutLicense' {} Maybe Text
a -> CheckoutLicense
s {$sel:nodeId:CheckoutLicense' :: Maybe Text
nodeId = Maybe Text
a} :: CheckoutLicense)

-- | Product SKU.
checkoutLicense_productSKU :: Lens.Lens' CheckoutLicense Prelude.Text
checkoutLicense_productSKU :: Lens' CheckoutLicense Text
checkoutLicense_productSKU = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {Text
productSKU :: Text
$sel:productSKU:CheckoutLicense' :: CheckoutLicense -> Text
productSKU} -> Text
productSKU) (\s :: CheckoutLicense
s@CheckoutLicense' {} Text
a -> CheckoutLicense
s {$sel:productSKU:CheckoutLicense' :: Text
productSKU = Text
a} :: CheckoutLicense)

-- | Checkout type.
checkoutLicense_checkoutType :: Lens.Lens' CheckoutLicense CheckoutType
checkoutLicense_checkoutType :: Lens' CheckoutLicense CheckoutType
checkoutLicense_checkoutType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {CheckoutType
checkoutType :: CheckoutType
$sel:checkoutType:CheckoutLicense' :: CheckoutLicense -> CheckoutType
checkoutType} -> CheckoutType
checkoutType) (\s :: CheckoutLicense
s@CheckoutLicense' {} CheckoutType
a -> CheckoutLicense
s {$sel:checkoutType:CheckoutLicense' :: CheckoutType
checkoutType = CheckoutType
a} :: CheckoutLicense)

-- | Key fingerprint identifying the license.
checkoutLicense_keyFingerprint :: Lens.Lens' CheckoutLicense Prelude.Text
checkoutLicense_keyFingerprint :: Lens' CheckoutLicense Text
checkoutLicense_keyFingerprint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {Text
keyFingerprint :: Text
$sel:keyFingerprint:CheckoutLicense' :: CheckoutLicense -> Text
keyFingerprint} -> Text
keyFingerprint) (\s :: CheckoutLicense
s@CheckoutLicense' {} Text
a -> CheckoutLicense
s {$sel:keyFingerprint:CheckoutLicense' :: Text
keyFingerprint = Text
a} :: CheckoutLicense)

-- | License entitlements.
checkoutLicense_entitlements :: Lens.Lens' CheckoutLicense [EntitlementData]
checkoutLicense_entitlements :: Lens' CheckoutLicense [EntitlementData]
checkoutLicense_entitlements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {[EntitlementData]
entitlements :: [EntitlementData]
$sel:entitlements:CheckoutLicense' :: CheckoutLicense -> [EntitlementData]
entitlements} -> [EntitlementData]
entitlements) (\s :: CheckoutLicense
s@CheckoutLicense' {} [EntitlementData]
a -> CheckoutLicense
s {$sel:entitlements:CheckoutLicense' :: [EntitlementData]
entitlements = [EntitlementData]
a} :: CheckoutLicense) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
checkoutLicense_clientToken :: Lens.Lens' CheckoutLicense Prelude.Text
checkoutLicense_clientToken :: Lens' CheckoutLicense Text
checkoutLicense_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicense' {Text
clientToken :: Text
$sel:clientToken:CheckoutLicense' :: CheckoutLicense -> Text
clientToken} -> Text
clientToken) (\s :: CheckoutLicense
s@CheckoutLicense' {} Text
a -> CheckoutLicense
s {$sel:clientToken:CheckoutLicense' :: Text
clientToken = Text
a} :: CheckoutLicense)

instance Core.AWSRequest CheckoutLicense where
  type
    AWSResponse CheckoutLicense =
      CheckoutLicenseResponse
  request :: (Service -> Service) -> CheckoutLicense -> Request CheckoutLicense
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CheckoutLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CheckoutLicense)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CheckoutType
-> Maybe [EntitlementData]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CheckoutLicenseResponse
CheckoutLicenseResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CheckoutType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"EntitlementsAllowed"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Expiration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IssuedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LicenseArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LicenseConsumptionToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NodeId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SignedToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CheckoutLicense where
  hashWithSalt :: Int -> CheckoutLicense -> Int
hashWithSalt Int
_salt CheckoutLicense' {[EntitlementData]
Maybe Text
Text
CheckoutType
clientToken :: Text
entitlements :: [EntitlementData]
keyFingerprint :: Text
checkoutType :: CheckoutType
productSKU :: Text
nodeId :: Maybe Text
beneficiary :: Maybe Text
$sel:clientToken:CheckoutLicense' :: CheckoutLicense -> Text
$sel:entitlements:CheckoutLicense' :: CheckoutLicense -> [EntitlementData]
$sel:keyFingerprint:CheckoutLicense' :: CheckoutLicense -> Text
$sel:checkoutType:CheckoutLicense' :: CheckoutLicense -> CheckoutType
$sel:productSKU:CheckoutLicense' :: CheckoutLicense -> Text
$sel:nodeId:CheckoutLicense' :: CheckoutLicense -> Maybe Text
$sel:beneficiary:CheckoutLicense' :: CheckoutLicense -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
beneficiary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productSKU
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CheckoutType
checkoutType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyFingerprint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EntitlementData]
entitlements
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientToken

instance Prelude.NFData CheckoutLicense where
  rnf :: CheckoutLicense -> ()
rnf CheckoutLicense' {[EntitlementData]
Maybe Text
Text
CheckoutType
clientToken :: Text
entitlements :: [EntitlementData]
keyFingerprint :: Text
checkoutType :: CheckoutType
productSKU :: Text
nodeId :: Maybe Text
beneficiary :: Maybe Text
$sel:clientToken:CheckoutLicense' :: CheckoutLicense -> Text
$sel:entitlements:CheckoutLicense' :: CheckoutLicense -> [EntitlementData]
$sel:keyFingerprint:CheckoutLicense' :: CheckoutLicense -> Text
$sel:checkoutType:CheckoutLicense' :: CheckoutLicense -> CheckoutType
$sel:productSKU:CheckoutLicense' :: CheckoutLicense -> Text
$sel:nodeId:CheckoutLicense' :: CheckoutLicense -> Maybe Text
$sel:beneficiary:CheckoutLicense' :: CheckoutLicense -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
beneficiary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productSKU
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CheckoutType
checkoutType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
keyFingerprint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [EntitlementData]
entitlements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientToken

instance Data.ToHeaders CheckoutLicense where
  toHeaders :: CheckoutLicense -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSLicenseManager.CheckoutLicense" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CheckoutLicense where
  toJSON :: CheckoutLicense -> Value
toJSON CheckoutLicense' {[EntitlementData]
Maybe Text
Text
CheckoutType
clientToken :: Text
entitlements :: [EntitlementData]
keyFingerprint :: Text
checkoutType :: CheckoutType
productSKU :: Text
nodeId :: Maybe Text
beneficiary :: Maybe Text
$sel:clientToken:CheckoutLicense' :: CheckoutLicense -> Text
$sel:entitlements:CheckoutLicense' :: CheckoutLicense -> [EntitlementData]
$sel:keyFingerprint:CheckoutLicense' :: CheckoutLicense -> Text
$sel:checkoutType:CheckoutLicense' :: CheckoutLicense -> CheckoutType
$sel:productSKU:CheckoutLicense' :: CheckoutLicense -> Text
$sel:nodeId:CheckoutLicense' :: CheckoutLicense -> Maybe Text
$sel:beneficiary:CheckoutLicense' :: CheckoutLicense -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Beneficiary" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
beneficiary,
            (Key
"NodeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nodeId,
            forall a. a -> Maybe a
Prelude.Just (Key
"ProductSKU" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productSKU),
            forall a. a -> Maybe a
Prelude.Just (Key
"CheckoutType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CheckoutType
checkoutType),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"KeyFingerprint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
keyFingerprint),
            forall a. a -> Maybe a
Prelude.Just (Key
"Entitlements" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [EntitlementData]
entitlements),
            forall a. a -> Maybe a
Prelude.Just (Key
"ClientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientToken)
          ]
      )

instance Data.ToPath CheckoutLicense where
  toPath :: CheckoutLicense -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CheckoutLicense where
  toQuery :: CheckoutLicense -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCheckoutLicenseResponse' smart constructor.
data CheckoutLicenseResponse = CheckoutLicenseResponse'
  { -- | Checkout type.
    CheckoutLicenseResponse -> Maybe CheckoutType
checkoutType :: Prelude.Maybe CheckoutType,
    -- | Allowed license entitlements.
    CheckoutLicenseResponse -> Maybe [EntitlementData]
entitlementsAllowed :: Prelude.Maybe [EntitlementData],
    -- | Date and time at which the license checkout expires.
    CheckoutLicenseResponse -> Maybe Text
expiration :: Prelude.Maybe Prelude.Text,
    -- | Date and time at which the license checkout is issued.
    CheckoutLicenseResponse -> Maybe Text
issuedAt :: Prelude.Maybe Prelude.Text,
    -- | Amazon Resource Name (ARN) of the checkout license.
    CheckoutLicenseResponse -> Maybe Text
licenseArn :: Prelude.Maybe Prelude.Text,
    -- | License consumption token.
    CheckoutLicenseResponse -> Maybe Text
licenseConsumptionToken :: Prelude.Maybe Prelude.Text,
    -- | Node ID.
    CheckoutLicenseResponse -> Maybe Text
nodeId :: Prelude.Maybe Prelude.Text,
    -- | Signed token.
    CheckoutLicenseResponse -> Maybe Text
signedToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CheckoutLicenseResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CheckoutLicenseResponse -> CheckoutLicenseResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckoutLicenseResponse -> CheckoutLicenseResponse -> Bool
$c/= :: CheckoutLicenseResponse -> CheckoutLicenseResponse -> Bool
== :: CheckoutLicenseResponse -> CheckoutLicenseResponse -> Bool
$c== :: CheckoutLicenseResponse -> CheckoutLicenseResponse -> Bool
Prelude.Eq, ReadPrec [CheckoutLicenseResponse]
ReadPrec CheckoutLicenseResponse
Int -> ReadS CheckoutLicenseResponse
ReadS [CheckoutLicenseResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CheckoutLicenseResponse]
$creadListPrec :: ReadPrec [CheckoutLicenseResponse]
readPrec :: ReadPrec CheckoutLicenseResponse
$creadPrec :: ReadPrec CheckoutLicenseResponse
readList :: ReadS [CheckoutLicenseResponse]
$creadList :: ReadS [CheckoutLicenseResponse]
readsPrec :: Int -> ReadS CheckoutLicenseResponse
$creadsPrec :: Int -> ReadS CheckoutLicenseResponse
Prelude.Read, Int -> CheckoutLicenseResponse -> ShowS
[CheckoutLicenseResponse] -> ShowS
CheckoutLicenseResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckoutLicenseResponse] -> ShowS
$cshowList :: [CheckoutLicenseResponse] -> ShowS
show :: CheckoutLicenseResponse -> String
$cshow :: CheckoutLicenseResponse -> String
showsPrec :: Int -> CheckoutLicenseResponse -> ShowS
$cshowsPrec :: Int -> CheckoutLicenseResponse -> ShowS
Prelude.Show, forall x. Rep CheckoutLicenseResponse x -> CheckoutLicenseResponse
forall x. CheckoutLicenseResponse -> Rep CheckoutLicenseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CheckoutLicenseResponse x -> CheckoutLicenseResponse
$cfrom :: forall x. CheckoutLicenseResponse -> Rep CheckoutLicenseResponse x
Prelude.Generic)

-- |
-- Create a value of 'CheckoutLicenseResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'checkoutType', 'checkoutLicenseResponse_checkoutType' - Checkout type.
--
-- 'entitlementsAllowed', 'checkoutLicenseResponse_entitlementsAllowed' - Allowed license entitlements.
--
-- 'expiration', 'checkoutLicenseResponse_expiration' - Date and time at which the license checkout expires.
--
-- 'issuedAt', 'checkoutLicenseResponse_issuedAt' - Date and time at which the license checkout is issued.
--
-- 'licenseArn', 'checkoutLicenseResponse_licenseArn' - Amazon Resource Name (ARN) of the checkout license.
--
-- 'licenseConsumptionToken', 'checkoutLicenseResponse_licenseConsumptionToken' - License consumption token.
--
-- 'nodeId', 'checkoutLicenseResponse_nodeId' - Node ID.
--
-- 'signedToken', 'checkoutLicenseResponse_signedToken' - Signed token.
--
-- 'httpStatus', 'checkoutLicenseResponse_httpStatus' - The response's http status code.
newCheckoutLicenseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CheckoutLicenseResponse
newCheckoutLicenseResponse :: Int -> CheckoutLicenseResponse
newCheckoutLicenseResponse Int
pHttpStatus_ =
  CheckoutLicenseResponse'
    { $sel:checkoutType:CheckoutLicenseResponse' :: Maybe CheckoutType
checkoutType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:entitlementsAllowed:CheckoutLicenseResponse' :: Maybe [EntitlementData]
entitlementsAllowed = forall a. Maybe a
Prelude.Nothing,
      $sel:expiration:CheckoutLicenseResponse' :: Maybe Text
expiration = forall a. Maybe a
Prelude.Nothing,
      $sel:issuedAt:CheckoutLicenseResponse' :: Maybe Text
issuedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:licenseArn:CheckoutLicenseResponse' :: Maybe Text
licenseArn = forall a. Maybe a
Prelude.Nothing,
      $sel:licenseConsumptionToken:CheckoutLicenseResponse' :: Maybe Text
licenseConsumptionToken = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeId:CheckoutLicenseResponse' :: Maybe Text
nodeId = forall a. Maybe a
Prelude.Nothing,
      $sel:signedToken:CheckoutLicenseResponse' :: Maybe Text
signedToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CheckoutLicenseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Checkout type.
checkoutLicenseResponse_checkoutType :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe CheckoutType)
checkoutLicenseResponse_checkoutType :: Lens' CheckoutLicenseResponse (Maybe CheckoutType)
checkoutLicenseResponse_checkoutType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe CheckoutType
checkoutType :: Maybe CheckoutType
$sel:checkoutType:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe CheckoutType
checkoutType} -> Maybe CheckoutType
checkoutType) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe CheckoutType
a -> CheckoutLicenseResponse
s {$sel:checkoutType:CheckoutLicenseResponse' :: Maybe CheckoutType
checkoutType = Maybe CheckoutType
a} :: CheckoutLicenseResponse)

-- | Allowed license entitlements.
checkoutLicenseResponse_entitlementsAllowed :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe [EntitlementData])
checkoutLicenseResponse_entitlementsAllowed :: Lens' CheckoutLicenseResponse (Maybe [EntitlementData])
checkoutLicenseResponse_entitlementsAllowed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe [EntitlementData]
entitlementsAllowed :: Maybe [EntitlementData]
$sel:entitlementsAllowed:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe [EntitlementData]
entitlementsAllowed} -> Maybe [EntitlementData]
entitlementsAllowed) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe [EntitlementData]
a -> CheckoutLicenseResponse
s {$sel:entitlementsAllowed:CheckoutLicenseResponse' :: Maybe [EntitlementData]
entitlementsAllowed = Maybe [EntitlementData]
a} :: CheckoutLicenseResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Date and time at which the license checkout expires.
checkoutLicenseResponse_expiration :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_expiration :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_expiration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
expiration :: Maybe Text
$sel:expiration:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
expiration} -> Maybe Text
expiration) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:expiration:CheckoutLicenseResponse' :: Maybe Text
expiration = Maybe Text
a} :: CheckoutLicenseResponse)

-- | Date and time at which the license checkout is issued.
checkoutLicenseResponse_issuedAt :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_issuedAt :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_issuedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
issuedAt :: Maybe Text
$sel:issuedAt:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
issuedAt} -> Maybe Text
issuedAt) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:issuedAt:CheckoutLicenseResponse' :: Maybe Text
issuedAt = Maybe Text
a} :: CheckoutLicenseResponse)

-- | Amazon Resource Name (ARN) of the checkout license.
checkoutLicenseResponse_licenseArn :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_licenseArn :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_licenseArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
licenseArn :: Maybe Text
$sel:licenseArn:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
licenseArn} -> Maybe Text
licenseArn) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:licenseArn:CheckoutLicenseResponse' :: Maybe Text
licenseArn = Maybe Text
a} :: CheckoutLicenseResponse)

-- | License consumption token.
checkoutLicenseResponse_licenseConsumptionToken :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_licenseConsumptionToken :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_licenseConsumptionToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
licenseConsumptionToken :: Maybe Text
$sel:licenseConsumptionToken:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
licenseConsumptionToken} -> Maybe Text
licenseConsumptionToken) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:licenseConsumptionToken:CheckoutLicenseResponse' :: Maybe Text
licenseConsumptionToken = Maybe Text
a} :: CheckoutLicenseResponse)

-- | Node ID.
checkoutLicenseResponse_nodeId :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_nodeId :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_nodeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
nodeId :: Maybe Text
$sel:nodeId:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
nodeId} -> Maybe Text
nodeId) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:nodeId:CheckoutLicenseResponse' :: Maybe Text
nodeId = Maybe Text
a} :: CheckoutLicenseResponse)

-- | Signed token.
checkoutLicenseResponse_signedToken :: Lens.Lens' CheckoutLicenseResponse (Prelude.Maybe Prelude.Text)
checkoutLicenseResponse_signedToken :: Lens' CheckoutLicenseResponse (Maybe Text)
checkoutLicenseResponse_signedToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Maybe Text
signedToken :: Maybe Text
$sel:signedToken:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
signedToken} -> Maybe Text
signedToken) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Maybe Text
a -> CheckoutLicenseResponse
s {$sel:signedToken:CheckoutLicenseResponse' :: Maybe Text
signedToken = Maybe Text
a} :: CheckoutLicenseResponse)

-- | The response's http status code.
checkoutLicenseResponse_httpStatus :: Lens.Lens' CheckoutLicenseResponse Prelude.Int
checkoutLicenseResponse_httpStatus :: Lens' CheckoutLicenseResponse Int
checkoutLicenseResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckoutLicenseResponse' {Int
httpStatus :: Int
$sel:httpStatus:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CheckoutLicenseResponse
s@CheckoutLicenseResponse' {} Int
a -> CheckoutLicenseResponse
s {$sel:httpStatus:CheckoutLicenseResponse' :: Int
httpStatus = Int
a} :: CheckoutLicenseResponse)

instance Prelude.NFData CheckoutLicenseResponse where
  rnf :: CheckoutLicenseResponse -> ()
rnf CheckoutLicenseResponse' {Int
Maybe [EntitlementData]
Maybe Text
Maybe CheckoutType
httpStatus :: Int
signedToken :: Maybe Text
nodeId :: Maybe Text
licenseConsumptionToken :: Maybe Text
licenseArn :: Maybe Text
issuedAt :: Maybe Text
expiration :: Maybe Text
entitlementsAllowed :: Maybe [EntitlementData]
checkoutType :: Maybe CheckoutType
$sel:httpStatus:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Int
$sel:signedToken:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:nodeId:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:licenseConsumptionToken:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:licenseArn:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:issuedAt:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:expiration:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe Text
$sel:entitlementsAllowed:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe [EntitlementData]
$sel:checkoutType:CheckoutLicenseResponse' :: CheckoutLicenseResponse -> Maybe CheckoutType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CheckoutType
checkoutType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EntitlementData]
entitlementsAllowed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expiration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
issuedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
licenseArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
licenseConsumptionToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
signedToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus