{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- 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_licenseCount,
    createLicenseConfiguration_licenseCountHardLimit,
    createLicenseConfiguration_disassociateWhenNotFound,
    createLicenseConfiguration_productInformationList,
    createLicenseConfiguration_licenseRules,
    createLicenseConfiguration_description,
    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.Lens as Lens
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'
  { -- | 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,
    -- | When true, disassociates a resource when software is uninstalled.
    CreateLicenseConfiguration -> Maybe Bool
disassociateWhenNotFound :: Prelude.Maybe Prelude.Bool,
    -- | Product information.
    CreateLicenseConfiguration -> Maybe [ProductInformation]
productInformationList :: Prelude.Maybe [ProductInformation],
    -- | 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],
    -- | Description of the license configuration.
    CreateLicenseConfiguration -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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
(CreateLicenseConfiguration -> CreateLicenseConfiguration -> Bool)
-> (CreateLicenseConfiguration
    -> CreateLicenseConfiguration -> Bool)
-> Eq CreateLicenseConfiguration
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]
(Int -> ReadS CreateLicenseConfiguration)
-> ReadS [CreateLicenseConfiguration]
-> ReadPrec CreateLicenseConfiguration
-> ReadPrec [CreateLicenseConfiguration]
-> Read 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
(Int -> CreateLicenseConfiguration -> ShowS)
-> (CreateLicenseConfiguration -> String)
-> ([CreateLicenseConfiguration] -> ShowS)
-> Show CreateLicenseConfiguration
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.
 CreateLicenseConfiguration -> Rep CreateLicenseConfiguration x)
-> (forall x.
    Rep CreateLicenseConfiguration x -> CreateLicenseConfiguration)
-> Generic CreateLicenseConfiguration
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:
--
-- '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.
--
-- 'disassociateWhenNotFound', 'createLicenseConfiguration_disassociateWhenNotFound' - When true, disassociates a resource when software is uninstalled.
--
-- 'productInformationList', 'createLicenseConfiguration_productInformationList' - Product information.
--
-- '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@.
--
-- 'description', 'createLicenseConfiguration_description' - Description of the license configuration.
--
-- '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' :: Maybe Integer
-> Maybe Bool
-> Maybe Bool
-> Maybe [ProductInformation]
-> Maybe [Text]
-> Maybe Text
-> Maybe [Tag]
-> Text
-> LicenseCountingType
-> CreateLicenseConfiguration
CreateLicenseConfiguration'
      { $sel:licenseCount:CreateLicenseConfiguration' :: Maybe Integer
licenseCount =
          Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseCountHardLimit:CreateLicenseConfiguration' :: Maybe Bool
licenseCountHardLimit = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:disassociateWhenNotFound:CreateLicenseConfiguration' :: Maybe Bool
disassociateWhenNotFound = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:productInformationList:CreateLicenseConfiguration' :: Maybe [ProductInformation]
productInformationList = Maybe [ProductInformation]
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseRules:CreateLicenseConfiguration' :: Maybe [Text]
licenseRules = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateLicenseConfiguration' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLicenseConfiguration' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateLicenseConfiguration' :: Text
name = Text
pName_,
        $sel:licenseCountingType:CreateLicenseConfiguration' :: LicenseCountingType
licenseCountingType = LicenseCountingType
pLicenseCountingType_
      }

-- | Number of licenses managed by the license configuration.
createLicenseConfiguration_licenseCount :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Integer)
createLicenseConfiguration_licenseCount :: (Maybe Integer -> f (Maybe Integer))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_licenseCount = (CreateLicenseConfiguration -> Maybe Integer)
-> (CreateLicenseConfiguration
    -> Maybe Integer -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe Integer)
     (Maybe Integer)
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 :: (Maybe Bool -> f (Maybe Bool))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_licenseCountHardLimit = (CreateLicenseConfiguration -> Maybe Bool)
-> (CreateLicenseConfiguration
    -> Maybe Bool -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe Bool)
     (Maybe Bool)
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)

-- | When true, disassociates a resource when software is uninstalled.
createLicenseConfiguration_disassociateWhenNotFound :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Bool)
createLicenseConfiguration_disassociateWhenNotFound :: (Maybe Bool -> f (Maybe Bool))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_disassociateWhenNotFound = (CreateLicenseConfiguration -> Maybe Bool)
-> (CreateLicenseConfiguration
    -> Maybe Bool -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe Bool)
     (Maybe Bool)
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)

-- | Product information.
createLicenseConfiguration_productInformationList :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe [ProductInformation])
createLicenseConfiguration_productInformationList :: (Maybe [ProductInformation] -> f (Maybe [ProductInformation]))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_productInformationList = (CreateLicenseConfiguration -> Maybe [ProductInformation])
-> (CreateLicenseConfiguration
    -> Maybe [ProductInformation] -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe [ProductInformation])
     (Maybe [ProductInformation])
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) ((Maybe [ProductInformation] -> f (Maybe [ProductInformation]))
 -> CreateLicenseConfiguration -> f CreateLicenseConfiguration)
-> ((Maybe [ProductInformation] -> f (Maybe [ProductInformation]))
    -> Maybe [ProductInformation] -> f (Maybe [ProductInformation]))
