{-# 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.DeleteAssociation -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Disassociates the specified Amazon Web Services Systems Manager document -- (SSM document) from the specified managed node. If you created the -- association by using the @Targets@ parameter, then you must delete the -- association by using the association ID. -- -- When you disassociate a document from a managed node, it doesn\'t change -- the configuration of the node. To change the configuration state of a -- managed node after you disassociate a document, you must create a new -- document with the desired configuration and associate it with the node. module Amazonka.SSM.DeleteAssociation ( -- * Creating a Request DeleteAssociation (..), newDeleteAssociation, -- * Request Lenses deleteAssociation_associationId, deleteAssociation_instanceId, deleteAssociation_name, -- * Destructuring the Response DeleteAssociationResponse (..), newDeleteAssociationResponse, -- * Response Lenses deleteAssociationResponse_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:/ 'newDeleteAssociation' smart constructor. data DeleteAssociation = DeleteAssociation' { -- | The association ID that you want to delete. associationId :: 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. instanceId :: Prelude.Maybe Prelude.Text, -- | The name of the SSM document. name :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DeleteAssociation' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'associationId', 'deleteAssociation_associationId' - The association ID that you want to delete. -- -- 'instanceId', 'deleteAssociation_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. -- -- 'name', 'deleteAssociation_name' - The name of the SSM document. newDeleteAssociation :: DeleteAssociation newDeleteAssociation = DeleteAssociation' { associationId = Prelude.Nothing, instanceId = Prelude.Nothing, name = Prelude.Nothing } -- | The association ID that you want to delete. deleteAssociation_associationId :: Lens.Lens' DeleteAssociation (Prelude.Maybe Prelude.Text) deleteAssociation_associationId = Lens.lens (\DeleteAssociation' {associationId} -> associationId) (\s@DeleteAssociation' {} a -> s {associationId = a} :: DeleteAssociation) -- | 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. deleteAssociation_instanceId :: Lens.Lens' DeleteAssociation (Prelude.Maybe Prelude.Text) deleteAssociation_instanceId = Lens.lens (\DeleteAssociation' {instanceId} -> instanceId) (\s@DeleteAssociation' {} a -> s {instanceId = a} :: DeleteAssociation) -- | The name of the SSM document. deleteAssociation_name :: Lens.Lens' DeleteAssociation (Prelude.Maybe Prelude.Text) deleteAssociation_name = Lens.lens (\DeleteAssociation' {name} -> name) (\s@DeleteAssociation' {} a -> s {name = a} :: DeleteAssociation) instance Core.AWSRequest DeleteAssociation where type AWSResponse DeleteAssociation = DeleteAssociationResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveEmpty ( \s h x -> DeleteAssociationResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable DeleteAssociation where hashWithSalt _salt DeleteAssociation' {..} = _salt `Prelude.hashWithSalt` associationId `Prelude.hashWithSalt` instanceId `Prelude.hashWithSalt` name instance Prelude.NFData DeleteAssociation where rnf DeleteAssociation' {..} = Prelude.rnf associationId `Prelude.seq` Prelude.rnf instanceId `Prelude.seq` Prelude.rnf name instance Data.ToHeaders DeleteAssociation where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AmazonSSM.DeleteAssociation" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON DeleteAssociation where toJSON DeleteAssociation' {..} = Data.object ( Prelude.catMaybes [ ("AssociationId" Data..=) Prelude.<$> associationId, ("InstanceId" Data..=) Prelude.<$> instanceId, ("Name" Data..=) Prelude.<$> name ] ) instance Data.ToPath DeleteAssociation where toPath = Prelude.const "/" instance Data.ToQuery DeleteAssociation where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newDeleteAssociationResponse' smart constructor. data DeleteAssociationResponse = DeleteAssociationResponse' { -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DeleteAssociationResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'httpStatus', 'deleteAssociationResponse_httpStatus' - The response's http status code. newDeleteAssociationResponse :: -- | 'httpStatus' Prelude.Int -> DeleteAssociationResponse newDeleteAssociationResponse pHttpStatus_ = DeleteAssociationResponse' { httpStatus = pHttpStatus_ } -- | The response's http status code. deleteAssociationResponse_httpStatus :: Lens.Lens' DeleteAssociationResponse Prelude.Int deleteAssociationResponse_httpStatus = Lens.lens (\DeleteAssociationResponse' {httpStatus} -> httpStatus) (\s@DeleteAssociationResponse' {} a -> s {httpStatus = a} :: DeleteAssociationResponse) instance Prelude.NFData DeleteAssociationResponse where rnf DeleteAssociationResponse' {..} = Prelude.rnf httpStatus