{-# 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.SSM.CreateActivation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Generates an activation code and activation ID you can use to register
-- your on-premises servers, edge devices, or virtual machine (VM) with
-- Amazon Web Services Systems Manager. Registering these machines with
-- Systems Manager makes it possible to manage them using Systems Manager
-- capabilities. You use the activation code and ID when installing SSM
-- Agent on machines in your hybrid environment. For more information about
-- requirements for managing on-premises machines using Systems Manager,
-- see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-managedinstances.html Setting up Amazon Web Services Systems Manager for hybrid environments>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- Amazon Elastic Compute Cloud (Amazon EC2) instances, edge devices, and
-- on-premises servers and VMs that are configured for Systems Manager are
-- all called /managed nodes/.
module Amazonka.SSM.CreateActivation
  ( -- * Creating a Request
    CreateActivation (..),
    newCreateActivation,

    -- * Request Lenses
    createActivation_defaultInstanceName,
    createActivation_description,
    createActivation_expirationDate,
    createActivation_registrationLimit,
    createActivation_registrationMetadata,
    createActivation_tags,
    createActivation_iamRole,

    -- * Destructuring the Response
    CreateActivationResponse (..),
    newCreateActivationResponse,

    -- * Response Lenses
    createActivationResponse_activationCode,
    createActivationResponse_activationId,
    createActivationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateActivation' smart constructor.
data CreateActivation = CreateActivation'
  { -- | The name of the registered, managed node as it will appear in the Amazon
    -- Web Services Systems Manager console or when you use the Amazon Web
    -- Services command line tools to list Systems Manager resources.
    --
    -- Don\'t enter personally identifiable information in this field.
    CreateActivation -> Maybe Text
defaultInstanceName :: Prelude.Maybe Prelude.Text,
    -- | A user-defined description of the resource that you want to register
    -- with Systems Manager.
    --
    -- Don\'t enter personally identifiable information in this field.
    CreateActivation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date by which this activation request should expire, in timestamp
    -- format, such as \"2021-07-07T00:00:00\". You can specify a date up to 30
    -- days in advance. If you don\'t provide an expiration date, the
    -- activation code expires in 24 hours.
    CreateActivation -> Maybe POSIX
expirationDate :: Prelude.Maybe Data.POSIX,
    -- | Specify the maximum number of managed nodes you want to register. The
    -- default value is @1@.
    CreateActivation -> Maybe Natural
registrationLimit :: Prelude.Maybe Prelude.Natural,
    -- | Reserved for internal use.
    CreateActivation -> Maybe [RegistrationMetadataItem]
registrationMetadata :: Prelude.Maybe [RegistrationMetadataItem],
    -- | Optional metadata that you assign to a resource. Tags enable you to
    -- categorize a resource in different ways, such as by purpose, owner, or
    -- environment. For example, you might want to tag an activation to
    -- identify which servers or virtual machines (VMs) in your on-premises
    -- environment you intend to activate. In this case, you could specify the
    -- following key-value pairs:
    --
    -- -   @Key=OS,Value=Windows@
    --
    -- -   @Key=Environment,Value=Production@
    --
    -- When you install SSM Agent on your on-premises servers and VMs, you
    -- specify an activation ID and code. When you specify the activation ID
    -- and code, tags assigned to the activation are automatically applied to
    -- the on-premises servers or VMs.
    --
    -- You can\'t add tags to or delete tags from an existing activation. You
    -- can tag your on-premises servers, edge devices, and VMs after they
    -- connect to Systems Manager for the first time and are assigned a managed
    -- node ID. This means they are listed in the Amazon Web Services Systems
    -- Manager console with an ID that is prefixed with \"mi-\". For
    -- information about how to add tags to your managed nodes, see
    -- AddTagsToResource. For information about how to remove tags from your
    -- managed nodes, see RemoveTagsFromResource.
    CreateActivation -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the Identity and Access Management (IAM) role that you want
    -- to assign to the managed node. This IAM role must provide AssumeRole
    -- permissions for the Amazon Web Services Systems Manager service
    -- principal @ssm.amazonaws.com@. For more information, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-service-role.html Create an IAM service role for a hybrid environment>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    --
    -- You can\'t specify an IAM service-linked role for this parameter. You
    -- must create a unique role.
    CreateActivation -> Text
iamRole :: Prelude.Text
  }
  deriving (CreateActivation -> CreateActivation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActivation -> CreateActivation -> Bool
$c/= :: CreateActivation -> CreateActivation -> Bool
== :: CreateActivation -> CreateActivation -> Bool
$c== :: CreateActivation -> CreateActivation -> Bool
Prelude.Eq, ReadPrec [CreateActivation]
ReadPrec CreateActivation
Int -> ReadS CreateActivation
ReadS [CreateActivation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActivation]
$creadListPrec :: ReadPrec [CreateActivation]
readPrec :: ReadPrec CreateActivation
$creadPrec :: ReadPrec CreateActivation
readList :: ReadS [CreateActivation]
$creadList :: ReadS [CreateActivation]
readsPrec :: Int -> ReadS CreateActivation
$creadsPrec :: Int -> ReadS CreateActivation
Prelude.Read, Int -> CreateActivation -> ShowS
[CreateActivation] -> ShowS
CreateActivation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActivation] -> ShowS
$cshowList :: [CreateActivation] -> ShowS
show :: CreateActivation -> String
$cshow :: CreateActivation -> String
showsPrec :: Int -> CreateActivation -> ShowS
$cshowsPrec :: Int -> CreateActivation -> ShowS
Prelude.Show, forall x. Rep CreateActivation x -> CreateActivation
forall x. CreateActivation -> Rep CreateActivation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateActivation x -> CreateActivation
$cfrom :: forall x. CreateActivation -> Rep CreateActivation x
Prelude.Generic)

-- |
-- Create a value of 'CreateActivation' 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:
--
-- 'defaultInstanceName', 'createActivation_defaultInstanceName' - The name of the registered, managed node as it will appear in the Amazon
-- Web Services Systems Manager console or when you use the Amazon Web
-- Services command line tools to list Systems Manager resources.
--
-- Don\'t enter personally identifiable information in this field.
--
-- 'description', 'createActivation_description' - A user-defined description of the resource that you want to register
-- with Systems Manager.
--
-- Don\'t enter personally identifiable information in this field.
--
-- 'expirationDate', 'createActivation_expirationDate' - The date by which this activation request should expire, in timestamp
-- format, such as \"2021-07-07T00:00:00\". You can specify a date up to 30
-- days in advance. If you don\'t provide an expiration date, the
-- activation code expires in 24 hours.
--
-- 'registrationLimit', 'createActivation_registrationLimit' - Specify the maximum number of managed nodes you want to register. The
-- default value is @1@.
--
-- 'registrationMetadata', 'createActivation_registrationMetadata' - Reserved for internal use.
--
-- 'tags', 'createActivation_tags' - Optional metadata that you assign to a resource. Tags enable you to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment. For example, you might want to tag an activation to
-- identify which servers or virtual machines (VMs) in your on-premises
-- environment you intend to activate. In this case, you could specify the
-- following key-value pairs:
--
-- -   @Key=OS,Value=Windows@
--
-- -   @Key=Environment,Value=Production@
--
-- When you install SSM Agent on your on-premises servers and VMs, you
-- specify an activation ID and code. When you specify the activation ID
-- and code, tags assigned to the activation are automatically applied to
-- the on-premises servers or VMs.
--
-- You can\'t add tags to or delete tags from an existing activation. You
-- can tag your on-premises servers, edge devices, and VMs after they
-- connect to Systems Manager for the first time and are assigned a managed
-- node ID. This means they are listed in the Amazon Web Services Systems
-- Manager console with an ID that is prefixed with \"mi-\". For
-- information about how to add tags to your managed nodes, see
-- AddTagsToResource. For information about how to remove tags from your
-- managed nodes, see RemoveTagsFromResource.
--
-- 'iamRole', 'createActivation_iamRole' - The name of the Identity and Access Management (IAM) role that you want
-- to assign to the managed node. This IAM role must provide AssumeRole
-- permissions for the Amazon Web Services Systems Manager service
-- principal @ssm.amazonaws.com@. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-service-role.html Create an IAM service role for a hybrid environment>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- You can\'t specify an IAM service-linked role for this parameter. You
-- must create a unique role.
newCreateActivation ::
  -- | 'iamRole'
  Prelude.Text ->
  CreateActivation
newCreateActivation :: Text -> CreateActivation
newCreateActivation Text
pIamRole_ =
  CreateActivation'
    { $sel:defaultInstanceName:CreateActivation' :: Maybe Text
defaultInstanceName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateActivation' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:expirationDate:CreateActivation' :: Maybe POSIX
expirationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:registrationLimit:CreateActivation' :: Maybe Natural
registrationLimit = forall a. Maybe a
Prelude.Nothing,
      $sel:registrationMetadata:CreateActivation' :: Maybe [RegistrationMetadataItem]
registrationMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateActivation' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:iamRole:CreateActivation' :: Text
iamRole = Text
pIamRole_
    }

-- | The name of the registered, managed node as it will appear in the Amazon
-- Web Services Systems Manager console or when you use the Amazon Web
-- Services command line tools to list Systems Manager resources.
--
-- Don\'t enter personally identifiable information in this field.
createActivation_defaultInstanceName :: Lens.Lens' CreateActivation (Prelude.Maybe Prelude.Text)
createActivation_defaultInstanceName :: Lens' CreateActivation (Maybe Text)
createActivation_defaultInstanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe Text
defaultInstanceName :: Maybe Text
$sel:defaultInstanceName:CreateActivation' :: CreateActivation -> Maybe Text
defaultInstanceName} -> Maybe Text
defaultInstanceName) (\s :: CreateActivation
s@CreateActivation' {} Maybe Text
a -> CreateActivation
s {$sel:defaultInstanceName:CreateActivation' :: Maybe Text
defaultInstanceName = Maybe Text
a} :: CreateActivation)

-- | A user-defined description of the resource that you want to register
-- with Systems Manager.
--
-- Don\'t enter personally identifiable information in this field.
createActivation_description :: Lens.Lens' CreateActivation (Prelude.Maybe Prelude.Text)
createActivation_description :: Lens' CreateActivation (Maybe Text)
createActivation_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe Text
description :: Maybe Text
$sel:description:CreateActivation' :: CreateActivation -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateActivation
s@CreateActivation' {} Maybe Text
a -> CreateActivation
s {$sel:description:CreateActivation' :: Maybe Text
description = Maybe Text
a} :: CreateActivation)

-- | The date by which this activation request should expire, in timestamp
-- format, such as \"2021-07-07T00:00:00\". You can specify a date up to 30
-- days in advance. If you don\'t provide an expiration date, the
-- activation code expires in 24 hours.
createActivation_expirationDate :: Lens.Lens' CreateActivation (Prelude.Maybe Prelude.UTCTime)
createActivation_expirationDate :: Lens' CreateActivation (Maybe UTCTime)
createActivation_expirationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe POSIX
expirationDate :: Maybe POSIX
$sel:expirationDate:CreateActivation' :: CreateActivation -> Maybe POSIX
expirationDate} -> Maybe POSIX
expirationDate) (\s :: CreateActivation
s@CreateActivation' {} Maybe POSIX
a -> CreateActivation
s {$sel:expirationDate:CreateActivation' :: Maybe POSIX
expirationDate = Maybe POSIX
a} :: CreateActivation) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Specify the maximum number of managed nodes you want to register. The
-- default value is @1@.
createActivation_registrationLimit :: Lens.Lens' CreateActivation (Prelude.Maybe Prelude.Natural)
createActivation_registrationLimit :: Lens' CreateActivation (Maybe Natural)
createActivation_registrationLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe Natural
registrationLimit :: Maybe Natural
$sel:registrationLimit:CreateActivation' :: CreateActivation -> Maybe Natural
registrationLimit} -> Maybe Natural
registrationLimit) (\s :: CreateActivation
s@CreateActivation' {} Maybe Natural
a -> CreateActivation
s {$sel:registrationLimit:CreateActivation' :: Maybe Natural
registrationLimit = Maybe Natural
a} :: CreateActivation)

-- | Reserved for internal use.
createActivation_registrationMetadata :: Lens.Lens' CreateActivation (Prelude.Maybe [RegistrationMetadataItem])
createActivation_registrationMetadata :: Lens' CreateActivation (Maybe [RegistrationMetadataItem])
createActivation_registrationMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe [RegistrationMetadataItem]
registrationMetadata :: Maybe [RegistrationMetadataItem]
$sel:registrationMetadata:CreateActivation' :: CreateActivation -> Maybe [RegistrationMetadataItem]
registrationMetadata} -> Maybe [RegistrationMetadataItem]
registrationMetadata) (\s :: CreateActivation
s@CreateActivation' {} Maybe [RegistrationMetadataItem]
a -> CreateActivation
s {$sel:registrationMetadata:CreateActivation' :: Maybe [RegistrationMetadataItem]
registrationMetadata = Maybe [RegistrationMetadataItem]
a} :: CreateActivation) 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

-- | Optional metadata that you assign to a resource. Tags enable you to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment. For example, you might want to tag an activation to
-- identify which servers or virtual machines (VMs) in your on-premises
-- environment you intend to activate. In this case, you could specify the
-- following key-value pairs:
--
-- -   @Key=OS,Value=Windows@
--
-- -   @Key=Environment,Value=Production@
--
-- When you install SSM Agent on your on-premises servers and VMs, you
-- specify an activation ID and code. When you specify the activation ID
-- and code, tags assigned to the activation are automatically applied to
-- the on-premises servers or VMs.
--
-- You can\'t add tags to or delete tags from an existing activation. You
-- can tag your on-premises servers, edge devices, and VMs after they
-- connect to Systems Manager for the first time and are assigned a managed
-- node ID. This means they are listed in the Amazon Web Services Systems
-- Manager console with an ID that is prefixed with \"mi-\". For
-- information about how to add tags to your managed nodes, see
-- AddTagsToResource. For information about how to remove tags from your
-- managed nodes, see RemoveTagsFromResource.
createActivation_tags :: Lens.Lens' CreateActivation (Prelude.Maybe [Tag])
createActivation_tags :: Lens' CreateActivation (Maybe [Tag])
createActivation_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateActivation' :: CreateActivation -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateActivation
s@CreateActivation' {} Maybe [Tag]
a -> CreateActivation
s {$sel:tags:CreateActivation' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateActivation) 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

-- | The name of the Identity and Access Management (IAM) role that you want
-- to assign to the managed node. This IAM role must provide AssumeRole
-- permissions for the Amazon Web Services Systems Manager service
-- principal @ssm.amazonaws.com@. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-service-role.html Create an IAM service role for a hybrid environment>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- You can\'t specify an IAM service-linked role for this parameter. You
-- must create a unique role.
createActivation_iamRole :: Lens.Lens' CreateActivation Prelude.Text
createActivation_iamRole :: Lens' CreateActivation Text
createActivation_iamRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivation' {Text
iamRole :: Text
$sel:iamRole:CreateActivation' :: CreateActivation -> Text
iamRole} -> Text
iamRole) (\s :: CreateActivation
s@CreateActivation' {} Text
a -> CreateActivation
s {$sel:iamRole:CreateActivation' :: Text
iamRole = Text
a} :: CreateActivation)

instance Core.AWSRequest CreateActivation where
  type
    AWSResponse CreateActivation =
      CreateActivationResponse
  request :: (Service -> Service)
-> CreateActivation -> Request CreateActivation
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 CreateActivation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateActivation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> CreateActivationResponse
CreateActivationResponse'
            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
"ActivationCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ActivationId")
            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 CreateActivation where
  hashWithSalt :: Int -> CreateActivation -> Int
hashWithSalt Int
_salt CreateActivation' {Maybe Natural
Maybe [RegistrationMetadataItem]
Maybe [Tag]
Maybe Text
Maybe POSIX
Text
iamRole :: Text
tags :: Maybe [Tag]
registrationMetadata :: Maybe [RegistrationMetadataItem]
registrationLimit :: Maybe Natural
expirationDate :: Maybe POSIX
description :: Maybe Text
defaultInstanceName :: Maybe Text
$sel:iamRole:CreateActivation' :: CreateActivation -> Text
$sel:tags:CreateActivation' :: CreateActivation -> Maybe [Tag]
$sel:registrationMetadata:CreateActivation' :: CreateActivation -> Maybe [RegistrationMetadataItem]
$sel:registrationLimit:CreateActivation' :: CreateActivation -> Maybe Natural
$sel:expirationDate:CreateActivation' :: CreateActivation -> Maybe POSIX
$sel:description:CreateActivation' :: CreateActivation -> Maybe Text
$sel:defaultInstanceName:CreateActivation' :: CreateActivation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultInstanceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
expirationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
registrationLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RegistrationMetadataItem]
registrationMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
iamRole

instance Prelude.NFData CreateActivation where
  rnf :: CreateActivation -> ()
rnf CreateActivation' {Maybe Natural
Maybe [RegistrationMetadataItem]
Maybe [Tag]
Maybe Text
Maybe POSIX
Text
iamRole :: Text
tags :: Maybe [Tag]
registrationMetadata :: Maybe [RegistrationMetadataItem]
registrationLimit :: Maybe Natural
expirationDate :: Maybe POSIX
description :: Maybe Text
defaultInstanceName :: Maybe Text
$sel:iamRole:CreateActivation' :: CreateActivation -> Text
$sel:tags:CreateActivation' :: CreateActivation -> Maybe [Tag]
$sel:registrationMetadata:CreateActivation' :: CreateActivation -> Maybe [RegistrationMetadataItem]
$sel:registrationLimit:CreateActivation' :: CreateActivation -> Maybe Natural
$sel:expirationDate:CreateActivation' :: CreateActivation -> Maybe POSIX
$sel:description:CreateActivation' :: CreateActivation -> Maybe Text
$sel:defaultInstanceName:CreateActivation' :: CreateActivation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultInstanceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 POSIX
expirationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
registrationLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RegistrationMetadataItem]
registrationMetadata
      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
iamRole

instance Data.ToHeaders CreateActivation where
  toHeaders :: CreateActivation -> 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
"AmazonSSM.CreateActivation" :: 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 CreateActivation where
  toJSON :: CreateActivation -> Value
toJSON CreateActivation' {Maybe Natural
Maybe [RegistrationMetadataItem]
Maybe [Tag]
Maybe Text
Maybe POSIX
Text
iamRole :: Text
tags :: Maybe [Tag]
registrationMetadata :: Maybe [RegistrationMetadataItem]
registrationLimit :: Maybe Natural
expirationDate :: Maybe POSIX
description :: Maybe Text
defaultInstanceName :: Maybe Text
$sel:iamRole:CreateActivation' :: CreateActivation -> Text
$sel:tags:CreateActivation' :: CreateActivation -> Maybe [Tag]
$sel:registrationMetadata:CreateActivation' :: CreateActivation -> Maybe [RegistrationMetadataItem]
$sel:registrationLimit:CreateActivation' :: CreateActivation -> Maybe Natural
$sel:expirationDate:CreateActivation' :: CreateActivation -> Maybe POSIX
$sel:description:CreateActivation' :: CreateActivation -> Maybe Text
$sel:defaultInstanceName:CreateActivation' :: CreateActivation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DefaultInstanceName" 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
defaultInstanceName,
            (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
"ExpirationDate" 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 POSIX
expirationDate,
            (Key
"RegistrationLimit" 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 Natural
registrationLimit,
            (Key
"RegistrationMetadata" 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 [RegistrationMetadataItem]
registrationMetadata,
            (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
"IamRole" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
iamRole)
          ]
      )

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

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

-- | /See:/ 'newCreateActivationResponse' smart constructor.
data CreateActivationResponse = CreateActivationResponse'
  { -- | The code the system generates when it processes the activation. The
    -- activation code functions like a password to validate the activation ID.
    CreateActivationResponse -> Maybe Text
activationCode :: Prelude.Maybe Prelude.Text,
    -- | The ID number generated by the system when it processed the activation.
    -- The activation ID functions like a user name.
    CreateActivationResponse -> Maybe Text
activationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateActivationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateActivationResponse -> CreateActivationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActivationResponse -> CreateActivationResponse -> Bool
$c/= :: CreateActivationResponse -> CreateActivationResponse -> Bool
== :: CreateActivationResponse -> CreateActivationResponse -> Bool
$c== :: CreateActivationResponse -> CreateActivationResponse -> Bool
Prelude.Eq, ReadPrec [CreateActivationResponse]
ReadPrec CreateActivationResponse
Int -> ReadS CreateActivationResponse
ReadS [CreateActivationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActivationResponse]
$creadListPrec :: ReadPrec [CreateActivationResponse]
readPrec :: ReadPrec CreateActivationResponse
$creadPrec :: ReadPrec CreateActivationResponse
readList :: ReadS [CreateActivationResponse]
$creadList :: ReadS [CreateActivationResponse]
readsPrec :: Int -> ReadS CreateActivationResponse
$creadsPrec :: Int -> ReadS CreateActivationResponse
Prelude.Read, Int -> CreateActivationResponse -> ShowS
[CreateActivationResponse] -> ShowS
CreateActivationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActivationResponse] -> ShowS
$cshowList :: [CreateActivationResponse] -> ShowS
show :: CreateActivationResponse -> String
$cshow :: CreateActivationResponse -> String
showsPrec :: Int -> CreateActivationResponse -> ShowS
$cshowsPrec :: Int -> CreateActivationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateActivationResponse x -> CreateActivationResponse
forall x.
CreateActivationResponse -> Rep CreateActivationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateActivationResponse x -> CreateActivationResponse
$cfrom :: forall x.
CreateActivationResponse -> Rep CreateActivationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateActivationResponse' 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:
--
-- 'activationCode', 'createActivationResponse_activationCode' - The code the system generates when it processes the activation. The
-- activation code functions like a password to validate the activation ID.
--
-- 'activationId', 'createActivationResponse_activationId' - The ID number generated by the system when it processed the activation.
-- The activation ID functions like a user name.
--
-- 'httpStatus', 'createActivationResponse_httpStatus' - The response's http status code.
newCreateActivationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateActivationResponse
newCreateActivationResponse :: Int -> CreateActivationResponse
newCreateActivationResponse Int
pHttpStatus_ =
  CreateActivationResponse'
    { $sel:activationCode:CreateActivationResponse' :: Maybe Text
activationCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:activationId:CreateActivationResponse' :: Maybe Text
activationId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateActivationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The code the system generates when it processes the activation. The
-- activation code functions like a password to validate the activation ID.
createActivationResponse_activationCode :: Lens.Lens' CreateActivationResponse (Prelude.Maybe Prelude.Text)
createActivationResponse_activationCode :: Lens' CreateActivationResponse (Maybe Text)
createActivationResponse_activationCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivationResponse' {Maybe Text
activationCode :: Maybe Text
$sel:activationCode:CreateActivationResponse' :: CreateActivationResponse -> Maybe Text
activationCode} -> Maybe Text
activationCode) (\s :: CreateActivationResponse
s@CreateActivationResponse' {} Maybe Text
a -> CreateActivationResponse
s {$sel:activationCode:CreateActivationResponse' :: Maybe Text
activationCode = Maybe Text
a} :: CreateActivationResponse)

-- | The ID number generated by the system when it processed the activation.
-- The activation ID functions like a user name.
createActivationResponse_activationId :: Lens.Lens' CreateActivationResponse (Prelude.Maybe Prelude.Text)
createActivationResponse_activationId :: Lens' CreateActivationResponse (Maybe Text)
createActivationResponse_activationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivationResponse' {Maybe Text
activationId :: Maybe Text
$sel:activationId:CreateActivationResponse' :: CreateActivationResponse -> Maybe Text
activationId} -> Maybe Text
activationId) (\s :: CreateActivationResponse
s@CreateActivationResponse' {} Maybe Text
a -> CreateActivationResponse
s {$sel:activationId:CreateActivationResponse' :: Maybe Text
activationId = Maybe Text
a} :: CreateActivationResponse)

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

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