{-# 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.CreateLicenseVersion
-- 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 new version of the specified license.
module Amazonka.LicenseManager.CreateLicenseVersion
  ( -- * Creating a Request
    CreateLicenseVersion (..),
    newCreateLicenseVersion,

    -- * Request Lenses
    createLicenseVersion_sourceVersion,
    createLicenseVersion_licenseMetadata,
    createLicenseVersion_licenseArn,
    createLicenseVersion_licenseName,
    createLicenseVersion_productName,
    createLicenseVersion_issuer,
    createLicenseVersion_homeRegion,
    createLicenseVersion_validity,
    createLicenseVersion_entitlements,
    createLicenseVersion_consumptionConfiguration,
    createLicenseVersion_status,
    createLicenseVersion_clientToken,

    -- * Destructuring the Response
    CreateLicenseVersionResponse (..),
    newCreateLicenseVersionResponse,

    -- * Response Lenses
    createLicenseVersionResponse_status,
    createLicenseVersionResponse_version,
    createLicenseVersionResponse_licenseArn,
    createLicenseVersionResponse_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:/ 'newCreateLicenseVersion' smart constructor.
data CreateLicenseVersion = CreateLicenseVersion'
  { -- | Current version of the license.
    CreateLicenseVersion -> Maybe Text
sourceVersion :: Prelude.Maybe Prelude.Text,
    -- | Information about the license.
    CreateLicenseVersion -> Maybe [Metadata]
licenseMetadata :: Prelude.Maybe [Metadata],
    -- | Amazon Resource Name (ARN) of the license.
    CreateLicenseVersion -> Text
licenseArn :: Prelude.Text,
    -- | License name.
    CreateLicenseVersion -> Text
licenseName :: Prelude.Text,
    -- | Product name.
    CreateLicenseVersion -> Text
productName :: Prelude.Text,
    -- | License issuer.
    CreateLicenseVersion -> Issuer
issuer :: Issuer,
    -- | Home Region of the license.
    CreateLicenseVersion -> Text
homeRegion :: Prelude.Text,
    -- | Date and time range during which the license is valid, in ISO8601-UTC
    -- format.
    CreateLicenseVersion -> DatetimeRange
validity :: DatetimeRange,
    -- | License entitlements.
    CreateLicenseVersion -> [Entitlement]
entitlements :: [Entitlement],
    -- | 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.
    CreateLicenseVersion -> ConsumptionConfiguration
consumptionConfiguration :: ConsumptionConfiguration,
    -- | License status.
    CreateLicenseVersion -> LicenseStatus
status :: LicenseStatus,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateLicenseVersion -> Text
clientToken :: Prelude.Text
  }
  deriving (CreateLicenseVersion -> CreateLicenseVersion -> Bool
(CreateLicenseVersion -> CreateLicenseVersion -> Bool)
-> (CreateLicenseVersion -> CreateLicenseVersion -> Bool)
-> Eq CreateLicenseVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLicenseVersion -> CreateLicenseVersion -> Bool
$c/= :: CreateLicenseVersion -> CreateLicenseVersion -> Bool
== :: CreateLicenseVersion -> CreateLicenseVersion -> Bool
$c== :: CreateLicenseVersion -> CreateLicenseVersion -> Bool
Prelude.Eq, ReadPrec [CreateLicenseVersion]
ReadPrec CreateLicenseVersion
Int -> ReadS CreateLicenseVersion
ReadS [CreateLicenseVersion]
(Int -> ReadS CreateLicenseVersion)
-> ReadS [CreateLicenseVersion]
-> ReadPrec CreateLicenseVersion
-> ReadPrec [CreateLicenseVersion]
-> Read CreateLicenseVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLicenseVersion]
$creadListPrec :: ReadPrec [CreateLicenseVersion]
readPrec :: ReadPrec CreateLicenseVersion
$creadPrec :: ReadPrec CreateLicenseVersion
readList :: ReadS [CreateLicenseVersion]
$creadList :: ReadS [CreateLicenseVersion]
readsPrec :: Int -> ReadS CreateLicenseVersion
$creadsPrec :: Int -> ReadS CreateLicenseVersion
Prelude.Read, Int -> CreateLicenseVersion -> ShowS
[CreateLicenseVersion] -> ShowS
CreateLicenseVersion -> String
(Int -> CreateLicenseVersion -> ShowS)
-> (CreateLicenseVersion -> String)
-> ([CreateLicenseVersion] -> ShowS)
-> Show CreateLicenseVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLicenseVersion] -> ShowS
$cshowList :: [CreateLicenseVersion] -> ShowS
show :: CreateLicenseVersion -> String
$cshow :: CreateLicenseVersion -> String
showsPrec :: Int -> CreateLicenseVersion -> ShowS
$cshowsPrec :: Int -> CreateLicenseVersion -> ShowS
Prelude.Show, (forall x. CreateLicenseVersion -> Rep CreateLicenseVersion x)
-> (forall x. Rep CreateLicenseVersion x -> CreateLicenseVersion)
-> Generic CreateLicenseVersion
forall x. Rep CreateLicenseVersion x -> CreateLicenseVersion
forall x. CreateLicenseVersion -> Rep CreateLicenseVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLicenseVersion x -> CreateLicenseVersion
$cfrom :: forall x. CreateLicenseVersion -> Rep CreateLicenseVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateLicenseVersion' 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:
--
-- 'sourceVersion', 'createLicenseVersion_sourceVersion' - Current version of the license.
--
-- 'licenseMetadata', 'createLicenseVersion_licenseMetadata' - Information about the license.
--
-- 'licenseArn', 'createLicenseVersion_licenseArn' - Amazon Resource Name (ARN) of the license.
--
-- 'licenseName', 'createLicenseVersion_licenseName' - License name.
--
-- 'productName', 'createLicenseVersion_productName' - Product name.
--
-- 'issuer', 'createLicenseVersion_issuer' - License issuer.
--
-- 'homeRegion', 'createLicenseVersion_homeRegion' - Home Region of the license.
--
-- 'validity', 'createLicenseVersion_validity' - Date and time range during which the license is valid, in ISO8601-UTC
-- format.
--
-- 'entitlements', 'createLicenseVersion_entitlements' - License entitlements.
--
-- 'consumptionConfiguration', 'createLicenseVersion_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.
--
-- 'status', 'createLicenseVersion_status' - License status.
--
-- 'clientToken', 'createLicenseVersion_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
newCreateLicenseVersion ::
  -- | 'licenseArn'
  Prelude.Text ->
  -- | 'licenseName'
  Prelude.Text ->
  -- | 'productName'
  Prelude.Text ->
  -- | 'issuer'
  Issuer ->
  -- | 'homeRegion'
  Prelude.Text ->
  -- | 'validity'
  DatetimeRange ->
  -- | 'consumptionConfiguration'
  ConsumptionConfiguration ->
  -- | 'status'
  LicenseStatus ->
  -- | 'clientToken'
  Prelude.Text ->
  CreateLicenseVersion
newCreateLicenseVersion :: Text
-> Text
-> Text
-> Issuer
-> Text
-> DatetimeRange
-> ConsumptionConfiguration
-> LicenseStatus
-> Text
-> CreateLicenseVersion
newCreateLicenseVersion
  Text
pLicenseArn_
  Text
pLicenseName_
  Text
pProductName_
  Issuer
pIssuer_
  Text
pHomeRegion_
  DatetimeRange
pValidity_
  ConsumptionConfiguration
pConsumptionConfiguration_
  LicenseStatus
pStatus_
  Text
pClientToken_ =
    CreateLicenseVersion' :: Maybe Text
-> Maybe [Metadata]
-> Text
-> Text
-> Text
-> Issuer
-> Text
-> DatetimeRange
-> [Entitlement]
-> ConsumptionConfiguration
-> LicenseStatus
-> Text
-> CreateLicenseVersion
CreateLicenseVersion'
      { $sel:sourceVersion:CreateLicenseVersion' :: Maybe Text
sourceVersion =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseMetadata:CreateLicenseVersion' :: Maybe [Metadata]
licenseMetadata = Maybe [Metadata]
forall a. Maybe a
Prelude.Nothing,
        $sel:licenseArn:CreateLicenseVersion' :: Text
licenseArn = Text
pLicenseArn_,
        $sel:licenseName:CreateLicenseVersion' :: Text
licenseName = Text
pLicenseName_,
        $sel:productName:CreateLicenseVersion' :: Text
productName = Text
pProductName_,
        $sel:issuer:CreateLicenseVersion' :: Issuer
issuer = Issuer
pIssuer_,
        $sel:homeRegion:CreateLicenseVersion' :: Text
homeRegion = Text
pHomeRegion_,
        $sel:validity:CreateLicenseVersion' :: DatetimeRange
validity = DatetimeRange
pValidity_,
        $sel:entitlements:CreateLicenseVersion' :: [Entitlement]
entitlements = [Entitlement]
forall a. Monoid a => a
Prelude.mempty,
        $sel:consumptionConfiguration:CreateLicenseVersion' :: ConsumptionConfiguration
consumptionConfiguration =
          ConsumptionConfiguration
pConsumptionConfiguration_,
        $sel:status:CreateLicenseVersion' :: LicenseStatus
status = LicenseStatus
pStatus_,
        $sel:clientToken:CreateLicenseVersion' :: Text
clientToken = Text
pClientToken_
      }

-- | Current version of the license.
createLicenseVersion_sourceVersion :: Lens.Lens' CreateLicenseVersion (Prelude.Maybe Prelude.Text)
createLicenseVersion_sourceVersion :: (Maybe Text -> f (Maybe Text))
-> CreateLicenseVersion -> f CreateLicenseVersion
createLicenseVersion_sourceVersion = (CreateLicenseVersion -> Maybe Text)
-> (CreateLicenseVersion -> Maybe Text -> CreateLicenseVersion)
-> Lens
     CreateLicenseVersion CreateLicenseVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersion' {Maybe Text
sourceVersion :: Maybe Text
$sel:sourceVersion:CreateLicenseVersion' :: CreateLicenseVersion -> Maybe Text
sourceVersion} -> Maybe Text
sourceVersion) (\s :: CreateLicenseVersion
s@CreateLicenseVersion' {} Maybe Text
a -> CreateLicenseVersion
s {$sel:sourceVersion:CreateLicenseVersion' :: Maybe Text
sourceVersion = Maybe Text
a} :: CreateLicenseVersion)

-- | Information about the license.
createLicenseVersion_licenseMetadata :: Lens.Lens' CreateLicenseVersion (Prelude.Maybe [Metadata])
createLicenseVersion_licenseMetadata :: (Maybe [Metadata] -> f (Maybe [Metadata]))
-> CreateLicenseVersion -> f CreateLicenseVersion
createLicenseVersion_licenseMetadata = (CreateLicenseVersion -> Maybe [Metadata])
-> (CreateLicenseVersion
    -> Maybe [Metadata] -> CreateLicenseVersion)
-> Lens
     CreateLicenseVersion
     CreateLicenseVersion
     (Maybe [Metadata])
     (Maybe [Metadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersion' {Maybe [Metadata]
licenseMetadata :: Maybe [Metadata]
$sel:licenseMetadata:CreateLicenseVersion' :: CreateLicenseVersion -> Maybe [Metadata]
licenseMetadata} -> Maybe [Metadata]
licenseMetadata) (\s :: CreateLicenseVersion
s@CreateLicenseVersion' {} Maybe [Metadata]
a -> CreateLicenseVersion
s {$sel:licenseMetadata:CreateLicenseVersion' :: Maybe [Metadata]
licenseMetadata = Maybe [Metadata]
a} :: CreateLicenseVersion) ((Maybe [Metadata] -> f (Maybe [Metadata]))
 -> CreateLicenseVersion -> f CreateLicenseVersion)
-> ((Maybe [Metadata] -> f (Maybe [Metadata]))
    -> Maybe [Metadata] -> f (Maybe [Metadata]))
-> (Maybe [Metadata] -> f (Maybe [Metadata]))
-> CreateLicenseVersion
-> f CreateLicenseVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Metadata] [Metadata] [Metadata] [Metadata]
-> Iso
     (Maybe [Metadata])
     (Maybe [Metadata])
     (Maybe [Metadata])
     (Maybe [Metadata])
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 [Metadata] [Metadata] [Metadata] [Metadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

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

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

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

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

-- | 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.
createLicenseVersion_consumptionConfiguration :: Lens.Lens' CreateLicenseVersion ConsumptionConfiguration
createLicenseVersion_consumptionConfiguration :: (ConsumptionConfiguration -> f ConsumptionConfiguration)
-> CreateLicenseVersion -> f CreateLicenseVersion
createLicenseVersion_consumptionConfiguration = (CreateLicenseVersion -> ConsumptionConfiguration)
-> (CreateLicenseVersion
    -> ConsumptionConfiguration -> CreateLicenseVersion)
-> Lens
     CreateLicenseVersion
     CreateLicenseVersion
     ConsumptionConfiguration
     ConsumptionConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersion' {ConsumptionConfiguration
consumptionConfiguration :: ConsumptionConfiguration
$sel:consumptionConfiguration:CreateLicenseVersion' :: CreateLicenseVersion -> ConsumptionConfiguration
consumptionConfiguration} -> ConsumptionConfiguration
consumptionConfiguration) (\s :: CreateLicenseVersion
s@CreateLicenseVersion' {} ConsumptionConfiguration
a -> CreateLicenseVersion
s {$sel:consumptionConfiguration:CreateLicenseVersion' :: ConsumptionConfiguration
consumptionConfiguration = ConsumptionConfiguration
a} :: CreateLicenseVersion)

-- | License status.
createLicenseVersion_status :: Lens.Lens' CreateLicenseVersion LicenseStatus
createLicenseVersion_status :: (LicenseStatus -> f LicenseStatus)
-> CreateLicenseVersion -> f CreateLicenseVersion
createLicenseVersion_status = (CreateLicenseVersion -> LicenseStatus)
-> (CreateLicenseVersion -> LicenseStatus -> CreateLicenseVersion)
-> Lens
     CreateLicenseVersion
     CreateLicenseVersion
     LicenseStatus
     LicenseStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersion' {LicenseStatus
status :: LicenseStatus
$sel:status:CreateLicenseVersion' :: CreateLicenseVersion -> LicenseStatus
status} -> LicenseStatus
status) (\s :: CreateLicenseVersion
s@CreateLicenseVersion' {} LicenseStatus
a -> CreateLicenseVersion
s {$sel:status:CreateLicenseVersion' :: LicenseStatus
status = LicenseStatus
a} :: CreateLicenseVersion)

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

instance Core.AWSRequest CreateLicenseVersion where
  type
    AWSResponse CreateLicenseVersion =
      CreateLicenseVersionResponse
  request :: CreateLicenseVersion -> Request CreateLicenseVersion
request = Service -> CreateLicenseVersion -> Request CreateLicenseVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLicenseVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLicenseVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLicenseVersion))
-> Logger
-> Service
-> Proxy CreateLicenseVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLicenseVersion)))
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 LicenseStatus
-> Maybe Text -> Maybe Text -> Int -> CreateLicenseVersionResponse
CreateLicenseVersionResponse'
            (Maybe LicenseStatus
 -> Maybe Text -> Maybe Text -> Int -> CreateLicenseVersionResponse)
-> Either String (Maybe LicenseStatus)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> CreateLicenseVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LicenseStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> CreateLicenseVersionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateLicenseVersionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Version")
            Either String (Maybe Text -> Int -> CreateLicenseVersionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLicenseVersionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"LicenseArn")
            Either String (Int -> CreateLicenseVersionResponse)
-> Either String Int -> Either String CreateLicenseVersionResponse
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 CreateLicenseVersion

instance Prelude.NFData CreateLicenseVersion

instance Core.ToHeaders CreateLicenseVersion where
  toHeaders :: CreateLicenseVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateLicenseVersion -> 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.CreateLicenseVersion" ::
                          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 CreateLicenseVersion where
  toJSON :: CreateLicenseVersion -> Value
toJSON CreateLicenseVersion' {[Entitlement]
Maybe [Metadata]
Maybe Text
Text
DatetimeRange
Issuer
LicenseStatus
ConsumptionConfiguration
clientToken :: Text
status :: LicenseStatus
consumptionConfiguration :: ConsumptionConfiguration
entitlements :: [Entitlement]
validity :: DatetimeRange
homeRegion :: Text
issuer :: Issuer
productName :: Text
licenseName :: Text
licenseArn :: Text
licenseMetadata :: Maybe [Metadata]
sourceVersion :: Maybe Text
$sel:clientToken:CreateLicenseVersion' :: CreateLicenseVersion -> Text
$sel:status:CreateLicenseVersion' :: CreateLicenseVersion -> LicenseStatus
$sel:consumptionConfiguration:CreateLicenseVersion' :: CreateLicenseVersion -> ConsumptionConfiguration
$sel:entitlements:CreateLicenseVersion' :: CreateLicenseVersion -> [Entitlement]
$sel:validity:CreateLicenseVersion' :: CreateLicenseVersion -> DatetimeRange
$sel:homeRegion:CreateLicenseVersion' :: CreateLicenseVersion -> Text
$sel:issuer:CreateLicenseVersion' :: CreateLicenseVersion -> Issuer
$sel:productName:CreateLicenseVersion' :: CreateLicenseVersion -> Text
$sel:licenseName:CreateLicenseVersion' :: CreateLicenseVersion -> Text
$sel:licenseArn:CreateLicenseVersion' :: CreateLicenseVersion -> Text
$sel:licenseMetadata:CreateLicenseVersion' :: CreateLicenseVersion -> Maybe [Metadata]
$sel:sourceVersion:CreateLicenseVersion' :: CreateLicenseVersion -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SourceVersion" 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
sourceVersion,
            (Text
"LicenseMetadata" Text -> [Metadata] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Metadata] -> Pair) -> Maybe [Metadata] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Metadata]
licenseMetadata,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LicenseArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LicenseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Issuer" Text -> Issuer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Issuer
issuer),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HomeRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
homeRegion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Validity" Text -> DatetimeRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DatetimeRange
validity),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Entitlements" Text -> [Entitlement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Entitlement]
entitlements),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ConsumptionConfiguration"
                  Text -> ConsumptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConsumptionConfiguration
consumptionConfiguration
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Status" Text -> LicenseStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LicenseStatus
status),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateLicenseVersionResponse' 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:
--
-- 'status', 'createLicenseVersionResponse_status' - License status.
--
-- 'version', 'createLicenseVersionResponse_version' - New version of the license.
--
-- 'licenseArn', 'createLicenseVersionResponse_licenseArn' - License ARN.
--
-- 'httpStatus', 'createLicenseVersionResponse_httpStatus' - The response's http status code.
newCreateLicenseVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLicenseVersionResponse
newCreateLicenseVersionResponse :: Int -> CreateLicenseVersionResponse
newCreateLicenseVersionResponse Int
pHttpStatus_ =
  CreateLicenseVersionResponse' :: Maybe LicenseStatus
-> Maybe Text -> Maybe Text -> Int -> CreateLicenseVersionResponse
CreateLicenseVersionResponse'
    { $sel:status:CreateLicenseVersionResponse' :: Maybe LicenseStatus
status =
        Maybe LicenseStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:version:CreateLicenseVersionResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseArn:CreateLicenseVersionResponse' :: Maybe Text
licenseArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLicenseVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | New version of the license.
createLicenseVersionResponse_version :: Lens.Lens' CreateLicenseVersionResponse (Prelude.Maybe Prelude.Text)
createLicenseVersionResponse_version :: (Maybe Text -> f (Maybe Text))
-> CreateLicenseVersionResponse -> f CreateLicenseVersionResponse
createLicenseVersionResponse_version = (CreateLicenseVersionResponse -> Maybe Text)
-> (CreateLicenseVersionResponse
    -> Maybe Text -> CreateLicenseVersionResponse)
-> Lens
     CreateLicenseVersionResponse
     CreateLicenseVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersionResponse' {Maybe Text
version :: Maybe Text
$sel:version:CreateLicenseVersionResponse' :: CreateLicenseVersionResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateLicenseVersionResponse
s@CreateLicenseVersionResponse' {} Maybe Text
a -> CreateLicenseVersionResponse
s {$sel:version:CreateLicenseVersionResponse' :: Maybe Text
version = Maybe Text
a} :: CreateLicenseVersionResponse)

-- | License ARN.
createLicenseVersionResponse_licenseArn :: Lens.Lens' CreateLicenseVersionResponse (Prelude.Maybe Prelude.Text)
createLicenseVersionResponse_licenseArn :: (Maybe Text -> f (Maybe Text))
-> CreateLicenseVersionResponse -> f CreateLicenseVersionResponse
createLicenseVersionResponse_licenseArn = (CreateLicenseVersionResponse -> Maybe Text)
-> (CreateLicenseVersionResponse
    -> Maybe Text -> CreateLicenseVersionResponse)
-> Lens
     CreateLicenseVersionResponse
     CreateLicenseVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLicenseVersionResponse' {Maybe Text
licenseArn :: Maybe Text
$sel:licenseArn:CreateLicenseVersionResponse' :: CreateLicenseVersionResponse -> Maybe Text
licenseArn} -> Maybe Text
licenseArn) (\s :: CreateLicenseVersionResponse
s@CreateLicenseVersionResponse' {} Maybe Text
a -> CreateLicenseVersionResponse
s {$sel:licenseArn:CreateLicenseVersionResponse' :: Maybe Text
licenseArn = Maybe Text
a} :: CreateLicenseVersionResponse)

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

instance Prelude.NFData CreateLicenseVersionResponse