-> (Maybe [ProductInformation] -> f (Maybe [ProductInformation]))
-> CreateLicenseConfiguration
-> f CreateLicenseConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProductInformation]
  [ProductInformation]
  [ProductInformation]
  [ProductInformation]
-> Iso
     (Maybe [ProductInformation])
     (Maybe [ProductInformation])
     (Maybe [ProductInformation])
     (Maybe [ProductInformation])
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 AnIso
  [ProductInformation]
  [ProductInformation]
  [ProductInformation]
  [ProductInformation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_licenseRules = (CreateLicenseConfiguration -> Maybe [Text])
-> (CreateLicenseConfiguration
    -> Maybe [Text] -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateLicenseConfiguration -> f CreateLicenseConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateLicenseConfiguration
-> f CreateLicenseConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Description of the license configuration.
createLicenseConfiguration_description :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe Prelude.Text)
createLicenseConfiguration_description :: (Maybe Text -> f (Maybe Text))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_description = (CreateLicenseConfiguration -> Maybe Text)
-> (CreateLicenseConfiguration
    -> Maybe Text -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe Text)
     (Maybe Text)
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)

-- | Tags to add to the license configuration.
createLicenseConfiguration_tags :: Lens.Lens' CreateLicenseConfiguration (Prelude.Maybe [Tag])
createLicenseConfiguration_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_tags = (CreateLicenseConfiguration -> Maybe [Tag])
-> (CreateLicenseConfiguration
    -> Maybe [Tag] -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     (Maybe [Tag])
     (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateLicenseConfiguration -> f CreateLicenseConfiguration)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateLicenseConfiguration
-> f CreateLicenseConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
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 :: (Text -> f Text)
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_name = (CreateLicenseConfiguration -> Text)
-> (CreateLicenseConfiguration
    -> Text -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration CreateLicenseConfiguration Text Text
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 :: (LicenseCountingType -> f LicenseCountingType)
-> CreateLicenseConfiguration -> f CreateLicenseConfiguration
createLicenseConfiguration_licenseCountingType = (CreateLicenseConfiguration -> LicenseCountingType)
-> (CreateLicenseConfiguration
    -> LicenseCountingType -> CreateLicenseConfiguration)
-> Lens
     CreateLicenseConfiguration
     CreateLicenseConfiguration
     LicenseCountingType
     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 :: CreateLicenseConfiguration -> Request CreateLicenseConfiguration
request = Service
-> CreateLicenseConfiguration -> Request CreateLicenseConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLicenseConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLicenseConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLicenseConfiguration))
-> Logger
-> Service
-> Proxy CreateLicenseConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLicenseConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateLicenseConfigurationResponse
CreateLicenseConfigurationResponse'
            (Maybe Text -> Int -> CreateLicenseConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLicenseConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LicenseConfigurationArn")
            Either String (Int -> CreateLicenseConfigurationResponse)
-> Either String Int
-> Either String CreateLicenseConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateLicenseConfiguration

instance Prelude.NFData CreateLicenseConfiguration

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

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

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

instance Core.ToQuery CreateLicenseConfiguration where
  toQuery :: CreateLicenseConfiguration -> QueryString
toQuery = QueryString -> CreateLicenseConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateLicenseConfigurationResponse
 -> CreateLicenseConfigurationResponse -> Bool)
-> (CreateLicenseConfigurationResponse
    -> CreateLicenseConfigurationResponse -> Bool)
-> Eq CreateLicenseConfigurationResponse
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]
(Int -> ReadS CreateLicenseConfigurationResponse)
-> ReadS [CreateLicenseConfigurationResponse]
-> ReadPrec CreateLicenseConfigurationResponse
-> ReadPrec [CreateLicenseConfigurationResponse]
-> Read 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
(Int -> CreateLicenseConfigurationResponse -> ShowS)
-> (CreateLicenseConfigurationResponse -> String)
-> ([CreateLicenseConfigurationResponse] -> ShowS)
-> Show CreateLicenseConfigurationResponse
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.
 CreateLicenseConfigurationResponse
 -> Rep CreateLicenseConfigurationResponse x)
-> (forall x.
    Rep CreateLicenseConfigurationResponse x
    -> CreateLicenseConfigurationResponse)
-> Generic CreateLicenseConfigurationResponse
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' :: Maybe Text -> Int -> CreateLicenseConfigurationResponse
CreateLicenseConfigurationResponse'
    { $sel:licenseConfigurationArn:CreateLicenseConfigurationResponse' :: Maybe Text
licenseConfigurationArn =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> CreateLicenseConfigurationResponse
-> f CreateLicenseConfigurationResponse
createLicenseConfigurationResponse_licenseConfigurationArn = (CreateLicenseConfigurationResponse -> Maybe Text)
-> (CreateLicenseConfigurationResponse
    -> Maybe Text -> CreateLicenseConfigurationResponse)
-> Lens
     CreateLicenseConfigurationResponse
     CreateLicenseConfigurationResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> CreateLicenseConfigurationResponse
-> f CreateLicenseConfigurationResponse
createLicenseConfigurationResponse_httpStatus = (CreateLicenseConfigurationResponse -> Int)
-> (CreateLicenseConfigurationResponse
    -> Int -> CreateLicenseConfigurationResponse)
-> Lens
     CreateLicenseConfigurationResponse
     CreateLicenseConfigurationResponse
     Int
     Int
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