{-# 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.CreateLicenseConfiguration
-- 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 configuration.
--
-- A license configuration is an abstraction of a customer license
-- agreement that can be consumed and enforced by License Manager.
-- Components include specifications for the license type (licensing by
-- instance, socket, CPU, or vCPU), allowed tenancy (shared tenancy,
-- Dedicated Instance, Dedicated Host, or all of these), license affinity
-- to host (how long a license must be associated with a host), and the
-- number of licenses purchased and used.
module Amazonka.LicenseManager.CreateLicenseConfiguration
  ( -- * Creating a Request
    CreateLicenseConfiguration (..),
    newCreateLicenseConfiguration,

    -- * Request Lenses
    createLicenseConfiguration_description,
    createLicenseConfiguration_disassociateWhenNotFound,
    createLicenseConfiguration_licenseCount,
    createLicenseConfiguration_licenseCountHardLimit,
    createLicenseConfiguration_licenseRules,
    createLicenseConfiguration_productInformationList,
    createLicenseConfiguration_tags,
    createLicenseConfiguration_name,
    createLicenseConfiguration_licenseCountingType,

    -- * Destructuring the Response
    CreateLicenseConfigurationResponse (..),
    newCreateLicenseConfigurationResponse,

    -- * Response Lenses
    createLicenseConfigurationResponse_licenseConfigurationArn,
    createLicenseConfigurationResponse_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:/ 'newCreateLicenseConfiguration' smart constructor.
data CreateLicenseConfiguration = CreateLicenseConfiguration'
  { -- | Description of the license configuration.
    CreateLicenseConfiguration -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | When true, disassociates a resource when software is uninstalled.
    CreateLicenseConfiguration -> Maybe Bool
disassociateWhenNotFound :: Prelude.Maybe Prelude.Bool,
    -- | Number of licenses managed by the license configuration.
    CreateLicenseConfiguration -> Maybe Integer
licenseCount :: Prelude.Maybe Prelude.Integer,
    -- | Indicates whether hard or soft license enforcement is used. Exceeding a
    -- hard limit blocks the launch of new instances.
    CreateLicenseConfiguration -> Maybe Bool
licenseCountHardLimit :: Prelude.Maybe Prelude.Bool,
    -- | License rules. The syntax is #name=value (for example,
    -- #allowedTenancy=EC2-DedicatedHost). The available rules vary by
    -- dimension, as follows.
    --
    -- -   @Cores@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
    --     @maximumCores@ | @minimumCores@
    --
    -- -   @Instances@ dimension: @allowedTenancy@ | @maximumCores@ |
    --     @minimumCores@ | @maximumSockets@ | @minimumSockets@ |
    --     @maximumVcpus@ | @minimumVcpus@
    --
    -- -   @Sockets@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
    --     @maximumSockets@ | @minimumSockets@
    --
    -- -   @vCPUs@ dimension: @allowedTenancy@ | @honorVcpuOptimization@ |
    --     @maximumVcpus@ | @minimumVcpus@
    --
    -- The unit for @licenseAffinityToHost@ is days and the range is 1 to 180.
    -- The possible values for @allowedTenancy@ are @EC2-Default@,
    -- @EC2-DedicatedHost@, and @EC2-DedicatedInstance@. The possible values
    -- for @honorVcpuOptimization@ are @True@ and @False@.
    CreateLicenseConfiguration -> Maybe [Text]
licenseRules :: Prelude.Maybe [Prelude.Text],
    -- | Product information.
    CreateLicenseConfiguration -> Maybe [ProductInformation]
productInformationList :: Prelude.Maybe [ProductInformation],
    -- | Tags to add to the license configuration.
    CreateLicenseConfiguration -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Name of the license configuration.
    CreateLicenseConfiguration -> Text
name :: Prelude.Text,
    -- | Dimension used to track the license inventory.
    CreateLicenseConfiguration -> LicenseCountingType
licenseCountingType :: LicenseCountingType
  }
  deriving (CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool
$c/= :: CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool
== :: CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool
$c== :: CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateLicenseConfiguration]
ReadPrec CreateLicenseConfiguration
Int -> ReadS CreateLicenseConfiguration
ReadS [CreateLicenseConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLicenseConfiguration]
$creadListPrec :: ReadPrec [CreateLicenseConfiguration]
readPrec :: ReadPrec CreateLicenseConfiguration
$creadPrec :: ReadPrec CreateLicenseConfiguration
readList :: ReadS [CreateLicenseConfiguration]
$creadList :: ReadS [CreateLicenseConfiguration]
readsPrec :: Int -> ReadS CreateLicenseConfiguration
$creadsPrec :: Int -> ReadS CreateLicenseConfiguration
Prelude.Read, Int -> CreateLicenseConfiguration -> ShowS
[CreateLicenseConfiguration] -> ShowS
CreateLicenseConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLicenseConfiguration] -> ShowS
$cshowList :: [CreateLicenseConfiguration] -> ShowS
show :: CreateLicenseConfiguration -> String
$cshow :: CreateLicenseConfiguration -> String
showsPrec :: Int -> CreateLicenseConfiguration -> ShowS
$cshowsPrec :: Int -> CreateLicenseConfiguration -> ShowS
Prelude.Show, forall x.
Rep CreateLicenseConfiguration x -> CreateLicenseConfiguration
forall x.
CreateLicenseConfiguration -> Rep CreateLicenseConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLicenseConfiguration x -> CreateLicenseConfiguration
$cfrom :: forall x.
CreateLicenseConfiguration -> Rep CreateLicenseConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CreateLicenseConfiguration' 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:
--
-- 'description', 'createLicenseConfiguration_description' - Description of the license configuration.
--
-- 'disassociateWhenNotFound', 'createLicenseConfiguration_disassociateWhenNotFound' - When true, disassociates a resource when software is uninstalled.
--
-- 'licenseCount', 'createLicenseConfiguration_licenseCount' - Number of licenses managed by the license configuration.
--
-- 'licenseCountHardLimit', 'createLicenseConfiguration_licenseCountHardLimit' - Indicates whether hard or soft license enforcement is used. Exceeding a
-- hard limit blocks the launch of new instances.
--
-- 'licenseRules', 'createLicenseConfiguration_licenseRules' - License rules. The syntax is #name=value (for example,
-- #allowedTenancy=EC2-DedicatedHost). The available rules vary by
-- dimension, as follows.
--
-- -   @Cores@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
--     @maximumCores@ | @minimumCores@
--
-- -   @Instances@ dimension: @allowedTenancy@ | @maximumCores@ |
--     @minimumCores@ | @maximumSockets@ | @minimumSockets@ |
--     @maximumVcpus@ | @minimumVcpus@
--
-- -   @Sockets@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
--     @maximumSockets@ | @minimumSockets@
--
-- -   @vCPUs@ dimension: @allowedTenancy@ | @honorVcpuOptimization@ |
--     @maximumVcpus@ | @minimumVcpus@
--
-- The unit for @licenseAffinityToHost@ is days and the range is 1 to 180.
-- The possible values for @allowedTenancy@ are @EC2-Default@,
-- @EC2-DedicatedHost@, and @EC2-DedicatedInstance@. The possible values
-- for @honorVcpuOptimization@ are @True@ and @False@.
--
-- 'productInformationList', 'createLicenseConfiguration_productInformationList' - Product information.
--
-- 'tags', 'createLicenseConfiguration_tags' - Tags to add to the license configuration.
--
-- 'name', 'createLicenseConfiguration_name' - Name of the license configuration.
--
-- 'licenseCountingType', 'createLicenseConfiguration_licenseCountingType' - Dimension used to track the license inventory.
newCreateLicenseConfiguration ::
  -- | 'name'
  Prelude.Text ->
  -- | 'licenseCountingType'
  LicenseCountingType ->
  CreateLicenseConfiguration
newCreateLicenseConfiguration :: Text -> LicenseCountingType -> CreateLicenseConfiguration
newCreateLicenseConfiguration
  Text
pName_
  LicenseCountingType
pLicenseCountingType_ =
    CreateLicenseConfiguration'
      { $sel:description:CreateLicenseConfiguration' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: Maybe Bool
disassociateWhenNotFound = forall a. Maybe a
Prelude.Nothing,
        $sel:licenseCount:CreateLicenseConfiguration' :: Maybe Integer
licenseCount = forall a. Maybe a
Prelude.Nothing,
        $sel:licenseCountHardLimit:CreateLicenseConfiguration' :: Maybe Bool
licenseCountHardLimit = forall a. Maybe a
Prelude.Nothing,
        $sel:licenseRules:CreateLicenseConfiguration' :: Maybe [Text]
licenseRules = forall a. Maybe a
Prelude.Nothing,
        $sel:productInformationList:CreateLicenseConfiguration' :: Maybe [ProductInformation]
productInformationList = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLicenseConfiguration' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateLicenseConfiguration' :: Text
name = Text
pName_,
        $sel:licenseCountingType:CreateLicenseConfiguration' :: LicenseCountingType
licenseCountingType = LicenseCountingType
pLicenseCountingType_
      }

-- | Description of the license configuration.
createLicenseConfiguration_description :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Text)
createLicenseConfiguration_description :: Lens' CreateLicenseConfiguration (Maybe Text)
createLicenseConfiguration_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe Text
description :: Maybe Text
$sel:description:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe Text
a -> CreateLicenseConfiguration
s {$sel:description:CreateLicenseConfiguration' :: Maybe Text
description = Maybe Text
a} :: CreateLicenseConfiguration)

-- | When true, disassociates a resource when software is uninstalled.
createLicenseConfiguration_disassociateWhenNotFound :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Bool)
createLicenseConfiguration_disassociateWhenNotFound :: Lens' CreateLicenseConfiguration (Maybe Bool)
createLicenseConfiguration_disassociateWhenNotFound = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe Bool
disassociateWhenNotFound :: Maybe Bool
$sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
disassociateWhenNotFound} -> Maybe Bool
disassociateWhenNotFound) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe Bool
a -> CreateLicenseConfiguration
s {$sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: Maybe Bool
disassociateWhenNotFound = Maybe Bool
a} :: CreateLicenseConfiguration)

-- | Number of licenses managed by the license configuration.
createLicenseConfiguration_licenseCount :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Integer)
createLicenseConfiguration_licenseCount :: Lens' CreateLicenseConfiguration (Maybe Integer)
createLicenseConfiguration_licenseCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe Integer
licenseCount :: Maybe Integer
$sel:licenseCount:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Integer
licenseCount} -> Maybe Integer
licenseCount) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe Integer
a -> CreateLicenseConfiguration
s {$sel:licenseCount:CreateLicenseConfiguration' :: Maybe Integer
licenseCount = Maybe Integer
a} :: CreateLicenseConfiguration)

-- | Indicates whether hard or soft license enforcement is used. Exceeding a
-- hard limit blocks the launch of new instances.
createLicenseConfiguration_licenseCountHardLimit :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Bool)
createLicenseConfiguration_licenseCountHardLimit :: Lens' CreateLicenseConfiguration (Maybe Bool)
createLicenseConfiguration_licenseCountHardLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe Bool
licenseCountHardLimit :: Maybe Bool
$sel:licenseCountHardLimit:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
licenseCountHardLimit} -> Maybe Bool
licenseCountHardLimit) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe Bool
a -> CreateLicenseConfiguration
s {$sel:licenseCountHardLimit:CreateLicenseConfiguration' :: Maybe Bool
licenseCountHardLimit = Maybe Bool
a} :: CreateLicenseConfiguration)

-- | License rules. The syntax is #name=value (for example,
-- #allowedTenancy=EC2-DedicatedHost). The available rules vary by
-- dimension, as follows.
--
-- -   @Cores@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
--     @maximumCores@ | @minimumCores@
--
-- -   @Instances@ dimension: @allowedTenancy@ | @maximumCores@ |
--     @minimumCores@ | @maximumSockets@ | @minimumSockets@ |
--     @maximumVcpus@ | @minimumVcpus@
--
-- -   @Sockets@ dimension: @allowedTenancy@ | @licenseAffinityToHost@ |
--     @maximumSockets@ | @minimumSockets@
--
-- -   @vCPUs@ dimension: @allowedTenancy@ | @honorVcpuOptimization@ |
--     @maximumVcpus@ | @minimumVcpus@
--
-- The unit for @licenseAffinityToHost@ is days and the range is 1 to 180.
-- The possible values for @allowedTenancy@ are @EC2-Default@,
-- @EC2-DedicatedHost@, and @EC2-DedicatedInstance@. The possible values
-- for @honorVcpuOptimization@ are @True@ and @False@.
createLicenseConfiguration_licenseRules :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe [Prelude.Text])
createLicenseConfiguration_licenseRules :: Lens' CreateLicenseConfiguration (Maybe [Text])
createLicenseConfiguration_licenseRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe [Text]
licenseRules :: Maybe [Text]
$sel:licenseRules:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Text]
licenseRules} -> Maybe [Text]
licenseRules) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe [Text]
a -> CreateLicenseConfiguration
s {$sel:licenseRules:CreateLicenseConfiguration' :: Maybe [Text]
licenseRules = Maybe [Text]
a} :: CreateLicenseConfiguration) 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

-- | Product information.
createLicenseConfiguration_productInformationList :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe [ProductInformation])
createLicenseConfiguration_productInformationList :: Lens' CreateLicenseConfiguration (Maybe [ProductInformation])
createLicenseConfiguration_productInformationList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe [ProductInformation]
productInformationList :: Maybe [ProductInformation]
$sel:productInformationList:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [ProductInformation]
productInformationList} -> Maybe [ProductInformation]
productInformationList) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe [ProductInformation]
a -> CreateLicenseConfiguration
s {$sel:productInformationList:CreateLicenseConfiguration' :: Maybe [ProductInformation]
productInformationList = Maybe [ProductInformation]
a} :: CreateLicenseConfiguration) 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

-- | Tags to add to the license configuration.
createLicenseConfiguration_tags :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe [Tag])
createLicenseConfiguration_tags :: Lens' CreateLicenseConfiguration (Maybe [Tag])
createLicenseConfiguration_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Maybe [Tag]
a -> CreateLicenseConfiguration
s {$sel:tags:CreateLicenseConfiguration' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateLicenseConfiguration) 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

-- | Name of the license configuration.
createLicenseConfiguration_name :: Lens.Lens' CreateLicenseConfiguration Prelude.Text
createLicenseConfiguration_name :: Lens' CreateLicenseConfiguration Text
createLicenseConfiguration_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {Text
name :: Text
$sel:name:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Text
name} -> Text
name) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} Text
a -> CreateLicenseConfiguration
s {$sel:name:CreateLicenseConfiguration' :: Text
name = Text
a} :: CreateLicenseConfiguration)

-- | Dimension used to track the license inventory.
createLicenseConfiguration_licenseCountingType :: Lens.Lens' CreateLicenseConfiguration LicenseCountingType
createLicenseConfiguration_licenseCountingType :: Lens' CreateLicenseConfiguration LicenseCountingType
createLicenseConfiguration_licenseCountingType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseConfiguration' {LicenseCountingType
licenseCountingType :: LicenseCountingType
$sel:licenseCountingType:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> LicenseCountingType
licenseCountingType} -> LicenseCountingType
licenseCountingType) (\s :: CreateLicenseConfiguration
s@CreateLicenseConfiguration' {} LicenseCountingType
a -> CreateLicenseConfiguration
s {$sel:licenseCountingType:CreateLicenseConfiguration' :: LicenseCountingType
licenseCountingType = LicenseCountingType
a} :: CreateLicenseConfiguration)

instance Core.AWSRequest CreateLicenseConfiguration where
  type
    AWSResponse CreateLicenseConfiguration =
      CreateLicenseConfigurationResponse
  request :: (Service -> Service)
-> CreateLicenseConfiguration -> Request CreateLicenseConfiguration
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 CreateLicenseConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLicenseConfiguration)))
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 -> Int -> CreateLicenseConfigurationResponse
CreateLicenseConfigurationResponse'
            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
"LicenseConfigurationArn")
            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 CreateLicenseConfiguration where
  hashWithSalt :: Int -> CreateLicenseConfiguration -> Int
hashWithSalt Int
_salt CreateLicenseConfiguration' {Maybe Bool
Maybe Integer
Maybe [Text]
Maybe [ProductInformation]
Maybe [Tag]
Maybe Text
Text
LicenseCountingType
licenseCountingType :: LicenseCountingType
name :: Text
tags :: Maybe [Tag]
productInformationList :: Maybe [ProductInformation]
licenseRules :: Maybe [Text]
licenseCountHardLimit :: Maybe Bool
licenseCount :: Maybe Integer
disassociateWhenNotFound :: Maybe Bool
description :: Maybe Text
$sel:licenseCountingType:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> LicenseCountingType
$sel:name:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Text
$sel:tags:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Tag]
$sel:productInformationList:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [ProductInformation]
$sel:licenseRules:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Text]
$sel:licenseCountHardLimit:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:licenseCount:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Integer
$sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:description:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
disassociateWhenNotFound
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
licenseCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
licenseCountHardLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
licenseRules
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ProductInformation]
productInformationList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LicenseCountingType
licenseCountingType

instance Prelude.NFData CreateLicenseConfiguration where
  rnf :: CreateLicenseConfiguration -> ()
rnf CreateLicenseConfiguration' {Maybe Bool
Maybe Integer
Maybe [Text]
Maybe [ProductInformation]
Maybe [Tag]
Maybe Text
Text
LicenseCountingType
licenseCountingType :: LicenseCountingType
name :: Text
tags :: Maybe [Tag]
productInformationList :: Maybe [ProductInformation]
licenseRules :: Maybe [Text]
licenseCountHardLimit :: Maybe Bool
licenseCount :: Maybe Integer
disassociateWhenNotFound :: Maybe Bool
description :: Maybe Text
$sel:licenseCountingType:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> LicenseCountingType
$sel:name:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Text
$sel:tags:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Tag]
$sel:productInformationList:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [ProductInformation]
$sel:licenseRules:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Text]
$sel:licenseCountHardLimit:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:licenseCount:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Integer
$sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:description:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
disassociateWhenNotFound
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
licenseCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
licenseCountHardLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
licenseRules
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProductInformation]
productInformationList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LicenseCountingType
licenseCountingType

instance Data.ToHeaders CreateLicenseConfiguration where
  toHeaders :: CreateLicenseConfiguration -> 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.CreateLicenseConfiguration" ::
                          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 CreateLicenseConfiguration where
  toJSON :: CreateLicenseConfiguration -> Value
toJSON CreateLicenseConfiguration' {Maybe Bool
Maybe Integer
Maybe [Text]
Maybe [ProductInformation]
Maybe [Tag]
Maybe Text
Text
LicenseCountingType
licenseCountingType :: LicenseCountingType
name :: Text
tags :: Maybe [Tag]
productInformationList :: Maybe [ProductInformation]
licenseRules :: Maybe [Text]
licenseCountHardLimit :: Maybe Bool
licenseCount :: Maybe Integer
disassociateWhenNotFound :: Maybe Bool
description :: Maybe Text
$sel:licenseCountingType:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> LicenseCountingType
$sel:name:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Text
$sel:tags:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Tag]
$sel:productInformationList:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [ProductInformation]
$sel:licenseRules:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe [Text]
$sel:licenseCountHardLimit:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:licenseCount:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Integer
$sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Bool
$sel:description:CreateLicenseConfiguration' :: CreateLicenseConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" 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
description,
            (Key
"DisassociateWhenNotFound" 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 Bool
disassociateWhenNotFound,
            (Key
"LicenseCount" 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 Integer
licenseCount,
            (Key
"LicenseCountHardLimit" 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 Bool
licenseCountHardLimit,
            (Key
"LicenseRules" 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]
licenseRules,
            (Key
"ProductInformationList" 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 [ProductInformation]
productInformationList,
            (Key
"Tags" 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 [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"LicenseCountingType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LicenseCountingType
licenseCountingType)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateLicenseConfigurationResponse' 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:
--
-- 'licenseConfigurationArn', 'createLicenseConfigurationResponse_licenseConfigurationArn' - Amazon Resource Name (ARN) of the license configuration.
--
-- 'httpStatus', 'createLicenseConfigurationResponse_httpStatus' - The response's http status code.
newCreateLicenseConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLicenseConfigurationResponse
newCreateLicenseConfigurationResponse :: Int -> CreateLicenseConfigurationResponse
newCreateLicenseConfigurationResponse Int
pHttpStatus_ =
  CreateLicenseConfigurationResponse'
    { $sel:licenseConfigurationArn:CreateLicenseConfigurationResponse' :: Maybe Text
licenseConfigurationArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLicenseConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance
  Prelude.NFData
    CreateLicenseConfigurationResponse
  where
  rnf :: CreateLicenseConfigurationResponse -> ()
rnf CreateLicenseConfigurationResponse' {Int
Maybe Text
httpStatus :: Int
licenseConfigurationArn :: Maybe Text
$sel:httpStatus:CreateLicenseConfigurationResponse' :: CreateLicenseConfigurationResponse -> Int
$sel:licenseConfigurationArn:CreateLicenseConfigurationResponse' :: CreateLicenseConfigurationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
licenseConfigurationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus