{-# 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.UpdateAssociation
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an association. You can update the association name and version,
-- the document version, schedule, parameters, and Amazon Simple Storage
-- Service (Amazon S3) output.
--
-- In order to call this API operation, your Identity and Access Management
-- (IAM) user account, group, or role must be configured with permission to
-- call the DescribeAssociation API operation. If you don\'t have
-- permission to call @DescribeAssociation@, then you receive the following
-- error:
-- @An error occurred (AccessDeniedException) when calling the UpdateAssociation operation: User: \<user_arn> isn\'t authorized to perform: ssm:DescribeAssociation on resource: \<resource_arn>@
--
-- When you update an association, the association immediately runs against
-- the specified targets.
module Amazonka.SSM.UpdateAssociation
  ( -- * Creating a Request
    UpdateAssociation (..),
    newUpdateAssociation,

    -- * Request Lenses
    updateAssociation_targetLocations,
    updateAssociation_applyOnlyAtCronInterval,
    updateAssociation_maxErrors,
    updateAssociation_scheduleExpression,
    updateAssociation_name,
    updateAssociation_outputLocation,
    updateAssociation_syncCompliance,
    updateAssociation_targets,
    updateAssociation_parameters,
    updateAssociation_documentVersion,
    updateAssociation_automationTargetParameterName,
    updateAssociation_associationVersion,
    updateAssociation_associationName,
    updateAssociation_calendarNames,
    updateAssociation_complianceSeverity,
    updateAssociation_maxConcurrency,
    updateAssociation_associationId,

    -- * Destructuring the Response
    UpdateAssociationResponse (..),
    newUpdateAssociationResponse,

    -- * Response Lenses
    updateAssociationResponse_associationDescription,
    updateAssociationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateAssociation' smart constructor.
data UpdateAssociation = UpdateAssociation'
  { -- | 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 update an association in multiple Regions and multiple
    -- accounts.
    UpdateAssociation -> Maybe (NonEmpty TargetLocation)
targetLocations :: Prelude.Maybe (Prelude.NonEmpty TargetLocation),
    -- | By default, when you update an association, the system runs it
    -- immediately after it is updated and then according to the schedule you
    -- specified. Specify this option if you don\'t want an association to run
    -- immediately after you update it. This parameter isn\'t supported for
    -- rate expressions.
    --
    -- Also, if you specified this option when you created the association, you
    -- can reset it. To do so, specify the @no-apply-only-at-cron-interval@
    -- parameter when you update the association from the command line. This
    -- parameter forces the association to run immediately after updating it
    -- and according to the interval specified.
    UpdateAssociation -> Maybe Bool
applyOnlyAtCronInterval :: Prelude.Maybe Prelude.Bool,
    -- | 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 instances 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.
    UpdateAssociation -> Maybe Text
maxErrors :: Prelude.Maybe Prelude.Text,
    -- | The cron expression used to schedule the association that you want to
    -- update.
    UpdateAssociation -> Maybe Text
scheduleExpression :: Prelude.Maybe Prelude.Text,
    -- | The name of the SSM Command document or Automation runbook that contains
    -- the configuration information for the instance.
    --
    -- 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 document (SSM document) that are shared with you
    -- from other Amazon Web Services accounts, you must specify the complete
    -- SSM document ARN, in the following format:
    --
    -- @arn:aws: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@.
    UpdateAssociation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An S3 bucket where you want to store the results of this request.
    UpdateAssociation -> Maybe InstanceAssociationOutputLocation
outputLocation :: Prelude.Maybe InstanceAssociationOutputLocation,
    -- | 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, a capability of Amazon Web Services
    -- Systems Manager. It is managed by your direct call to the
    -- PutComplianceItems API operation.
    --
    -- By default, all associations use @AUTO@ mode.
    UpdateAssociation -> Maybe AssociationSyncCompliance
syncCompliance :: Prelude.Maybe AssociationSyncCompliance,
    -- | The targets of the association.
    UpdateAssociation -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | The parameters you want to update for the association. If you create a
    -- parameter using Parameter Store, a capability of Amazon Web Services
    -- Systems Manager, you can reference the parameter using
    -- @{{ssm:parameter-name}}@.
    UpdateAssociation -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The document version you want update for the association.
    UpdateAssociation -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | Specify the target for the association. 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.
    UpdateAssociation -> Maybe Text
automationTargetParameterName :: Prelude.Maybe Prelude.Text,
    -- | This parameter is provided for concurrency control purposes. You must
    -- specify the latest association version in the service. If you want to
    -- ensure that this request succeeds, either specify @$LATEST@, or omit
    -- this parameter.
    UpdateAssociation -> Maybe Text
associationVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the association that you want to update.
    UpdateAssociation -> Maybe Text
associationName :: 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>.
    UpdateAssociation -> Maybe [Text]
calendarNames :: Prelude.Maybe [Prelude.Text],
    -- | The severity level to assign to the association.
    UpdateAssociation -> Maybe AssociationComplianceSeverity
complianceSeverity :: Prelude.Maybe AssociationComplianceSeverity,
    -- | 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 instance 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 instance will process its association within the limit specified for
    -- @MaxConcurrency@.
    UpdateAssociation -> Maybe Text
maxConcurrency :: Prelude.Maybe Prelude.Text,
    -- | The ID of the association you want to update.
    UpdateAssociation -> Text
associationId :: Prelude.Text
  }
  deriving (UpdateAssociation -> UpdateAssociation -> Bool
(UpdateAssociation -> UpdateAssociation -> Bool)
-> (UpdateAssociation -> UpdateAssociation -> Bool)
-> Eq UpdateAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAssociation -> UpdateAssociation -> Bool
$c/= :: UpdateAssociation -> UpdateAssociation -> Bool
== :: UpdateAssociation -> UpdateAssociation -> Bool
$c== :: UpdateAssociation -> UpdateAssociation -> Bool
Prelude.Eq, ReadPrec [UpdateAssociation]
ReadPrec UpdateAssociation
Int -> ReadS UpdateAssociation
ReadS [UpdateAssociation]
(Int -> ReadS UpdateAssociation)
-> ReadS [UpdateAssociation]
-> ReadPrec UpdateAssociation
-> ReadPrec [UpdateAssociation]
-> Read UpdateAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAssociation]
$creadListPrec :: ReadPrec [UpdateAssociation]
readPrec :: ReadPrec UpdateAssociation
$creadPrec :: ReadPrec UpdateAssociation
readList :: ReadS [UpdateAssociation]
$creadList :: ReadS [UpdateAssociation]
readsPrec :: Int -> ReadS UpdateAssociation
$creadsPrec :: Int -> ReadS UpdateAssociation
Prelude.Read, Int -> UpdateAssociation -> ShowS
[UpdateAssociation] -> ShowS
UpdateAssociation -> String
(Int -> UpdateAssociation -> ShowS)
-> (UpdateAssociation -> String)
-> ([UpdateAssociation] -> ShowS)
-> Show UpdateAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAssociation] -> ShowS
$cshowList :: [UpdateAssociation] -> ShowS
show :: UpdateAssociation -> String
$cshow :: UpdateAssociation -> String
showsPrec :: Int -> UpdateAssociation -> ShowS
$cshowsPrec :: Int -> UpdateAssociation -> ShowS
Prelude.Show, (forall x. UpdateAssociation -> Rep UpdateAssociation x)
-> (forall x. Rep UpdateAssociation x -> UpdateAssociation)
-> Generic UpdateAssociation
forall x. Rep UpdateAssociation x -> UpdateAssociation
forall x. UpdateAssociation -> Rep UpdateAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAssociation x -> UpdateAssociation
$cfrom :: forall x. UpdateAssociation -> Rep UpdateAssociation x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAssociation' 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:
--
-- 'targetLocations', 'updateAssociation_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 update an association in multiple Regions and multiple
-- accounts.
--
-- 'applyOnlyAtCronInterval', 'updateAssociation_applyOnlyAtCronInterval' - By default, when you update an association, the system runs it
-- immediately after it is updated and then according to the schedule you
-- specified. Specify this option if you don\'t want an association to run
-- immediately after you update it. This parameter isn\'t supported for
-- rate expressions.
--
-- Also, if you specified this option when you created the association, you
-- can reset it. To do so, specify the @no-apply-only-at-cron-interval@
-- parameter when you update the association from the command line. This
-- parameter forces the association to run immediately after updating it
-- and according to the interval specified.
--
-- 'maxErrors', 'updateAssociation_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 instances 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.
--
-- 'scheduleExpression', 'updateAssociation_scheduleExpression' - The cron expression used to schedule the association that you want to
-- update.
--
-- 'name', 'updateAssociation_name' - The name of the SSM Command document or Automation runbook that contains
-- the configuration information for the instance.
--
-- 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 document (SSM document) that are shared with you
-- from other Amazon Web Services accounts, you must specify the complete
-- SSM document ARN, in the following format:
--
-- @arn:aws: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@.
--
-- 'outputLocation', 'updateAssociation_outputLocation' - An S3 bucket where you want to store the results of this request.
--
-- 'syncCompliance', 'updateAssociation_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, a capability of Amazon Web Services
-- Systems Manager. It is managed by your direct call to the
-- PutComplianceItems API operation.
--
-- By default, all associations use @AUTO@ mode.
--
-- 'targets', 'updateAssociation_targets' - The targets of the association.
--
-- 'parameters', 'updateAssociation_parameters' - The parameters you want to update for the association. If you create a
-- parameter using Parameter Store, a capability of Amazon Web Services
-- Systems Manager, you can reference the parameter using
-- @{{ssm:parameter-name}}@.
--
-- 'documentVersion', 'updateAssociation_documentVersion' - The document version you want update for the association.
--
-- 'automationTargetParameterName', 'updateAssociation_automationTargetParameterName' - Specify the target for the association. 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.
--
-- 'associationVersion', 'updateAssociation_associationVersion' - This parameter is provided for concurrency control purposes. You must
-- specify the latest association version in the service. If you want to
-- ensure that this request succeeds, either specify @$LATEST@, or omit
-- this parameter.
--
-- 'associationName', 'updateAssociation_associationName' - The name of the association that you want to update.
--
-- 'calendarNames', 'updateAssociation_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', 'updateAssociation_complianceSeverity' - The severity level to assign to the association.
--
-- 'maxConcurrency', 'updateAssociation_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 instance 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 instance will process its association within the limit specified for
-- @MaxConcurrency@.
--
-- 'associationId', 'updateAssociation_associationId' - The ID of the association you want to update.
newUpdateAssociation ::
  -- | 'associationId'
  Prelude.Text ->
  UpdateAssociation
newUpdateAssociation :: Text -> UpdateAssociation
newUpdateAssociation Text
pAssociationId_ =
  UpdateAssociation' :: Maybe (NonEmpty TargetLocation)
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe InstanceAssociationOutputLocation
-> Maybe AssociationSyncCompliance
-> Maybe [Target]
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe AssociationComplianceSeverity
-> Maybe Text
-> Text
-> UpdateAssociation
UpdateAssociation'
    { $sel:targetLocations:UpdateAssociation' :: Maybe (NonEmpty TargetLocation)
targetLocations =
        Maybe (NonEmpty TargetLocation)
forall a. Maybe a
Prelude.Nothing,
      $sel:applyOnlyAtCronInterval:UpdateAssociation' :: Maybe Bool
applyOnlyAtCronInterval = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:maxErrors:UpdateAssociation' :: Maybe Text
maxErrors = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleExpression:UpdateAssociation' :: Maybe Text
scheduleExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateAssociation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputLocation:UpdateAssociation' :: Maybe InstanceAssociationOutputLocation
outputLocation = Maybe InstanceAssociationOutputLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:syncCompliance:UpdateAssociation' :: Maybe AssociationSyncCompliance
syncCompliance = Maybe AssociationSyncCompliance
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:UpdateAssociation' :: Maybe [Target]
targets = Maybe [Target]
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:UpdateAssociation' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:UpdateAssociation' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:automationTargetParameterName:UpdateAssociation' :: Maybe Text
automationTargetParameterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationVersion:UpdateAssociation' :: Maybe Text
associationVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationName:UpdateAssociation' :: Maybe Text
associationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:calendarNames:UpdateAssociation' :: Maybe [Text]
calendarNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceSeverity:UpdateAssociation' :: Maybe AssociationComplianceSeverity
complianceSeverity = Maybe AssociationComplianceSeverity
forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrency:UpdateAssociation' :: Maybe Text
maxConcurrency = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationId:UpdateAssociation' :: Text
associationId = Text
pAssociationId_
    }

-- | 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 update an association in multiple Regions and multiple
-- accounts.
updateAssociation_targetLocations :: Lens.Lens' UpdateAssociation (Prelude.Maybe (Prelude.NonEmpty TargetLocation))
updateAssociation_targetLocations :: (Maybe (NonEmpty TargetLocation)
 -> f (Maybe (NonEmpty TargetLocation)))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_targetLocations = (UpdateAssociation -> Maybe (NonEmpty TargetLocation))
-> (UpdateAssociation
    -> Maybe (NonEmpty TargetLocation) -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe (NonEmpty TargetLocation)
targetLocations :: Maybe (NonEmpty TargetLocation)
$sel:targetLocations:UpdateAssociation' :: UpdateAssociation -> Maybe (NonEmpty TargetLocation)
targetLocations} -> Maybe (NonEmpty TargetLocation)
targetLocations) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe (NonEmpty TargetLocation)
a -> UpdateAssociation
s {$sel:targetLocations:UpdateAssociation' :: Maybe (NonEmpty TargetLocation)
targetLocations = Maybe (NonEmpty TargetLocation)
a} :: UpdateAssociation) ((Maybe (NonEmpty TargetLocation)
  -> f (Maybe (NonEmpty TargetLocation)))
 -> UpdateAssociation -> f UpdateAssociation)
-> ((Maybe (NonEmpty TargetLocation)
     -> f (Maybe (NonEmpty TargetLocation)))
    -> Maybe (NonEmpty TargetLocation)
    -> f (Maybe (NonEmpty TargetLocation)))
-> (Maybe (NonEmpty TargetLocation)
    -> f (Maybe (NonEmpty TargetLocation)))
-> UpdateAssociation
-> f UpdateAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
-> Iso
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | By default, when you update an association, the system runs it
-- immediately after it is updated and then according to the schedule you
-- specified. Specify this option if you don\'t want an association to run
-- immediately after you update it. This parameter isn\'t supported for
-- rate expressions.
--
-- Also, if you specified this option when you created the association, you
-- can reset it. To do so, specify the @no-apply-only-at-cron-interval@
-- parameter when you update the association from the command line. This
-- parameter forces the association to run immediately after updating it
-- and according to the interval specified.
updateAssociation_applyOnlyAtCronInterval :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Bool)
updateAssociation_applyOnlyAtCronInterval :: (Maybe Bool -> f (Maybe Bool))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_applyOnlyAtCronInterval = (UpdateAssociation -> Maybe Bool)
-> (UpdateAssociation -> Maybe Bool -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Bool
applyOnlyAtCronInterval :: Maybe Bool
$sel:applyOnlyAtCronInterval:UpdateAssociation' :: UpdateAssociation -> Maybe Bool
applyOnlyAtCronInterval} -> Maybe Bool
applyOnlyAtCronInterval) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Bool
a -> UpdateAssociation
s {$sel:applyOnlyAtCronInterval:UpdateAssociation' :: Maybe Bool
applyOnlyAtCronInterval = Maybe Bool
a} :: UpdateAssociation)

-- | 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 instances 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.
updateAssociation_maxErrors :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_maxErrors :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_maxErrors = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
maxErrors :: Maybe Text
$sel:maxErrors:UpdateAssociation' :: UpdateAssociation -> Maybe Text
maxErrors} -> Maybe Text
maxErrors) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:maxErrors:UpdateAssociation' :: Maybe Text
maxErrors = Maybe Text
a} :: UpdateAssociation)

-- | The cron expression used to schedule the association that you want to
-- update.
updateAssociation_scheduleExpression :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_scheduleExpression :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_scheduleExpression = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
scheduleExpression :: Maybe Text
$sel:scheduleExpression:UpdateAssociation' :: UpdateAssociation -> Maybe Text
scheduleExpression} -> Maybe Text
scheduleExpression) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:scheduleExpression:UpdateAssociation' :: Maybe Text
scheduleExpression = Maybe Text
a} :: UpdateAssociation)

-- | The name of the SSM Command document or Automation runbook that contains
-- the configuration information for the instance.
--
-- 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 document (SSM document) that are shared with you
-- from other Amazon Web Services accounts, you must specify the complete
-- SSM document ARN, in the following format:
--
-- @arn:aws: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@.
updateAssociation_name :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_name :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_name = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
name :: Maybe Text
$sel:name:UpdateAssociation' :: UpdateAssociation -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:name:UpdateAssociation' :: Maybe Text
name = Maybe Text
a} :: UpdateAssociation)

-- | An S3 bucket where you want to store the results of this request.
updateAssociation_outputLocation :: Lens.Lens' UpdateAssociation (Prelude.Maybe InstanceAssociationOutputLocation)
updateAssociation_outputLocation :: (Maybe InstanceAssociationOutputLocation
 -> f (Maybe InstanceAssociationOutputLocation))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_outputLocation = (UpdateAssociation -> Maybe InstanceAssociationOutputLocation)
-> (UpdateAssociation
    -> Maybe InstanceAssociationOutputLocation -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe InstanceAssociationOutputLocation)
     (Maybe InstanceAssociationOutputLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe InstanceAssociationOutputLocation
outputLocation :: Maybe InstanceAssociationOutputLocation
$sel:outputLocation:UpdateAssociation' :: UpdateAssociation -> Maybe InstanceAssociationOutputLocation
outputLocation} -> Maybe InstanceAssociationOutputLocation
outputLocation) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe InstanceAssociationOutputLocation
a -> UpdateAssociation
s {$sel:outputLocation:UpdateAssociation' :: Maybe InstanceAssociationOutputLocation
outputLocation = Maybe InstanceAssociationOutputLocation
a} :: UpdateAssociation)

-- | 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, a capability of Amazon Web Services
-- Systems Manager. It is managed by your direct call to the
-- PutComplianceItems API operation.
--
-- By default, all associations use @AUTO@ mode.
updateAssociation_syncCompliance :: Lens.Lens' UpdateAssociation (Prelude.Maybe AssociationSyncCompliance)
updateAssociation_syncCompliance :: (Maybe AssociationSyncCompliance
 -> f (Maybe AssociationSyncCompliance))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_syncCompliance = (UpdateAssociation -> Maybe AssociationSyncCompliance)
-> (UpdateAssociation
    -> Maybe AssociationSyncCompliance -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe AssociationSyncCompliance)
     (Maybe AssociationSyncCompliance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe AssociationSyncCompliance
syncCompliance :: Maybe AssociationSyncCompliance
$sel:syncCompliance:UpdateAssociation' :: UpdateAssociation -> Maybe AssociationSyncCompliance
syncCompliance} -> Maybe AssociationSyncCompliance
syncCompliance) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe AssociationSyncCompliance
a -> UpdateAssociation
s {$sel:syncCompliance:UpdateAssociation' :: Maybe AssociationSyncCompliance
syncCompliance = Maybe AssociationSyncCompliance
a} :: UpdateAssociation)

-- | The targets of the association.
updateAssociation_targets :: Lens.Lens' UpdateAssociation (Prelude.Maybe [Target])
updateAssociation_targets :: (Maybe [Target] -> f (Maybe [Target]))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_targets = (UpdateAssociation -> Maybe [Target])
-> (UpdateAssociation -> Maybe [Target] -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe [Target])
     (Maybe [Target])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:UpdateAssociation' :: UpdateAssociation -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe [Target]
a -> UpdateAssociation
s {$sel:targets:UpdateAssociation' :: Maybe [Target]
targets = Maybe [Target]
a} :: UpdateAssociation) ((Maybe [Target] -> f (Maybe [Target]))
 -> UpdateAssociation -> f UpdateAssociation)
-> ((Maybe [Target] -> f (Maybe [Target]))
    -> Maybe [Target] -> f (Maybe [Target]))
-> (Maybe [Target] -> f (Maybe [Target]))
-> UpdateAssociation
-> f UpdateAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Target] [Target] [Target] [Target]
-> Iso
     (Maybe [Target]) (Maybe [Target]) (Maybe [Target]) (Maybe [Target])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Target] [Target] [Target] [Target]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The parameters you want to update for the association. If you create a
-- parameter using Parameter Store, a capability of Amazon Web Services
-- Systems Manager, you can reference the parameter using
-- @{{ssm:parameter-name}}@.
updateAssociation_parameters :: Lens.Lens' UpdateAssociation (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
updateAssociation_parameters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_parameters = (UpdateAssociation -> Maybe (HashMap Text [Text]))
-> (UpdateAssociation
    -> Maybe (HashMap Text [Text]) -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:UpdateAssociation' :: UpdateAssociation -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe (HashMap Text [Text])
a -> UpdateAssociation
s {$sel:parameters:UpdateAssociation' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: UpdateAssociation) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> UpdateAssociation -> f UpdateAssociation)
-> ((Maybe (HashMap Text [Text])
     -> f (Maybe (HashMap Text [Text])))
    -> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> UpdateAssociation
-> f UpdateAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
-> Iso
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The document version you want update for the association.
updateAssociation_documentVersion :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_documentVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_documentVersion = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:UpdateAssociation' :: UpdateAssociation -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:documentVersion:UpdateAssociation' :: Maybe Text
documentVersion = Maybe Text
a} :: UpdateAssociation)

-- | Specify the target for the association. 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.
updateAssociation_automationTargetParameterName :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_automationTargetParameterName :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_automationTargetParameterName = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
automationTargetParameterName :: Maybe Text
$sel:automationTargetParameterName:UpdateAssociation' :: UpdateAssociation -> Maybe Text
automationTargetParameterName} -> Maybe Text
automationTargetParameterName) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:automationTargetParameterName:UpdateAssociation' :: Maybe Text
automationTargetParameterName = Maybe Text
a} :: UpdateAssociation)

-- | This parameter is provided for concurrency control purposes. You must
-- specify the latest association version in the service. If you want to
-- ensure that this request succeeds, either specify @$LATEST@, or omit
-- this parameter.
updateAssociation_associationVersion :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_associationVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_associationVersion = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
associationVersion :: Maybe Text
$sel:associationVersion:UpdateAssociation' :: UpdateAssociation -> Maybe Text
associationVersion} -> Maybe Text
associationVersion) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:associationVersion:UpdateAssociation' :: Maybe Text
associationVersion = Maybe Text
a} :: UpdateAssociation)

-- | The name of the association that you want to update.
updateAssociation_associationName :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_associationName :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_associationName = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
associationName :: Maybe Text
$sel:associationName:UpdateAssociation' :: UpdateAssociation -> Maybe Text
associationName} -> Maybe Text
associationName) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:associationName:UpdateAssociation' :: Maybe Text
associationName = Maybe Text
a} :: UpdateAssociation)

-- | 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>.
updateAssociation_calendarNames :: Lens.Lens' UpdateAssociation (Prelude.Maybe [Prelude.Text])
updateAssociation_calendarNames :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_calendarNames = (UpdateAssociation -> Maybe [Text])
-> (UpdateAssociation -> Maybe [Text] -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe [Text]
calendarNames :: Maybe [Text]
$sel:calendarNames:UpdateAssociation' :: UpdateAssociation -> Maybe [Text]
calendarNames} -> Maybe [Text]
calendarNames) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe [Text]
a -> UpdateAssociation
s {$sel:calendarNames:UpdateAssociation' :: Maybe [Text]
calendarNames = Maybe [Text]
a} :: UpdateAssociation) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateAssociation -> f UpdateAssociation)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateAssociation
-> f UpdateAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The severity level to assign to the association.
updateAssociation_complianceSeverity :: Lens.Lens' UpdateAssociation (Prelude.Maybe AssociationComplianceSeverity)
updateAssociation_complianceSeverity :: (Maybe AssociationComplianceSeverity
 -> f (Maybe AssociationComplianceSeverity))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_complianceSeverity = (UpdateAssociation -> Maybe AssociationComplianceSeverity)
-> (UpdateAssociation
    -> Maybe AssociationComplianceSeverity -> UpdateAssociation)
-> Lens
     UpdateAssociation
     UpdateAssociation
     (Maybe AssociationComplianceSeverity)
     (Maybe AssociationComplianceSeverity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe AssociationComplianceSeverity
complianceSeverity :: Maybe AssociationComplianceSeverity
$sel:complianceSeverity:UpdateAssociation' :: UpdateAssociation -> Maybe AssociationComplianceSeverity
complianceSeverity} -> Maybe AssociationComplianceSeverity
complianceSeverity) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe AssociationComplianceSeverity
a -> UpdateAssociation
s {$sel:complianceSeverity:UpdateAssociation' :: Maybe AssociationComplianceSeverity
complianceSeverity = Maybe AssociationComplianceSeverity
a} :: UpdateAssociation)

-- | 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 instance 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 instance will process its association within the limit specified for
-- @MaxConcurrency@.
updateAssociation_maxConcurrency :: Lens.Lens' UpdateAssociation (Prelude.Maybe Prelude.Text)
updateAssociation_maxConcurrency :: (Maybe Text -> f (Maybe Text))
-> UpdateAssociation -> f UpdateAssociation
updateAssociation_maxConcurrency = (UpdateAssociation -> Maybe Text)
-> (UpdateAssociation -> Maybe Text -> UpdateAssociation)
-> Lens
     UpdateAssociation UpdateAssociation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Maybe Text
maxConcurrency :: Maybe Text
$sel:maxConcurrency:UpdateAssociation' :: UpdateAssociation -> Maybe Text
maxConcurrency} -> Maybe Text
maxConcurrency) (\s :: UpdateAssociation
s@UpdateAssociation' {} Maybe Text
a -> UpdateAssociation
s {$sel:maxConcurrency:UpdateAssociation' :: Maybe Text
maxConcurrency = Maybe Text
a} :: UpdateAssociation)

-- | The ID of the association you want to update.
updateAssociation_associationId :: Lens.Lens' UpdateAssociation Prelude.Text
updateAssociation_associationId :: (Text -> f Text) -> UpdateAssociation -> f UpdateAssociation
updateAssociation_associationId = (UpdateAssociation -> Text)
-> (UpdateAssociation -> Text -> UpdateAssociation)
-> Lens UpdateAssociation UpdateAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociation' {Text
associationId :: Text
$sel:associationId:UpdateAssociation' :: UpdateAssociation -> Text
associationId} -> Text
associationId) (\s :: UpdateAssociation
s@UpdateAssociation' {} Text
a -> UpdateAssociation
s {$sel:associationId:UpdateAssociation' :: Text
associationId = Text
a} :: UpdateAssociation)

instance Core.AWSRequest UpdateAssociation where
  type
    AWSResponse UpdateAssociation =
      UpdateAssociationResponse
  request :: UpdateAssociation -> Request UpdateAssociation
request = Service -> UpdateAssociation -> Request UpdateAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAssociation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateAssociation))
-> Logger
-> Service
-> Proxy UpdateAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAssociation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe AssociationDescription -> Int -> UpdateAssociationResponse
UpdateAssociationResponse'
            (Maybe AssociationDescription -> Int -> UpdateAssociationResponse)
-> Either String (Maybe AssociationDescription)
-> Either String (Int -> UpdateAssociationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AssociationDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AssociationDescription")
            Either String (Int -> UpdateAssociationResponse)
-> Either String Int -> Either String UpdateAssociationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateAssociation

instance Prelude.NFData UpdateAssociation

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

instance Core.ToJSON UpdateAssociation where
  toJSON :: UpdateAssociation -> Value
toJSON UpdateAssociation' {Maybe Bool
Maybe [Text]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (HashMap Text [Text])
Maybe AssociationComplianceSeverity
Maybe AssociationSyncCompliance
Maybe InstanceAssociationOutputLocation
Text
associationId :: Text
maxConcurrency :: Maybe Text
complianceSeverity :: Maybe AssociationComplianceSeverity
calendarNames :: Maybe [Text]
associationName :: Maybe Text
associationVersion :: Maybe Text
automationTargetParameterName :: Maybe Text
documentVersion :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
targets :: Maybe [Target]
syncCompliance :: Maybe AssociationSyncCompliance
outputLocation :: Maybe InstanceAssociationOutputLocation
name :: Maybe Text
scheduleExpression :: Maybe Text
maxErrors :: Maybe Text
applyOnlyAtCronInterval :: Maybe Bool
targetLocations :: Maybe (NonEmpty TargetLocation)
$sel:associationId:UpdateAssociation' :: UpdateAssociation -> Text
$sel:maxConcurrency:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:complianceSeverity:UpdateAssociation' :: UpdateAssociation -> Maybe AssociationComplianceSeverity
$sel:calendarNames:UpdateAssociation' :: UpdateAssociation -> Maybe [Text]
$sel:associationName:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:associationVersion:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:automationTargetParameterName:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:documentVersion:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:parameters:UpdateAssociation' :: UpdateAssociation -> Maybe (HashMap Text [Text])
$sel:targets:UpdateAssociation' :: UpdateAssociation -> Maybe [Target]
$sel:syncCompliance:UpdateAssociation' :: UpdateAssociation -> Maybe AssociationSyncCompliance
$sel:outputLocation:UpdateAssociation' :: UpdateAssociation -> Maybe InstanceAssociationOutputLocation
$sel:name:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:scheduleExpression:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:maxErrors:UpdateAssociation' :: UpdateAssociation -> Maybe Text
$sel:applyOnlyAtCronInterval:UpdateAssociation' :: UpdateAssociation -> Maybe Bool
$sel:targetLocations:UpdateAssociation' :: UpdateAssociation -> Maybe (NonEmpty TargetLocation)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TargetLocations" Text -> NonEmpty TargetLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty TargetLocation -> Pair)
-> Maybe (NonEmpty TargetLocation) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TargetLocation)
targetLocations,
            (Text
"ApplyOnlyAtCronInterval" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
applyOnlyAtCronInterval,
            (Text
"MaxErrors" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxErrors,
            (Text
"ScheduleExpression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
scheduleExpression,
            (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"OutputLocation" Text -> InstanceAssociationOutputLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InstanceAssociationOutputLocation -> Pair)
-> Maybe InstanceAssociationOutputLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InstanceAssociationOutputLocation
outputLocation,
            (Text
"SyncCompliance" Text -> AssociationSyncCompliance -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AssociationSyncCompliance -> Pair)
-> Maybe AssociationSyncCompliance -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssociationSyncCompliance
syncCompliance,
            (Text
"Targets" Text -> [Target] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Target] -> Pair) -> Maybe [Target] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Target]
targets,
            (Text
"Parameters" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
parameters,
            (Text
"DocumentVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentVersion,
            (Text
"AutomationTargetParameterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
automationTargetParameterName,
            (Text
"AssociationVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
associationVersion,
            (Text
"AssociationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
associationName,
            (Text
"CalendarNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
calendarNames,
            (Text
"ComplianceSeverity" Text -> AssociationComplianceSeverity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AssociationComplianceSeverity -> Pair)
-> Maybe AssociationComplianceSeverity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssociationComplianceSeverity
complianceSeverity,
            (Text
"MaxConcurrency" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxConcurrency,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AssociationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
associationId)
          ]
      )

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

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

-- | /See:/ 'newUpdateAssociationResponse' smart constructor.
data UpdateAssociationResponse = UpdateAssociationResponse'
  { -- | The description of the association that was updated.
    UpdateAssociationResponse -> Maybe AssociationDescription
associationDescription :: Prelude.Maybe AssociationDescription,
    -- | The response's http status code.
    UpdateAssociationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateAssociationResponse -> UpdateAssociationResponse -> Bool
(UpdateAssociationResponse -> UpdateAssociationResponse -> Bool)
-> (UpdateAssociationResponse -> UpdateAssociationResponse -> Bool)
-> Eq UpdateAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAssociationResponse -> UpdateAssociationResponse -> Bool
$c/= :: UpdateAssociationResponse -> UpdateAssociationResponse -> Bool
== :: UpdateAssociationResponse -> UpdateAssociationResponse -> Bool
$c== :: UpdateAssociationResponse -> UpdateAssociationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAssociationResponse]
ReadPrec UpdateAssociationResponse
Int -> ReadS UpdateAssociationResponse
ReadS [UpdateAssociationResponse]
(Int -> ReadS UpdateAssociationResponse)
-> ReadS [UpdateAssociationResponse]
-> ReadPrec UpdateAssociationResponse
-> ReadPrec [UpdateAssociationResponse]
-> Read UpdateAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAssociationResponse]
$creadListPrec :: ReadPrec [UpdateAssociationResponse]
readPrec :: ReadPrec UpdateAssociationResponse
$creadPrec :: ReadPrec UpdateAssociationResponse
readList :: ReadS [UpdateAssociationResponse]
$creadList :: ReadS [UpdateAssociationResponse]
readsPrec :: Int -> ReadS UpdateAssociationResponse
$creadsPrec :: Int -> ReadS UpdateAssociationResponse
Prelude.Read, Int -> UpdateAssociationResponse -> ShowS
[UpdateAssociationResponse] -> ShowS
UpdateAssociationResponse -> String
(Int -> UpdateAssociationResponse -> ShowS)
-> (UpdateAssociationResponse -> String)
-> ([UpdateAssociationResponse] -> ShowS)
-> Show UpdateAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAssociationResponse] -> ShowS
$cshowList :: [UpdateAssociationResponse] -> ShowS
show :: UpdateAssociationResponse -> String
$cshow :: UpdateAssociationResponse -> String
showsPrec :: Int -> UpdateAssociationResponse -> ShowS
$cshowsPrec :: Int -> UpdateAssociationResponse -> ShowS
Prelude.Show, (forall x.
 UpdateAssociationResponse -> Rep UpdateAssociationResponse x)
-> (forall x.
    Rep UpdateAssociationResponse x -> UpdateAssociationResponse)
-> Generic UpdateAssociationResponse
forall x.
Rep UpdateAssociationResponse x -> UpdateAssociationResponse
forall x.
UpdateAssociationResponse -> Rep UpdateAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAssociationResponse x -> UpdateAssociationResponse
$cfrom :: forall x.
UpdateAssociationResponse -> Rep UpdateAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAssociationResponse' 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', 'updateAssociationResponse_associationDescription' - The description of the association that was updated.
--
-- 'httpStatus', 'updateAssociationResponse_httpStatus' - The response's http status code.
newUpdateAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAssociationResponse
newUpdateAssociationResponse :: Int -> UpdateAssociationResponse
newUpdateAssociationResponse Int
pHttpStatus_ =
  UpdateAssociationResponse' :: Maybe AssociationDescription -> Int -> UpdateAssociationResponse
UpdateAssociationResponse'
    { $sel:associationDescription:UpdateAssociationResponse' :: Maybe AssociationDescription
associationDescription =
        Maybe AssociationDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of the association that was updated.
updateAssociationResponse_associationDescription :: Lens.Lens' UpdateAssociationResponse (Prelude.Maybe AssociationDescription)
updateAssociationResponse_associationDescription :: (Maybe AssociationDescription -> f (Maybe AssociationDescription))
-> UpdateAssociationResponse -> f UpdateAssociationResponse
updateAssociationResponse_associationDescription = (UpdateAssociationResponse -> Maybe AssociationDescription)
-> (UpdateAssociationResponse
    -> Maybe AssociationDescription -> UpdateAssociationResponse)
-> Lens
     UpdateAssociationResponse
     UpdateAssociationResponse
     (Maybe AssociationDescription)
     (Maybe AssociationDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssociationResponse' {Maybe AssociationDescription
associationDescription :: Maybe AssociationDescription
$sel:associationDescription:UpdateAssociationResponse' :: UpdateAssociationResponse -> Maybe AssociationDescription
associationDescription} -> Maybe AssociationDescription
associationDescription) (\s :: UpdateAssociationResponse
s@UpdateAssociationResponse' {} Maybe AssociationDescription
a -> UpdateAssociationResponse
s {$sel:associationDescription:UpdateAssociationResponse' :: Maybe AssociationDescription
associationDescription = Maybe AssociationDescription
a} :: UpdateAssociationResponse)

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

instance Prelude.NFData UpdateAssociationResponse