{-# 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.CreateLicense
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a license.
module Amazonka.LicenseManager.CreateLicense
  ( -- * Creating a Request
    CreateLicense (..),
    newCreateLicense,

    -- * Request Lenses
    createLicense_licenseMetadata,
    createLicense_licenseName,
    createLicense_productName,
    createLicense_productSKU,
    createLicense_issuer,
    createLicense_homeRegion,
    createLicense_validity,
    createLicense_entitlements,
    createLicense_beneficiary,
    createLicense_consumptionConfiguration,
    createLicense_clientToken,

    -- * Destructuring the Response
    CreateLicenseResponse (..),
    newCreateLicenseResponse,

    -- * Response Lenses
    createLicenseResponse_licenseArn,
    createLicenseResponse_status,
    createLicenseResponse_version,
    createLicenseResponse_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:/ 'newCreateLicense' smart constructor.
data CreateLicense = CreateLicense'
  { -- | Information about the license.
    CreateLicense -> Maybe [Metadata]
licenseMetadata :: Prelude.Maybe [Metadata],
    -- | License name.
    CreateLicense -> Text
licenseName :: Prelude.Text,
    -- | Product name.
    CreateLicense -> Text
productName :: Prelude.Text,
    -- | Product SKU.
    CreateLicense -> Text
productSKU :: Prelude.Text,
    -- | License issuer.
    CreateLicense -> Issuer
issuer :: Issuer,
    -- | Home Region for the license.
    CreateLicense -> Text
homeRegion :: Prelude.Text,
    -- | Date and time range during which the license is valid, in ISO8601-UTC
    -- format.
    CreateLicense -> DatetimeRange
validity :: DatetimeRange,
    -- | License entitlements.
    CreateLicense -> [Entitlement]
entitlements :: [Entitlement],
    -- | License beneficiary.
    CreateLicense -> Text
beneficiary :: Prelude.Text,
    -- | Configuration for consumption of the license. Choose a provisional
    -- configuration for workloads running with continuous connectivity. Choose
    -- a borrow configuration for workloads with offline usage.
    CreateLicense -> ConsumptionConfiguration
consumptionConfiguration :: ConsumptionConfiguration,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateLicense -> Text
clientToken :: Prelude.Text
  }
  deriving (CreateLicense -> CreateLicense -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLicense -> CreateLicense -> Bool
$c/= :: CreateLicense -> CreateLicense -> Bool
== :: CreateLicense -> CreateLicense -> Bool
$c== :: CreateLicense -> CreateLicense -> Bool
Prelude.Eq, ReadPrec [CreateLicense]
ReadPrec CreateLicense
Int -> ReadS CreateLicense
ReadS [CreateLicense]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLicense]
$creadListPrec :: ReadPrec [CreateLicense]
readPrec :: ReadPrec CreateLicense
$creadPrec :: ReadPrec CreateLicense
readList :: ReadS [CreateLicense]
$creadList :: ReadS [CreateLicense]
readsPrec :: Int -> ReadS CreateLicense
$creadsPrec :: Int -> ReadS CreateLicense
Prelude.Read, Int -> CreateLicense -> ShowS
[CreateLicense] -> ShowS
CreateLicense -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLicense] -> ShowS
$cshowList :: [CreateLicense] -> ShowS
show :: CreateLicense -> String
$cshow :: CreateLicense -> String
showsPrec :: Int -> CreateLicense -> ShowS
$cshowsPrec :: Int -> CreateLicense -> ShowS
Prelude.Show, forall x. Rep CreateLicense x -> CreateLicense
forall x. CreateLicense -> Rep CreateLicense x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLicense x -> CreateLicense
$cfrom :: forall x. CreateLicense -> Rep CreateLicense x
Prelude.Generic)

-- |
-- Create a value of 'CreateLicense' 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:
--
-- 'licenseMetadata', 'createLicense_licenseMetadata' - Information about the license.
--
-- 'licenseName', 'createLicense_licenseName' - License name.
--
-- 'productName', 'createLicense_productName' - Product name.
--
-- 'productSKU', 'createLicense_productSKU' - Product SKU.
--
-- 'issuer', 'createLicense_issuer' - License issuer.
--
-- 'homeRegion', 'createLicense_homeRegion' - Home Region for the license.
--
-- 'validity', 'createLicense_validity' - Date and time range during which the license is valid, in ISO8601-UTC
-- format.
--
-- 'entitlements', 'createLicense_entitlements' - License entitlements.
--
-- 'beneficiary', 'createLicense_beneficiary' - License beneficiary.
--
-- 'consumptionConfiguration', 'createLicense_consumptionConfiguration' - Configuration for consumption of the license. Choose a provisional
-- configuration for workloads running with continuous connectivity. Choose
-- a borrow configuration for workloads with offline usage.
--
-- 'clientToken', 'createLicense_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
newCreateLicense ::
  -- | 'licenseName'
  Prelude.Text ->
  -- | 'productName'
  Prelude.Text ->
  -- | 'productSKU'
  Prelude.Text ->
  -- | 'issuer'
  Issuer ->
  -- | 'homeRegion'
  Prelude.Text ->
  -- | 'validity'
  DatetimeRange ->
  -- | 'beneficiary'
  Prelude.Text ->
  -- | 'consumptionConfiguration'
  ConsumptionConfiguration ->
  -- | 'clientToken'
  Prelude.Text ->
  CreateLicense
newCreateLicense :: Text
-> Text
-> Text
-> Issuer
-> Text
-> DatetimeRange
-> Text
-> ConsumptionConfiguration
-> Text
-> CreateLicense
newCreateLicense
  Text
pLicenseName_
  Text
pProductName_
  Text
pProductSKU_
  Issuer
pIssuer_
  Text
pHomeRegion_
  DatetimeRange
pValidity_
  Text
pBeneficiary_
  ConsumptionConfiguration
pConsumptionConfiguration_
  Text
pClientToken_ =
    CreateLicense'
      { $sel:licenseMetadata:CreateLicense' :: Maybe [Metadata]
licenseMetadata = forall a. Maybe a
Prelude.Nothing,
        $sel:licenseName:CreateLicense' :: Text
licenseName = Text
pLicenseName_,
        $sel:productName:CreateLicense' :: Text
productName = Text
pProductName_,
        $sel:productSKU:CreateLicense' :: Text
productSKU = Text
pProductSKU_,
        $sel:issuer:CreateLicense' :: Issuer
issuer = Issuer
pIssuer_,
        $sel:homeRegion:CreateLicense' :: Text
homeRegion = Text
pHomeRegion_,
        $sel:validity:CreateLicense' :: DatetimeRange
validity = DatetimeRange
pValidity_,
        $sel:entitlements:CreateLicense' :: [Entitlement]
entitlements = forall a. Monoid a => a
Prelude.mempty,
        $sel:beneficiary:CreateLicense' :: Text
beneficiary = Text
pBeneficiary_,
        $sel:consumptionConfiguration:CreateLicense' :: ConsumptionConfiguration
consumptionConfiguration =
          ConsumptionConfiguration
pConsumptionConfiguration_,
        $sel:clientToken:CreateLicense' :: Text
clientToken = Text
pClientToken_
      }

-- | Information about the license.
createLicense_licenseMetadata :: Lens.Lens' CreateLicense (Prelude.Maybe [Metadata])
createLicense_licenseMetadata :: Lens' CreateLicense (Maybe [Metadata])
createLicense_licenseMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {Maybe [Metadata]
licenseMetadata :: Maybe [Metadata]
$sel:licenseMetadata:CreateLicense' :: CreateLicense -> Maybe [Metadata]
licenseMetadata} -> Maybe [Metadata]
licenseMetadata) (\s :: CreateLicense
s@CreateLicense' {} Maybe [Metadata]
a -> CreateLicense
s {$sel:licenseMetadata:CreateLicense' :: Maybe [Metadata]
licenseMetadata = Maybe [Metadata]
a} :: CreateLicense) 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

-- | License name.
createLicense_licenseName :: Lens.Lens' CreateLicense Prelude.Text
createLicense_licenseName :: Lens' CreateLicense Text
createLicense_licenseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {Text
licenseName :: Text
$sel:licenseName:CreateLicense' :: CreateLicense -> Text
licenseName} -> Text
licenseName) (\s :: CreateLicense
s@CreateLicense' {} Text
a -> CreateLicense
s {$sel:licenseName:CreateLicense' :: Text
licenseName = Text
a} :: CreateLicense)

-- | Product name.
createLicense_productName :: Lens.Lens' CreateLicense Prelude.Text
createLicense_productName :: Lens' CreateLicense Text
createLicense_productName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {Text
productName :: Text
$sel:productName:CreateLicense' :: CreateLicense -> Text
productName} -> Text
productName) (\s :: CreateLicense
s@CreateLicense' {} Text
a -> CreateLicense
s {$sel:productName:CreateLicense' :: Text
productName = Text
a} :: CreateLicense)

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

-- | License issuer.
createLicense_issuer :: Lens.Lens' CreateLicense Issuer
createLicense_issuer :: Lens' CreateLicense Issuer
createLicense_issuer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {Issuer
issuer :: Issuer
$sel:issuer:CreateLicense' :: CreateLicense -> Issuer
issuer} -> Issuer
issuer) (\s :: CreateLicense
s@CreateLicense' {} Issuer
a -> CreateLicense
s {$sel:issuer:CreateLicense' :: Issuer
issuer = Issuer
a} :: CreateLicense)

-- | Home Region for the license.
createLicense_homeRegion :: Lens.Lens' CreateLicense Prelude.Text
createLicense_homeRegion :: Lens' CreateLicense Text
createLicense_homeRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {Text
homeRegion :: Text
$sel:homeRegion:CreateLicense' :: CreateLicense -> Text
homeRegion} -> Text
homeRegion) (\s :: CreateLicense
s@CreateLicense' {} Text
a -> CreateLicense
s {$sel:homeRegion:CreateLicense' :: Text
homeRegion = Text
a} :: CreateLicense)

-- | Date and time range during which the license is valid, in ISO8601-UTC
-- format.
createLicense_validity :: Lens.Lens' CreateLicense DatetimeRange
createLicense_validity :: Lens' CreateLicense DatetimeRange
createLicense_validity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {DatetimeRange
validity :: DatetimeRange
$sel:validity:CreateLicense' :: CreateLicense -> DatetimeRange
validity} -> DatetimeRange
validity) (\s :: CreateLicense
s@CreateLicense' {} DatetimeRange
a -> CreateLicense
s {$sel:validity:CreateLicense' :: DatetimeRange
validity = DatetimeRange
a} :: CreateLicense)

-- | License entitlements.
createLicense_entitlements :: Lens.Lens' CreateLicense [Entitlement]
createLicense_entitlements :: Lens' CreateLicense [Entitlement]
createLicense_entitlements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {[Entitlement]
entitlements :: [Entitlement]
$sel:entitlements:CreateLicense' :: CreateLicense -> [Entitlement]
entitlements} -> [Entitlement]
entitlements) (\s :: CreateLicense
s@CreateLicense' {} [Entitlement]
a -> CreateLicense
s {$sel:entitlements:CreateLicense' :: [Entitlement]
entitlements = [Entitlement]
a} :: CreateLicense) 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

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

-- | Configuration for consumption of the license. Choose a provisional
-- configuration for workloads running with continuous connectivity. Choose
-- a borrow configuration for workloads with offline usage.
createLicense_consumptionConfiguration :: Lens.Lens' CreateLicense ConsumptionConfiguration
createLicense_consumptionConfiguration :: Lens' CreateLicense ConsumptionConfiguration
createLicense_consumptionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicense' {ConsumptionConfiguration
consumptionConfiguration :: ConsumptionConfiguration
$sel:consumptionConfiguration:CreateLicense' :: CreateLicense -> ConsumptionConfiguration
consumptionConfiguration} -> ConsumptionConfiguration
consumptionConfiguration) (\s :: CreateLicense
s@CreateLicense' {} ConsumptionConfiguration
a -> CreateLicense
s {$sel:consumptionConfiguration:CreateLicense' :: ConsumptionConfiguration
consumptionConfiguration = ConsumptionConfiguration
a} :: CreateLicense)

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

instance Core.AWSRequest CreateLicense where
  type
    AWSResponse CreateLicense =
      CreateLicenseResponse
  request :: (Service -> Service) -> CreateLicense -> Request CreateLicense
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 CreateLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLicense)))
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 Text
-> Maybe LicenseStatus
-> Maybe Text
-> Int
-> CreateLicenseResponse
CreateLicenseResponse'
            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
"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
"Status")
            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
"Version")
            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 CreateLicense where
  hashWithSalt :: Int -> CreateLicense -> Int
hashWithSalt Int
_salt CreateLicense' {[Entitlement]
Maybe [Metadata]
Text
DatetimeRange
Issuer
ConsumptionConfiguration
clientToken :: Text
consumptionConfiguration :: ConsumptionConfiguration
beneficiary :: Text
entitlements :: [Entitlement]
validity :: DatetimeRange
homeRegion :: Text
issuer :: Issuer
productSKU :: Text
productName :: Text
licenseName :: Text
licenseMetadata :: Maybe [Metadata]
$sel:clientToken:CreateLicense' :: CreateLicense -> Text
$sel:consumptionConfiguration:CreateLicense' :: CreateLicense -> ConsumptionConfiguration
$sel:beneficiary:CreateLicense' :: CreateLicense -> Text
$sel:entitlements:CreateLicense' :: CreateLicense -> [Entitlement]
$sel:validity:CreateLicense' :: CreateLicense -> DatetimeRange
$sel:homeRegion:CreateLicense' :: CreateLicense -> Text
$sel:issuer:CreateLicense' :: CreateLicense -> Issuer
$sel:productSKU:CreateLicense' :: CreateLicense -> Text
$sel:productName:CreateLicense' :: CreateLicense -> Text
$sel:licenseName:CreateLicense' :: CreateLicense -> Text
$sel:licenseMetadata:CreateLicense' :: CreateLicense -> Maybe [Metadata]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Metadata]
licenseMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
licenseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productSKU
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Issuer
issuer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
homeRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DatetimeRange
validity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Entitlement]
entitlements
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
beneficiary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConsumptionConfiguration
consumptionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientToken

instance Prelude.NFData CreateLicense where
  rnf :: CreateLicense -> ()
rnf CreateLicense' {[Entitlement]
Maybe [Metadata]
Text
DatetimeRange
Issuer
ConsumptionConfiguration
clientToken :: Text
consumptionConfiguration :: ConsumptionConfiguration
beneficiary :: Text
entitlements :: [Entitlement]
validity :: DatetimeRange
homeRegion :: Text
issuer :: Issuer
productSKU :: Text
productName :: Text
licenseName :: Text
licenseMetadata :: Maybe [Metadata]
$sel:clientToken:CreateLicense' :: CreateLicense -> Text
$sel:consumptionConfiguration:CreateLicense' :: CreateLicense -> ConsumptionConfiguration
$sel:beneficiary:CreateLicense' :: CreateLicense -> Text
$sel:entitlements:CreateLicense' :: CreateLicense -> [Entitlement]
$sel:validity:CreateLicense' :: CreateLicense -> DatetimeRange
$sel:homeRegion:CreateLicense' :: CreateLicense -> Text
$sel:issuer:CreateLicense' :: CreateLicense -> Issuer
$sel:productSKU:CreateLicense' :: CreateLicense -> Text
$sel:productName:CreateLicense' :: CreateLicense -> Text
$sel:licenseName:CreateLicense' :: CreateLicense -> Text
$sel:licenseMetadata:CreateLicense' :: CreateLicense -> Maybe [Metadata]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Metadata]
licenseMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
licenseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productName
      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 Issuer
issuer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
homeRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DatetimeRange
validity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Entitlement]
entitlements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
beneficiary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConsumptionConfiguration
consumptionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientToken

instance Data.ToHeaders CreateLicense where
  toHeaders :: CreateLicense -> 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.CreateLicense" ::
                          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 CreateLicense where
  toJSON :: CreateLicense -> Value
toJSON CreateLicense' {[Entitlement]
Maybe [Metadata]
Text
DatetimeRange
Issuer
ConsumptionConfiguration
clientToken :: Text
consumptionConfiguration :: ConsumptionConfiguration
beneficiary :: Text
entitlements :: [Entitlement]
validity :: DatetimeRange
homeRegion :: Text
issuer :: Issuer
productSKU :: Text
productName :: Text
licenseName :: Text
licenseMetadata :: Maybe [Metadata]
$sel:clientToken:CreateLicense' :: CreateLicense -> Text
$sel:consumptionConfiguration:CreateLicense' :: CreateLicense -> ConsumptionConfiguration
$sel:beneficiary:CreateLicense' :: CreateLicense -> Text
$sel:entitlements:CreateLicense' :: CreateLicense -> [Entitlement]
$sel:validity:CreateLicense' :: CreateLicense -> DatetimeRange
$sel:homeRegion:CreateLicense' :: CreateLicense -> Text
$sel:issuer:CreateLicense' :: CreateLicense -> Issuer
$sel:productSKU:CreateLicense' :: CreateLicense -> Text
$sel:productName:CreateLicense' :: CreateLicense -> Text
$sel:licenseName:CreateLicense' :: CreateLicense -> Text
$sel:licenseMetadata:CreateLicense' :: CreateLicense -> Maybe [Metadata]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LicenseMetadata" 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 [Metadata]
licenseMetadata,
            forall a. a -> Maybe a
Prelude.Just (Key
"LicenseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
licenseName),
            forall a. a -> Maybe a
Prelude.Just (Key
"ProductName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productName),
            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
"Issuer" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Issuer
issuer),
            forall a. a -> Maybe a
Prelude.Just (Key
"HomeRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
homeRegion),
            forall a. a -> Maybe a
Prelude.Just (Key
"Validity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DatetimeRange
validity),
            forall a. a -> Maybe a
Prelude.Just (Key
"Entitlements" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Entitlement]
entitlements),
            forall a. a -> Maybe a
Prelude.Just (Key
"Beneficiary" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
beneficiary),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ConsumptionConfiguration"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ConsumptionConfiguration
consumptionConfiguration
              ),
            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 CreateLicense where
  toPath :: CreateLicense -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCreateLicenseResponse' smart constructor.
data CreateLicenseResponse = CreateLicenseResponse'
  { -- | Amazon Resource Name (ARN) of the license.
    CreateLicenseResponse -> Maybe Text
licenseArn :: Prelude.Maybe Prelude.Text,
    -- | License status.
    CreateLicenseResponse -> Maybe LicenseStatus
status :: Prelude.Maybe LicenseStatus,
    -- | License version.
    CreateLicenseResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateLicenseResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLicenseResponse -> CreateLicenseResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLicenseResponse -> CreateLicenseResponse -> Bool
$c/= :: CreateLicenseResponse -> CreateLicenseResponse -> Bool
== :: CreateLicenseResponse -> CreateLicenseResponse -> Bool
$c== :: CreateLicenseResponse -> CreateLicenseResponse -> Bool
Prelude.Eq, ReadPrec [CreateLicenseResponse]
ReadPrec CreateLicenseResponse
Int -> ReadS CreateLicenseResponse
ReadS [CreateLicenseResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLicenseResponse]
$creadListPrec :: ReadPrec [CreateLicenseResponse]
readPrec :: ReadPrec CreateLicenseResponse
$creadPrec :: ReadPrec CreateLicenseResponse
readList :: ReadS [CreateLicenseResponse]
$creadList :: ReadS [CreateLicenseResponse]
readsPrec :: Int -> ReadS CreateLicenseResponse
$creadsPrec :: Int -> ReadS CreateLicenseResponse
Prelude.Read, Int -> CreateLicenseResponse -> ShowS
[CreateLicenseResponse] -> ShowS
CreateLicenseResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLicenseResponse] -> ShowS
$cshowList :: [CreateLicenseResponse] -> ShowS
show :: CreateLicenseResponse -> String
$cshow :: CreateLicenseResponse -> String
showsPrec :: Int -> CreateLicenseResponse -> ShowS
$cshowsPrec :: Int -> CreateLicenseResponse -> ShowS
Prelude.Show, forall x. Rep CreateLicenseResponse x -> CreateLicenseResponse
forall x. CreateLicenseResponse -> Rep CreateLicenseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLicenseResponse x -> CreateLicenseResponse
$cfrom :: forall x. CreateLicenseResponse -> Rep CreateLicenseResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLicenseResponse' 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:
--
-- 'licenseArn', 'createLicenseResponse_licenseArn' - Amazon Resource Name (ARN) of the license.
--
-- 'status', 'createLicenseResponse_status' - License status.
--
-- 'version', 'createLicenseResponse_version' - License version.
--
-- 'httpStatus', 'createLicenseResponse_httpStatus' - The response's http status code.
newCreateLicenseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLicenseResponse
newCreateLicenseResponse :: Int -> CreateLicenseResponse
newCreateLicenseResponse Int
pHttpStatus_ =
  CreateLicenseResponse'
    { $sel:licenseArn:CreateLicenseResponse' :: Maybe Text
licenseArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateLicenseResponse' :: Maybe LicenseStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:version:CreateLicenseResponse' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLicenseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | License status.
createLicenseResponse_status :: Lens.Lens' CreateLicenseResponse (Prelude.Maybe LicenseStatus)
createLicenseResponse_status :: Lens' CreateLicenseResponse (Maybe LicenseStatus)
createLicenseResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseResponse' {Maybe LicenseStatus
status :: Maybe LicenseStatus
$sel:status:CreateLicenseResponse' :: CreateLicenseResponse -> Maybe LicenseStatus
status} -> Maybe LicenseStatus
status) (\s :: CreateLicenseResponse
s@CreateLicenseResponse' {} Maybe LicenseStatus
a -> CreateLicenseResponse
s {$sel:status:CreateLicenseResponse' :: Maybe LicenseStatus
status = Maybe LicenseStatus
a} :: CreateLicenseResponse)

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

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

instance Prelude.NFData CreateLicenseResponse where
  rnf :: CreateLicenseResponse -> ()
rnf CreateLicenseResponse' {Int
Maybe Text
Maybe LicenseStatus
httpStatus :: Int
version :: Maybe Text
status :: Maybe LicenseStatus
licenseArn :: Maybe Text
$sel:httpStatus:CreateLicenseResponse' :: CreateLicenseResponse -> Int
$sel:version:CreateLicenseResponse' :: CreateLicenseResponse -> Maybe Text
$sel:status:CreateLicenseResponse' :: CreateLicenseResponse -> Maybe LicenseStatus
$sel:licenseArn:CreateLicenseResponse' :: CreateLicenseResponse -> Maybe Text
..} =
    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 LicenseStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus