{-# 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.CreateAssociation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- A State Manager association defines the state that you want to maintain
-- on your managed nodes. For example, an association can specify that
-- anti-virus software must be installed and running on your managed nodes,
-- or that certain ports must be closed. For static targets, the
-- association specifies a schedule for when the configuration is
-- reapplied. For dynamic targets, such as an Amazon Web Services resource
-- group or an Amazon Web Services autoscaling group, State Manager, a
-- capability of Amazon Web Services Systems Manager applies the
-- configuration when new managed nodes are added to the group. The
-- association also specifies actions to take when applying the
-- configuration. For example, an association for anti-virus software might
-- run once a day. If the software isn\'t installed, then State Manager
-- installs it. If the software is installed, but the service isn\'t
-- running, then the association might instruct State Manager to start the
-- service.
module Amazonka.SSM.CreateAssociation
  ( -- * Creating a Request
    CreateAssociation (..),
    newCreateAssociation,

    -- * Request Lenses
    createAssociation_alarmConfiguration,
    createAssociation_applyOnlyAtCronInterval,
    createAssociation_associationName,
    createAssociation_automationTargetParameterName,
    createAssociation_calendarNames,
    createAssociation_complianceSeverity,
    createAssociation_documentVersion,
    createAssociation_instanceId,
    createAssociation_maxConcurrency,
    createAssociation_maxErrors,
    createAssociation_outputLocation,
    createAssociation_parameters,
    createAssociation_scheduleExpression,
    createAssociation_scheduleOffset,
    createAssociation_syncCompliance,
    createAssociation_tags,
    createAssociation_targetLocations,
    createAssociation_targetMaps,
    createAssociation_targets,
    createAssociation_name,

    -- * Destructuring the Response
    CreateAssociationResponse (..),
    newCreateAssociationResponse,

    -- * Response Lenses
    createAssociationResponse_associationDescription,
    createAssociationResponse_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:/ 'newCreateAssociation' smart constructor.
data CreateAssociation = CreateAssociation'
  { CreateAssociation -> Maybe AlarmConfiguration
alarmConfiguration :: Prelude.Maybe AlarmConfiguration,
    -- | By default, when you create a new association, the system runs it
    -- immediately after it is created and then according to the schedule you
    -- specified. Specify this option if you don\'t want an association to run
    -- immediately after you create it. This parameter isn\'t supported for
    -- rate expressions.
    CreateAssociation -> Maybe Bool
applyOnlyAtCronInterval :: Prelude.Maybe Prelude.Bool,
    -- | Specify a descriptive name for the association.
    CreateAssociation -> Maybe Text
associationName :: Prelude.Maybe Prelude.Text,
    -- | Choose the parameter that will define how your automation will branch
    -- out. This target is required for associations that use an Automation
    -- runbook and target resources by using rate controls. Automation is a
    -- capability of Amazon Web Services Systems Manager.
    CreateAssociation -> Maybe Text
automationTargetParameterName :: Prelude.Maybe Prelude.Text,
    -- | The names or Amazon Resource Names (ARNs) of the Change Calendar type
    -- documents you want to gate your associations under. The associations
    -- only run when that change calendar is open. For more information, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-change-calendar Amazon Web Services Systems Manager Change Calendar>.
    CreateAssociation -> Maybe [Text]
calendarNames :: Prelude.Maybe [Prelude.Text],
    -- | The severity level to assign to the association.
    CreateAssociation -> Maybe AssociationComplianceSeverity
complianceSeverity :: Prelude.Maybe AssociationComplianceSeverity,
    -- | The document version you want to associate with the target(s). Can be a
    -- specific version or the default version.
    --
    -- State Manager doesn\'t support running associations that use a new
    -- version of a document if that document is shared from another account.
    -- State Manager always runs the @default@ version of a document if shared
    -- from another account, even though the Systems Manager console shows that
    -- a new version was processed. If you want to run an association using a
    -- new version of a document shared form another account, you must set the
    -- document version to @default@.
    CreateAssociation -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | The managed node ID.
    --
    -- @InstanceId@ has been deprecated. To specify a managed node ID for an
    -- association, use the @Targets@ parameter. Requests that include the
    -- parameter @InstanceID@ with Systems Manager documents (SSM documents)
    -- that use schema version 2.0 or later will fail. In addition, if you use
    -- the parameter @InstanceId@, you can\'t use the parameters
    -- @AssociationName@, @DocumentVersion@, @MaxErrors@, @MaxConcurrency@,
    -- @OutputLocation@, or @ScheduleExpression@. To use these parameters, you
    -- must use the @Targets@ parameter.
    CreateAssociation -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of targets allowed to run the association at the same
    -- time. You can specify a number, for example 10, or a percentage of the
    -- target set, for example 10%. The default value is 100%, which means all
    -- targets run the association at the same time.
    --
    -- If a new managed node starts and attempts to run an association while
    -- Systems Manager is running @MaxConcurrency@ associations, the
    -- association is allowed to run. During the next association interval, the
    -- new managed node will process its association within the limit specified
    -- for @MaxConcurrency@.
    CreateAssociation -> Maybe Text
maxConcurrency :: Prelude.Maybe Prelude.Text,
    -- | The number of errors that are allowed before the system stops sending
    -- requests to run the association on additional targets. You can specify
    -- either an absolute number of errors, for example 10, or a percentage of
    -- the target set, for example 10%. If you specify 3, for example, the
    -- system stops sending requests when the fourth error is received. If you
    -- specify 0, then the system stops sending requests after the first error
    -- is returned. If you run an association on 50 managed nodes and set
    -- @MaxError@ to 10%, then the system stops sending the request when the
    -- sixth error is received.
    --
    -- Executions that are already running an association when @MaxErrors@ is
    -- reached are allowed to complete, but some of these executions may fail
    -- as well. If you need to ensure that there won\'t be more than max-errors
    -- failed executions, set @MaxConcurrency@ to 1 so that executions proceed
    -- one at a time.
    CreateAssociation -> Maybe Text
maxErrors :: Prelude.Maybe Prelude.Text,
    -- | An Amazon Simple Storage Service (Amazon S3) bucket where you want to
    -- store the output details of the request.
    CreateAssociation -> Maybe InstanceAssociationOutputLocation
outputLocation :: Prelude.Maybe InstanceAssociationOutputLocation,
    -- | The parameters for the runtime configuration of the document.
    CreateAssociation -> Maybe (Sensitive (HashMap Text [Text]))
parameters :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text [Prelude.Text])),
    -- | A cron expression when the association will be applied to the target(s).
    CreateAssociation -> Maybe Text
scheduleExpression :: Prelude.Maybe Prelude.Text,
    -- | Number of days to wait after the scheduled day to run an association.
    -- For example, if you specified a cron schedule of
    -- @cron(0 0 ? * THU#2 *)@, you could specify an offset of 3 to run the
    -- association each Sunday after the second Thursday of the month. For more
    -- information about cron schedules for associations, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/reference-cron-and-rate-expressions.html Reference: Cron and rate expressions for Systems Manager>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    --
    -- To use offsets, you must specify the @ApplyOnlyAtCronInterval@
    -- parameter. This option tells the system not to run an association
    -- immediately after you create it.
    CreateAssociation -> Maybe Natural
scheduleOffset :: Prelude.Maybe Prelude.Natural,
    -- | The mode for generating association compliance. You can specify @AUTO@
    -- or @MANUAL@. In @AUTO@ mode, the system uses the status of the
    -- association execution to determine the compliance status. If the
    -- association execution runs successfully, then the association is
    -- @COMPLIANT@. If the association execution doesn\'t run successfully, the
    -- association is @NON-COMPLIANT@.
    --
    -- In @MANUAL@ mode, you must specify the @AssociationId@ as a parameter
    -- for the PutComplianceItems API operation. In this case, compliance data
    -- isn\'t managed by State Manager. It is managed by your direct call to
    -- the PutComplianceItems API operation.
    --
    -- By default, all associations use @AUTO@ mode.
    CreateAssociation -> Maybe AssociationSyncCompliance
syncCompliance :: Prelude.Maybe AssociationSyncCompliance,
    -- | Adds or overwrites one or more tags for a State Manager association.
    -- /Tags/ are metadata that you can assign to your Amazon Web Services
    -- resources. Tags enable you to categorize your resources in different
    -- ways, for example, by purpose, owner, or environment. Each tag consists
    -- of a key and an optional value, both of which you define.
    CreateAssociation -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A location is a combination of Amazon Web Services Regions and Amazon
    -- Web Services accounts where you want to run the association. Use this
    -- action to create an association in multiple Regions and multiple
    -- accounts.
    CreateAssociation -> Maybe (NonEmpty TargetLocation)
targetLocations :: Prelude.Maybe (Prelude.NonEmpty TargetLocation),
    -- | A key-value mapping of document parameters to target resources. Both
    -- Targets and TargetMaps can\'t be specified together.
    CreateAssociation -> Maybe [HashMap Text [Text]]
targetMaps :: Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]],
    -- | The targets for the association. You can target managed nodes by using
    -- tags, Amazon Web Services resource groups, all managed nodes in an
    -- Amazon Web Services account, or individual managed node IDs. You can
    -- target all managed nodes in an Amazon Web Services account by specifying
    -- the @InstanceIds@ key with a value of @*@. For more information about
    -- choosing targets for an association, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-state-manager-targets-and-rate-controls.html Using targets and rate controls with State Manager associations>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    CreateAssociation -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | The name of the SSM Command document or Automation runbook that contains
    -- the configuration information for the managed node.
    --
    -- You can specify Amazon Web Services-predefined documents, documents you
    -- created, or a document that is shared with you from another account.
    --
    -- For Systems Manager documents (SSM documents) that are shared with you
    -- from other Amazon Web Services accounts, you must specify the complete
    -- SSM document ARN, in the following format:
    --
    -- @arn:@/@partition@/@:ssm:@/@region@/@:@/@account-id@/@:document\/@/@document-name@/@ @
    --
    -- For example:
    --
    -- @arn:aws:ssm:us-east-2:12345678912:document\/My-Shared-Document@
    --
    -- For Amazon Web Services-predefined documents and SSM documents you
    -- created in your account, you only need to specify the document name. For
    -- example, @AWS-ApplyPatchBaseline@ or @My-Document@.
    CreateAssociation -> Text
name :: Prelude.Text
  }
  deriving (CreateAssociation -> CreateAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssociation -> CreateAssociation -> Bool
$c/= :: CreateAssociation -> CreateAssociation -> Bool
== :: CreateAssociation -> CreateAssociation -> Bool
$c== :: CreateAssociation -> CreateAssociation -> Bool
Prelude.Eq, Int -> CreateAssociation -> ShowS
[CreateAssociation] -> ShowS
CreateAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssociation] -> ShowS
$cshowList :: [CreateAssociation] -> ShowS
show :: CreateAssociation -> String
$cshow :: CreateAssociation -> String
showsPrec :: Int -> CreateAssociation -> ShowS
$cshowsPrec :: Int -> CreateAssociation -> ShowS
Prelude.Show, forall x. Rep CreateAssociation x -> CreateAssociation
forall x. CreateAssociation -> Rep CreateAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAssociation x -> CreateAssociation
$cfrom :: forall x. CreateAssociation -> Rep CreateAssociation x
Prelude.Generic)

-- |
-- Create a value of 'CreateAssociation' 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:
--
-- 'alarmConfiguration', 'createAssociation_alarmConfiguration' - Undocumented member.
--
-- 'applyOnlyAtCronInterval', 'createAssociation_applyOnlyAtCronInterval' - By default, when you create a new association, the system runs it
-- immediately after it is created and then according to the schedule you
-- specified. Specify this option if you don\'t want an association to run
-- immediately after you create it. This parameter isn\'t supported for
-- rate expressions.
--
-- 'associationName', 'createAssociation_associationName' - Specify a descriptive name for the association.
--
-- 'automationTargetParameterName', 'createAssociation_automationTargetParameterName' - Choose the parameter that will define how your automation will branch
-- out. This target is required for associations that use an Automation
-- runbook and target resources by using rate controls. Automation is a
-- capability of Amazon Web Services Systems Manager.
--
-- 'calendarNames', 'createAssociation_calendarNames' - The names or Amazon Resource Names (ARNs) of the Change Calendar type
-- documents you want to gate your associations under. The associations
-- only run when that change calendar is open. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-change-calendar Amazon Web Services Systems Manager Change Calendar>.
--
-- 'complianceSeverity', 'createAssociation_complianceSeverity' - The severity level to assign to the association.
--
-- 'documentVersion', 'createAssociation_documentVersion' - The document version you want to associate with the target(s). Can be a
-- specific version or the default version.
--
-- State Manager doesn\'t support running associations that use a new
-- version of a document if that document is shared from another account.
-- State Manager always runs the @default@ version of a document if shared
-- from another account, even though the Systems Manager console shows that
-- a new version was processed. If you want to run an association using a
-- new version of a document shared form another account, you must set the
-- document version to @default@.
--
-- 'instanceId', 'createAssociation_instanceId' - The managed node ID.
--
-- @InstanceId@ has been deprecated. To specify a managed node ID for an
-- association, use the @Targets@ parameter. Requests that include the
-- parameter @InstanceID@ with Systems Manager documents (SSM documents)
-- that use schema version 2.0 or later will fail. In addition, if you use
-- the parameter @InstanceId@, you can\'t use the parameters
-- @AssociationName@, @DocumentVersion@, @MaxErrors@, @MaxConcurrency@,
-- @OutputLocation@, or @ScheduleExpression@. To use these parameters, you
-- must use the @Targets@ parameter.
--
-- 'maxConcurrency', 'createAssociation_maxConcurrency' - The maximum number of targets allowed to run the association at the same
-- time. You can specify a number, for example 10, or a percentage of the
-- target set, for example 10%. The default value is 100%, which means all
-- targets run the association at the same time.
--
-- If a new managed node starts and attempts to run an association while
-- Systems Manager is running @MaxConcurrency@ associations, the
-- association is allowed to run. During the next association interval, the
-- new managed node will process its association within the limit specified
-- for @MaxConcurrency@.
--
-- 'maxErrors', 'createAssociation_maxErrors' - The number of errors that are allowed before the system stops sending
-- requests to run the association on additional targets. You can specify
-- either an absolute number of errors, for example 10, or a percentage of
-- the target set, for example 10%. If you specify 3, for example, the
-- system stops sending requests when the fourth error is received. If you
-- specify 0, then the system stops sending requests after the first error
-- is returned. If you run an association on 50 managed nodes and set
-- @MaxError@ to 10%, then the system stops sending the request when the
-- sixth error is received.
--
-- Executions that are already running an association when @MaxErrors@ is
-- reached are allowed to complete, but some of these executions may fail
-- as well. If you need to ensure that there won\'t be more than max-errors
-- failed executions, set @MaxConcurrency@ to 1 so that executions proceed
-- one at a time.
--
-- 'outputLocation', 'createAssociation_outputLocation' - An Amazon Simple Storage Service (Amazon S3) bucket where you want to
-- store the output details of the request.
--
-- 'parameters', 'createAssociation_parameters' - The parameters for the runtime configuration of the document.
--
-- 'scheduleExpression', 'createAssociation_scheduleExpression' - A cron expression when the association will be applied to the target(s).
--
-- 'scheduleOffset', 'createAssociation_scheduleOffset' - Number of days to wait after the scheduled day to run an association.
-- For example, if you specified a cron schedule of
-- @cron(0 0 ? * THU#2 *)@, you could specify an offset of 3 to run the
-- association each Sunday after the second Thursday of the month. For more
-- information about cron schedules for associations, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/reference-cron-and-rate-expressions.html Reference: Cron and rate expressions for Systems Manager>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- To use offsets, you must specify the @ApplyOnlyAtCronInterval@
-- parameter. This option tells the system not to run an association
-- immediately after you create it.
--
-- 'syncCompliance', 'createAssociation_syncCompliance' - The mode for generating association compliance. You can specify @AUTO@
-- or @MANUAL@. In @AUTO@ mode, the system uses the status of the
-- association execution to determine the compliance status. If the
-- association execution runs successfully, then the association is
-- @COMPLIANT@. If the association execution doesn\'t run successfully, the
-- association is @NON-COMPLIANT@.
--
-- In @MANUAL@ mode, you must specify the @AssociationId@ as a parameter
-- for the PutComplianceItems API operation. In this case, compliance data
-- isn\'t managed by State Manager. It is managed by your direct call to
-- the PutComplianceItems API operation.
--
-- By default, all associations use @AUTO@ mode.
--
-- 'tags', 'createAssociation_tags' - Adds or overwrites one or more tags for a State Manager association.
-- /Tags/ are metadata that you can assign to your Amazon Web Services
-- resources. Tags enable you to categorize your resources in different
-- ways, for example, by purpose, owner, or environment. Each tag consists
-- of a key and an optional value, both of which you define.
--
-- 'targetLocations', 'createAssociation_targetLocations' - A location is a combination of Amazon Web Services Regions and Amazon
-- Web Services accounts where you want to run the association. Use this
-- action to create an association in multiple Regions and multiple
-- accounts.
--
-- 'targetMaps', 'createAssociation_targetMaps' - A key-value mapping of document parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
--
-- 'targets', 'createAssociation_targets' - The targets for the association. You can target managed nodes by using
-- tags, Amazon Web Services resource groups, all managed nodes in an
-- Amazon Web Services account, or individual managed node IDs. You can
-- target all managed nodes in an Amazon Web Services account by specifying
-- the @InstanceIds@ key with a value of @*@. For more information about
-- choosing targets for an association, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-state-manager-targets-and-rate-controls.html Using targets and rate controls with State Manager associations>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'name', 'createAssociation_name' - The name of the SSM Command document or Automation runbook that contains
-- the configuration information for the managed node.
--
-- You can specify Amazon Web Services-predefined documents, documents you
-- created, or a document that is shared with you from another account.
--
-- For Systems Manager documents (SSM documents) that are shared with you
-- from other Amazon Web Services accounts, you must specify the complete
-- SSM document ARN, in the following format:
--
-- @arn:@/@partition@/@:ssm:@/@region@/@:@/@account-id@/@:document\/@/@document-name@/@ @
--
-- For example:
--
-- @arn:aws:ssm:us-east-2:12345678912:document\/My-Shared-Document@
--
-- For Amazon Web Services-predefined documents and SSM documents you
-- created in your account, you only need to specify the document name. For
-- example, @AWS-ApplyPatchBaseline@ or @My-Document@.
newCreateAssociation ::
  -- | 'name'
  Prelude.Text ->
  CreateAssociation
newCreateAssociation :: Text -> CreateAssociation
newCreateAssociation Text
pName_ =
  CreateAssociation'
    { $sel:alarmConfiguration:CreateAssociation' :: Maybe AlarmConfiguration
alarmConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:applyOnlyAtCronInterval:CreateAssociation' :: Maybe Bool
applyOnlyAtCronInterval = forall a. Maybe a
Prelude.Nothing,
      $sel:associationName:CreateAssociation' :: Maybe Text
associationName = forall a. Maybe a
Prelude.Nothing,
      $sel:automationTargetParameterName:CreateAssociation' :: Maybe Text
automationTargetParameterName = forall a. Maybe a
Prelude.Nothing,
      $sel:calendarNames:CreateAssociation' :: Maybe [Text]
calendarNames = forall a. Maybe a
Prelude.Nothing,
      $sel:complianceSeverity:CreateAssociation' :: Maybe AssociationComplianceSeverity
complianceSeverity = forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:CreateAssociation' :: Maybe Text
documentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:CreateAssociation' :: Maybe Text
instanceId = forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrency:CreateAssociation' :: Maybe Text
maxConcurrency = forall a. Maybe a
Prelude.Nothing,
      $sel:maxErrors:CreateAssociation' :: Maybe Text
maxErrors = forall a. Maybe a
Prelude.Nothing,
      $sel:outputLocation:CreateAssociation' :: Maybe InstanceAssociationOutputLocation
outputLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:CreateAssociation' :: Maybe (Sensitive (HashMap Text [Text]))
parameters = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleExpression:CreateAssociation' :: Maybe Text
scheduleExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleOffset:CreateAssociation' :: Maybe Natural
scheduleOffset = forall a. Maybe a
Prelude.Nothing,
      $sel:syncCompliance:CreateAssociation' :: Maybe AssociationSyncCompliance
syncCompliance = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateAssociation' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:targetLocations:CreateAssociation' :: Maybe (NonEmpty TargetLocation)
targetLocations = forall a. Maybe a
Prelude.Nothing,
      $sel:targetMaps:CreateAssociation' :: Maybe [HashMap Text [Text]]
targetMaps = forall a. Maybe a
Prelude.Nothing,
      $sel:targets:CreateAssociation' :: Maybe [Target]
targets = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateAssociation' :: Text
name = Text
pName_
    }

-- | Undocumented member.
createAssociation_alarmConfiguration :: Lens.Lens' CreateAssociation (Prelude.Maybe AlarmConfiguration)
createAssociation_alarmConfiguration :: Lens' CreateAssociation (Maybe AlarmConfiguration)
createAssociation_alarmConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe AlarmConfiguration
alarmConfiguration :: Maybe AlarmConfiguration
$sel:alarmConfiguration:CreateAssociation' :: CreateAssociation -> Maybe AlarmConfiguration
alarmConfiguration} -> Maybe AlarmConfiguration
alarmConfiguration) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe AlarmConfiguration
a -> CreateAssociation
s {$sel:alarmConfiguration:CreateAssociation' :: Maybe AlarmConfiguration
alarmConfiguration = Maybe AlarmConfiguration
a} :: CreateAssociation)

-- | By default, when you create a new association, the system runs it
-- immediately after it is created and then according to the schedule you
-- specified. Specify this option if you don\'t want an association to run
-- immediately after you create it. This parameter isn\'t supported for
-- rate expressions.
createAssociation_applyOnlyAtCronInterval :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Bool)
createAssociation_applyOnlyAtCronInterval :: Lens' CreateAssociation (Maybe Bool)
createAssociation_applyOnlyAtCronInterval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Bool
applyOnlyAtCronInterval :: Maybe Bool
$sel:applyOnlyAtCronInterval:CreateAssociation' :: CreateAssociation -> Maybe Bool
applyOnlyAtCronInterval} -> Maybe Bool
applyOnlyAtCronInterval) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Bool
a -> CreateAssociation
s {$sel:applyOnlyAtCronInterval:CreateAssociation' :: Maybe Bool
applyOnlyAtCronInterval = Maybe Bool
a} :: CreateAssociation)

-- | Specify a descriptive name for the association.
createAssociation_associationName :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_associationName :: Lens' CreateAssociation (Maybe Text)
createAssociation_associationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
associationName :: Maybe Text
$sel:associationName:CreateAssociation' :: CreateAssociation -> Maybe Text
associationName} -> Maybe Text
associationName) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:associationName:CreateAssociation' :: Maybe Text
associationName = Maybe Text
a} :: CreateAssociation)

-- | Choose the parameter that will define how your automation will branch
-- out. This target is required for associations that use an Automation
-- runbook and target resources by using rate controls. Automation is a
-- capability of Amazon Web Services Systems Manager.
createAssociation_automationTargetParameterName :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_automationTargetParameterName :: Lens' CreateAssociation (Maybe Text)
createAssociation_automationTargetParameterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
automationTargetParameterName :: Maybe Text
$sel:automationTargetParameterName:CreateAssociation' :: CreateAssociation -> Maybe Text
automationTargetParameterName} -> Maybe Text
automationTargetParameterName) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:automationTargetParameterName:CreateAssociation' :: Maybe Text
automationTargetParameterName = Maybe Text
a} :: CreateAssociation)

-- | The names or Amazon Resource Names (ARNs) of the Change Calendar type
-- documents you want to gate your associations under. The associations
-- only run when that change calendar is open. For more information, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-change-calendar Amazon Web Services Systems Manager Change Calendar>.
createAssociation_calendarNames :: Lens.Lens' CreateAssociation (Prelude.Maybe [Prelude.Text])
createAssociation_calendarNames :: Lens' CreateAssociation (Maybe [Text])
createAssociation_calendarNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe [Text]
calendarNames :: Maybe [Text]
$sel:calendarNames:CreateAssociation' :: CreateAssociation -> Maybe [Text]
calendarNames} -> Maybe [Text]
calendarNames) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe [Text]
a -> CreateAssociation
s {$sel:calendarNames:CreateAssociation' :: Maybe [Text]
calendarNames = Maybe [Text]
a} :: CreateAssociation) 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 severity level to assign to the association.
createAssociation_complianceSeverity :: Lens.Lens' CreateAssociation (Prelude.Maybe AssociationComplianceSeverity)
createAssociation_complianceSeverity :: Lens' CreateAssociation (Maybe AssociationComplianceSeverity)
createAssociation_complianceSeverity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe AssociationComplianceSeverity
complianceSeverity :: Maybe AssociationComplianceSeverity
$sel:complianceSeverity:CreateAssociation' :: CreateAssociation -> Maybe AssociationComplianceSeverity
complianceSeverity} -> Maybe AssociationComplianceSeverity
complianceSeverity) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe AssociationComplianceSeverity
a -> CreateAssociation
s {$sel:complianceSeverity:CreateAssociation' :: Maybe AssociationComplianceSeverity
complianceSeverity = Maybe AssociationComplianceSeverity
a} :: CreateAssociation)

-- | The document version you want to associate with the target(s). Can be a
-- specific version or the default version.
--
-- State Manager doesn\'t support running associations that use a new
-- version of a document if that document is shared from another account.
-- State Manager always runs the @default@ version of a document if shared
-- from another account, even though the Systems Manager console shows that
-- a new version was processed. If you want to run an association using a
-- new version of a document shared form another account, you must set the
-- document version to @default@.
createAssociation_documentVersion :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_documentVersion :: Lens' CreateAssociation (Maybe Text)
createAssociation_documentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:CreateAssociation' :: CreateAssociation -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:documentVersion:CreateAssociation' :: Maybe Text
documentVersion = Maybe Text
a} :: CreateAssociation)

-- | The managed node ID.
--
-- @InstanceId@ has been deprecated. To specify a managed node ID for an
-- association, use the @Targets@ parameter. Requests that include the
-- parameter @InstanceID@ with Systems Manager documents (SSM documents)
-- that use schema version 2.0 or later will fail. In addition, if you use
-- the parameter @InstanceId@, you can\'t use the parameters
-- @AssociationName@, @DocumentVersion@, @MaxErrors@, @MaxConcurrency@,
-- @OutputLocation@, or @ScheduleExpression@. To use these parameters, you
-- must use the @Targets@ parameter.
createAssociation_instanceId :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_instanceId :: Lens' CreateAssociation (Maybe Text)
createAssociation_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:CreateAssociation' :: CreateAssociation -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:instanceId:CreateAssociation' :: Maybe Text
instanceId = Maybe Text
a} :: CreateAssociation)

-- | The maximum number of targets allowed to run the association at the same
-- time. You can specify a number, for example 10, or a percentage of the
-- target set, for example 10%. The default value is 100%, which means all
-- targets run the association at the same time.
--
-- If a new managed node starts and attempts to run an association while
-- Systems Manager is running @MaxConcurrency@ associations, the
-- association is allowed to run. During the next association interval, the
-- new managed node will process its association within the limit specified
-- for @MaxConcurrency@.
createAssociation_maxConcurrency :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_maxConcurrency :: Lens' CreateAssociation (Maybe Text)
createAssociation_maxConcurrency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
maxConcurrency :: Maybe Text
$sel:maxConcurrency:CreateAssociation' :: CreateAssociation -> Maybe Text
maxConcurrency} -> Maybe Text
maxConcurrency) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:maxConcurrency:CreateAssociation' :: Maybe Text
maxConcurrency = Maybe Text
a} :: CreateAssociation)

-- | The number of errors that are allowed before the system stops sending
-- requests to run the association on additional targets. You can specify
-- either an absolute number of errors, for example 10, or a percentage of
-- the target set, for example 10%. If you specify 3, for example, the
-- system stops sending requests when the fourth error is received. If you
-- specify 0, then the system stops sending requests after the first error
-- is returned. If you run an association on 50 managed nodes and set
-- @MaxError@ to 10%, then the system stops sending the request when the
-- sixth error is received.
--
-- Executions that are already running an association when @MaxErrors@ is
-- reached are allowed to complete, but some of these executions may fail
-- as well. If you need to ensure that there won\'t be more than max-errors
-- failed executions, set @MaxConcurrency@ to 1 so that executions proceed
-- one at a time.
createAssociation_maxErrors :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_maxErrors :: Lens' CreateAssociation (Maybe Text)
createAssociation_maxErrors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
maxErrors :: Maybe Text
$sel:maxErrors:CreateAssociation' :: CreateAssociation -> Maybe Text
maxErrors} -> Maybe Text
maxErrors) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:maxErrors:CreateAssociation' :: Maybe Text
maxErrors = Maybe Text
a} :: CreateAssociation)

-- | An Amazon Simple Storage Service (Amazon S3) bucket where you want to
-- store the output details of the request.
createAssociation_outputLocation :: Lens.Lens' CreateAssociation (Prelude.Maybe InstanceAssociationOutputLocation)
createAssociation_outputLocation :: Lens' CreateAssociation (Maybe InstanceAssociationOutputLocation)
createAssociation_outputLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe InstanceAssociationOutputLocation
outputLocation :: Maybe InstanceAssociationOutputLocation
$sel:outputLocation:CreateAssociation' :: CreateAssociation -> Maybe InstanceAssociationOutputLocation
outputLocation} -> Maybe InstanceAssociationOutputLocation
outputLocation) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe InstanceAssociationOutputLocation
a -> CreateAssociation
s {$sel:outputLocation:CreateAssociation' :: Maybe InstanceAssociationOutputLocation
outputLocation = Maybe InstanceAssociationOutputLocation
a} :: CreateAssociation)

-- | The parameters for the runtime configuration of the document.
createAssociation_parameters :: Lens.Lens' CreateAssociation (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
createAssociation_parameters :: Lens' CreateAssociation (Maybe (HashMap Text [Text]))
createAssociation_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe (Sensitive (HashMap Text [Text]))
parameters :: Maybe (Sensitive (HashMap Text [Text]))
$sel:parameters:CreateAssociation' :: CreateAssociation -> Maybe (Sensitive (HashMap Text [Text]))
parameters} -> Maybe (Sensitive (HashMap Text [Text]))
parameters) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe (Sensitive (HashMap Text [Text]))
a -> CreateAssociation
s {$sel:parameters:CreateAssociation' :: Maybe (Sensitive (HashMap Text [Text]))
parameters = Maybe (Sensitive (HashMap Text [Text]))
a} :: CreateAssociation) 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. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

-- | A cron expression when the association will be applied to the target(s).
createAssociation_scheduleExpression :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Text)
createAssociation_scheduleExpression :: Lens' CreateAssociation (Maybe Text)
createAssociation_scheduleExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Text
scheduleExpression :: Maybe Text
$sel:scheduleExpression:CreateAssociation' :: CreateAssociation -> Maybe Text
scheduleExpression} -> Maybe Text
scheduleExpression) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Text
a -> CreateAssociation
s {$sel:scheduleExpression:CreateAssociation' :: Maybe Text
scheduleExpression = Maybe Text
a} :: CreateAssociation)

-- | Number of days to wait after the scheduled day to run an association.
-- For example, if you specified a cron schedule of
-- @cron(0 0 ? * THU#2 *)@, you could specify an offset of 3 to run the
-- association each Sunday after the second Thursday of the month. For more
-- information about cron schedules for associations, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/reference-cron-and-rate-expressions.html Reference: Cron and rate expressions for Systems Manager>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- To use offsets, you must specify the @ApplyOnlyAtCronInterval@
-- parameter. This option tells the system not to run an association
-- immediately after you create it.
createAssociation_scheduleOffset :: Lens.Lens' CreateAssociation (Prelude.Maybe Prelude.Natural)
createAssociation_scheduleOffset :: Lens' CreateAssociation (Maybe Natural)
createAssociation_scheduleOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe Natural
scheduleOffset :: Maybe Natural
$sel:scheduleOffset:CreateAssociation' :: CreateAssociation -> Maybe Natural
scheduleOffset} -> Maybe Natural
scheduleOffset) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe Natural
a -> CreateAssociation
s {$sel:scheduleOffset:CreateAssociation' :: Maybe Natural
scheduleOffset = Maybe Natural
a} :: CreateAssociation)

-- | The mode for generating association compliance. You can specify @AUTO@
-- or @MANUAL@. In @AUTO@ mode, the system uses the status of the
-- association execution to determine the compliance status. If the
-- association execution runs successfully, then the association is
-- @COMPLIANT@. If the association execution doesn\'t run successfully, the
-- association is @NON-COMPLIANT@.
--
-- In @MANUAL@ mode, you must specify the @AssociationId@ as a parameter
-- for the PutComplianceItems API operation. In this case, compliance data
-- isn\'t managed by State Manager. It is managed by your direct call to
-- the PutComplianceItems API operation.
--
-- By default, all associations use @AUTO@ mode.
createAssociation_syncCompliance :: Lens.Lens' CreateAssociation (Prelude.Maybe AssociationSyncCompliance)
createAssociation_syncCompliance :: Lens' CreateAssociation (Maybe AssociationSyncCompliance)
createAssociation_syncCompliance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe AssociationSyncCompliance
syncCompliance :: Maybe AssociationSyncCompliance
$sel:syncCompliance:CreateAssociation' :: CreateAssociation -> Maybe AssociationSyncCompliance
syncCompliance} -> Maybe AssociationSyncCompliance
syncCompliance) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe AssociationSyncCompliance
a -> CreateAssociation
s {$sel:syncCompliance:CreateAssociation' :: Maybe AssociationSyncCompliance
syncCompliance = Maybe AssociationSyncCompliance
a} :: CreateAssociation)

-- | Adds or overwrites one or more tags for a State Manager association.
-- /Tags/ are metadata that you can assign to your Amazon Web Services
-- resources. Tags enable you to categorize your resources in different
-- ways, for example, by purpose, owner, or environment. Each tag consists
-- of a key and an optional value, both of which you define.
createAssociation_tags :: Lens.Lens' CreateAssociation (Prelude.Maybe [Tag])
createAssociation_tags :: Lens' CreateAssociation (Maybe [Tag])
createAssociation_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAssociation' :: CreateAssociation -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe [Tag]
a -> CreateAssociation
s {$sel:tags:CreateAssociation' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAssociation) 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

-- | A location is a combination of Amazon Web Services Regions and Amazon
-- Web Services accounts where you want to run the association. Use this
-- action to create an association in multiple Regions and multiple
-- accounts.
createAssociation_targetLocations :: Lens.Lens' CreateAssociation (Prelude.Maybe (Prelude.NonEmpty TargetLocation))
createAssociation_targetLocations :: Lens' CreateAssociation (Maybe (NonEmpty TargetLocation))
createAssociation_targetLocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe (NonEmpty TargetLocation)
targetLocations :: Maybe (NonEmpty TargetLocation)
$sel:targetLocations:CreateAssociation' :: CreateAssociation -> Maybe (NonEmpty TargetLocation)
targetLocations} -> Maybe (NonEmpty TargetLocation)
targetLocations) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe (NonEmpty TargetLocation)
a -> CreateAssociation
s {$sel:targetLocations:CreateAssociation' :: Maybe (NonEmpty TargetLocation)
targetLocations = Maybe (NonEmpty TargetLocation)
a} :: CreateAssociation) 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

-- | A key-value mapping of document parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
createAssociation_targetMaps :: Lens.Lens' CreateAssociation (Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]])
createAssociation_targetMaps :: Lens' CreateAssociation (Maybe [HashMap Text [Text]])
createAssociation_targetMaps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe [HashMap Text [Text]]
targetMaps :: Maybe [HashMap Text [Text]]
$sel:targetMaps:CreateAssociation' :: CreateAssociation -> Maybe [HashMap Text [Text]]
targetMaps} -> Maybe [HashMap Text [Text]]
targetMaps) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe [HashMap Text [Text]]
a -> CreateAssociation
s {$sel:targetMaps:CreateAssociation' :: Maybe [HashMap Text [Text]]
targetMaps = Maybe [HashMap Text [Text]]
a} :: CreateAssociation) 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 targets for the association. You can target managed nodes by using
-- tags, Amazon Web Services resource groups, all managed nodes in an
-- Amazon Web Services account, or individual managed node IDs. You can
-- target all managed nodes in an Amazon Web Services account by specifying
-- the @InstanceIds@ key with a value of @*@. For more information about
-- choosing targets for an association, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-state-manager-targets-and-rate-controls.html Using targets and rate controls with State Manager associations>
-- in the /Amazon Web Services Systems Manager User Guide/.
createAssociation_targets :: Lens.Lens' CreateAssociation (Prelude.Maybe [Target])
createAssociation_targets :: Lens' CreateAssociation (Maybe [Target])
createAssociation_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:CreateAssociation' :: CreateAssociation -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: CreateAssociation
s@CreateAssociation' {} Maybe [Target]
a -> CreateAssociation
s {$sel:targets:CreateAssociation' :: Maybe [Target]
targets = Maybe [Target]
a} :: CreateAssociation) 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 SSM Command document or Automation runbook that contains
-- the configuration information for the managed node.
--
-- You can specify Amazon Web Services-predefined documents, documents you
-- created, or a document that is shared with you from another account.
--
-- For Systems Manager documents (SSM documents) that are shared with you
-- from other Amazon Web Services accounts, you must specify the complete
-- SSM document ARN, in the following format:
--
-- @arn:@/@partition@/@:ssm:@/@region@/@:@/@account-id@/@:document\/@/@document-name@/@ @
--
-- For example:
--
-- @arn:aws:ssm:us-east-2:12345678912:document\/My-Shared-Document@
--
-- For Amazon Web Services-predefined documents and SSM documents you
-- created in your account, you only need to specify the document name. For
-- example, @AWS-ApplyPatchBaseline@ or @My-Document@.
createAssociation_name :: Lens.Lens' CreateAssociation Prelude.Text
createAssociation_name :: Lens' CreateAssociation Text
createAssociation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociation' {Text
name :: Text
$sel:name:CreateAssociation' :: CreateAssociation -> Text
name} -> Text
name) (\s :: CreateAssociation
s@CreateAssociation' {} Text
a -> CreateAssociation
s {$sel:name:CreateAssociation' :: Text
name = Text
a} :: CreateAssociation)

instance Core.AWSRequest CreateAssociation where
  type
    AWSResponse CreateAssociation =
      CreateAssociationResponse
  request :: (Service -> Service)
-> CreateAssociation -> Request CreateAssociation
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 CreateAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAssociation)))
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 AssociationDescription -> Int -> CreateAssociationResponse
CreateAssociationResponse'
            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
"AssociationDescription")
            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 CreateAssociation where
  hashWithSalt :: Int -> CreateAssociation -> Int
hashWithSalt Int
_salt CreateAssociation' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [HashMap Text [Text]]
Maybe [Tag]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (Sensitive (HashMap Text [Text]))
Maybe AlarmConfiguration
Maybe AssociationComplianceSeverity
Maybe AssociationSyncCompliance
Maybe InstanceAssociationOutputLocation
Text
name :: Text
targets :: Maybe [Target]
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
tags :: Maybe [Tag]
syncCompliance :: Maybe AssociationSyncCompliance
scheduleOffset :: Maybe Natural
scheduleExpression :: Maybe Text
parameters :: Maybe (Sensitive (HashMap Text [Text]))
outputLocation :: Maybe InstanceAssociationOutputLocation
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
instanceId :: Maybe Text
documentVersion :: Maybe Text
complianceSeverity :: Maybe AssociationComplianceSeverity
calendarNames :: Maybe [Text]
automationTargetParameterName :: Maybe Text
associationName :: Maybe Text
applyOnlyAtCronInterval :: Maybe Bool
alarmConfiguration :: Maybe AlarmConfiguration
$sel:name:CreateAssociation' :: CreateAssociation -> Text
$sel:targets:CreateAssociation' :: CreateAssociation -> Maybe [Target]
$sel:targetMaps:CreateAssociation' :: CreateAssociation -> Maybe [HashMap Text [Text]]
$sel:targetLocations:CreateAssociation' :: CreateAssociation -> Maybe (NonEmpty TargetLocation)
$sel:tags:CreateAssociation' :: CreateAssociation -> Maybe [Tag]
$sel:syncCompliance:CreateAssociation' :: CreateAssociation -> Maybe AssociationSyncCompliance
$sel:scheduleOffset:CreateAssociation' :: CreateAssociation -> Maybe Natural
$sel:scheduleExpression:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:parameters:CreateAssociation' :: CreateAssociation -> Maybe (Sensitive (HashMap Text [Text]))
$sel:outputLocation:CreateAssociation' :: CreateAssociation -> Maybe InstanceAssociationOutputLocation
$sel:maxErrors:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:maxConcurrency:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:instanceId:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:documentVersion:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:complianceSeverity:CreateAssociation' :: CreateAssociation -> Maybe AssociationComplianceSeverity
$sel:calendarNames:CreateAssociation' :: CreateAssociation -> Maybe [Text]
$sel:automationTargetParameterName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:associationName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:applyOnlyAtCronInterval:CreateAssociation' :: CreateAssociation -> Maybe Bool
$sel:alarmConfiguration:CreateAssociation' :: CreateAssociation -> Maybe AlarmConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AlarmConfiguration
alarmConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
applyOnlyAtCronInterval
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
associationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
automationTargetParameterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
calendarNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationComplianceSeverity
complianceSeverity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxConcurrency
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxErrors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceAssociationOutputLocation
outputLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text [Text]))
parameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
scheduleOffset
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationSyncCompliance
syncCompliance
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty TargetLocation)
targetLocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HashMap Text [Text]]
targetMaps
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Target]
targets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateAssociation where
  rnf :: CreateAssociation -> ()
rnf CreateAssociation' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [HashMap Text [Text]]
Maybe [Tag]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (Sensitive (HashMap Text [Text]))
Maybe AlarmConfiguration
Maybe AssociationComplianceSeverity
Maybe AssociationSyncCompliance
Maybe InstanceAssociationOutputLocation
Text
name :: Text
targets :: Maybe [Target]
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
tags :: Maybe [Tag]
syncCompliance :: Maybe AssociationSyncCompliance
scheduleOffset :: Maybe Natural
scheduleExpression :: Maybe Text
parameters :: Maybe (Sensitive (HashMap Text [Text]))
outputLocation :: Maybe InstanceAssociationOutputLocation
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
instanceId :: Maybe Text
documentVersion :: Maybe Text
complianceSeverity :: Maybe AssociationComplianceSeverity
calendarNames :: Maybe [Text]
automationTargetParameterName :: Maybe Text
associationName :: Maybe Text
applyOnlyAtCronInterval :: Maybe Bool
alarmConfiguration :: Maybe AlarmConfiguration
$sel:name:CreateAssociation' :: CreateAssociation -> Text
$sel:targets:CreateAssociation' :: CreateAssociation -> Maybe [Target]
$sel:targetMaps:CreateAssociation' :: CreateAssociation -> Maybe [HashMap Text [Text]]
$sel:targetLocations:CreateAssociation' :: CreateAssociation -> Maybe (NonEmpty TargetLocation)
$sel:tags:CreateAssociation' :: CreateAssociation -> Maybe [Tag]
$sel:syncCompliance:CreateAssociation' :: CreateAssociation -> Maybe AssociationSyncCompliance
$sel:scheduleOffset:CreateAssociation' :: CreateAssociation -> Maybe Natural
$sel:scheduleExpression:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:parameters:CreateAssociation' :: CreateAssociation -> Maybe (Sensitive (HashMap Text [Text]))
$sel:outputLocation:CreateAssociation' :: CreateAssociation -> Maybe InstanceAssociationOutputLocation
$sel:maxErrors:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:maxConcurrency:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:instanceId:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:documentVersion:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:complianceSeverity:CreateAssociation' :: CreateAssociation -> Maybe AssociationComplianceSeverity
$sel:calendarNames:CreateAssociation' :: CreateAssociation -> Maybe [Text]
$sel:automationTargetParameterName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:associationName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:applyOnlyAtCronInterval:CreateAssociation' :: CreateAssociation -> Maybe Bool
$sel:alarmConfiguration:CreateAssociation' :: CreateAssociation -> Maybe AlarmConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AlarmConfiguration
alarmConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
applyOnlyAtCronInterval
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
automationTargetParameterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
calendarNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationComplianceSeverity
complianceSeverity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxConcurrency
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxErrors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceAssociationOutputLocation
outputLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text [Text]))
parameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
scheduleOffset
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationSyncCompliance
syncCompliance
      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 Maybe (NonEmpty TargetLocation)
targetLocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HashMap Text [Text]]
targetMaps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Target]
targets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders CreateAssociation where
  toHeaders :: CreateAssociation -> 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.CreateAssociation" ::
                          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 CreateAssociation where
  toJSON :: CreateAssociation -> Value
toJSON CreateAssociation' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [HashMap Text [Text]]
Maybe [Tag]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (Sensitive (HashMap Text [Text]))
Maybe AlarmConfiguration
Maybe AssociationComplianceSeverity
Maybe AssociationSyncCompliance
Maybe InstanceAssociationOutputLocation
Text
name :: Text
targets :: Maybe [Target]
targetMaps :: Maybe [HashMap Text [Text]]
targetLocations :: Maybe (NonEmpty TargetLocation)
tags :: Maybe [Tag]
syncCompliance :: Maybe AssociationSyncCompliance
scheduleOffset :: Maybe Natural
scheduleExpression :: Maybe Text
parameters :: Maybe (Sensitive (HashMap Text [Text]))
outputLocation :: Maybe InstanceAssociationOutputLocation
maxErrors :: Maybe Text
maxConcurrency :: Maybe Text
instanceId :: Maybe Text
documentVersion :: Maybe Text
complianceSeverity :: Maybe AssociationComplianceSeverity
calendarNames :: Maybe [Text]
automationTargetParameterName :: Maybe Text
associationName :: Maybe Text
applyOnlyAtCronInterval :: Maybe Bool
alarmConfiguration :: Maybe AlarmConfiguration
$sel:name:CreateAssociation' :: CreateAssociation -> Text
$sel:targets:CreateAssociation' :: CreateAssociation -> Maybe [Target]
$sel:targetMaps:CreateAssociation' :: CreateAssociation -> Maybe [HashMap Text [Text]]
$sel:targetLocations:CreateAssociation' :: CreateAssociation -> Maybe (NonEmpty TargetLocation)
$sel:tags:CreateAssociation' :: CreateAssociation -> Maybe [Tag]
$sel:syncCompliance:CreateAssociation' :: CreateAssociation -> Maybe AssociationSyncCompliance
$sel:scheduleOffset:CreateAssociation' :: CreateAssociation -> Maybe Natural
$sel:scheduleExpression:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:parameters:CreateAssociation' :: CreateAssociation -> Maybe (Sensitive (HashMap Text [Text]))
$sel:outputLocation:CreateAssociation' :: CreateAssociation -> Maybe InstanceAssociationOutputLocation
$sel:maxErrors:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:maxConcurrency:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:instanceId:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:documentVersion:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:complianceSeverity:CreateAssociation' :: CreateAssociation -> Maybe AssociationComplianceSeverity
$sel:calendarNames:CreateAssociation' :: CreateAssociation -> Maybe [Text]
$sel:automationTargetParameterName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:associationName:CreateAssociation' :: CreateAssociation -> Maybe Text
$sel:applyOnlyAtCronInterval:CreateAssociation' :: CreateAssociation -> Maybe Bool
$sel:alarmConfiguration:CreateAssociation' :: CreateAssociation -> Maybe AlarmConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AlarmConfiguration" 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 AlarmConfiguration
alarmConfiguration,
            (Key
"ApplyOnlyAtCronInterval" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
applyOnlyAtCronInterval,
            (Key
"AssociationName" 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
associationName,
            (Key
"AutomationTargetParameterName" 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
automationTargetParameterName,
            (Key
"CalendarNames" 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]
calendarNames,
            (Key
"ComplianceSeverity" 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 AssociationComplianceSeverity
complianceSeverity,
            (Key
"DocumentVersion" 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
documentVersion,
            (Key
"InstanceId" 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
instanceId,
            (Key
"MaxConcurrency" 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
maxConcurrency,
            (Key
"MaxErrors" 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
maxErrors,
            (Key
"OutputLocation" 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 InstanceAssociationOutputLocation
outputLocation,
            (Key
"Parameters" 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 (Sensitive (HashMap Text [Text]))
parameters,
            (Key
"ScheduleExpression" 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
scheduleExpression,
            (Key
"ScheduleOffset" 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
scheduleOffset,
            (Key
"SyncCompliance" 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 AssociationSyncCompliance
syncCompliance,
            (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,
            (Key
"TargetLocations" 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 (NonEmpty TargetLocation)
targetLocations,
            (Key
"TargetMaps" 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 [HashMap Text [Text]]
targetMaps,
            (Key
"Targets" 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 [Target]
targets,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

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

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

-- | /See:/ 'newCreateAssociationResponse' smart constructor.
data CreateAssociationResponse = CreateAssociationResponse'
  { -- | Information about the association.
    CreateAssociationResponse -> Maybe AssociationDescription
associationDescription :: Prelude.Maybe AssociationDescription,
    -- | The response's http status code.
    CreateAssociationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateAssociationResponse -> CreateAssociationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssociationResponse -> CreateAssociationResponse -> Bool
$c/= :: CreateAssociationResponse -> CreateAssociationResponse -> Bool
== :: CreateAssociationResponse -> CreateAssociationResponse -> Bool
$c== :: CreateAssociationResponse -> CreateAssociationResponse -> Bool
Prelude.Eq, Int -> CreateAssociationResponse -> ShowS
[CreateAssociationResponse] -> ShowS
CreateAssociationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssociationResponse] -> ShowS
$cshowList :: [CreateAssociationResponse] -> ShowS
show :: CreateAssociationResponse -> String
$cshow :: CreateAssociationResponse -> String
showsPrec :: Int -> CreateAssociationResponse -> ShowS
$cshowsPrec :: Int -> CreateAssociationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateAssociationResponse x -> CreateAssociationResponse
forall x.
CreateAssociationResponse -> Rep CreateAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAssociationResponse x -> CreateAssociationResponse
$cfrom :: forall x.
CreateAssociationResponse -> Rep CreateAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAssociationResponse' 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:
--
-- 'associationDescription', 'createAssociationResponse_associationDescription' - Information about the association.
--
-- 'httpStatus', 'createAssociationResponse_httpStatus' - The response's http status code.
newCreateAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAssociationResponse
newCreateAssociationResponse :: Int -> CreateAssociationResponse
newCreateAssociationResponse Int
pHttpStatus_ =
  CreateAssociationResponse'
    { $sel:associationDescription:CreateAssociationResponse' :: Maybe AssociationDescription
associationDescription =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the association.
createAssociationResponse_associationDescription :: Lens.Lens' CreateAssociationResponse (Prelude.Maybe AssociationDescription)
createAssociationResponse_associationDescription :: Lens' CreateAssociationResponse (Maybe AssociationDescription)
createAssociationResponse_associationDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssociationResponse' {Maybe AssociationDescription
associationDescription :: Maybe AssociationDescription
$sel:associationDescription:CreateAssociationResponse' :: CreateAssociationResponse -> Maybe AssociationDescription
associationDescription} -> Maybe AssociationDescription
associationDescription) (\s :: CreateAssociationResponse
s@CreateAssociationResponse' {} Maybe AssociationDescription
a -> CreateAssociationResponse
s {$sel:associationDescription:CreateAssociationResponse' :: Maybe AssociationDescription
associationDescription = Maybe AssociationDescription
a} :: CreateAssociationResponse)

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

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