{-# 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.DirectoryService.AddTagsToResource -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Adds or overwrites one or more tags for the specified directory. Each -- directory can have a maximum of 50 tags. Each tag consists of a key and -- optional value. Tag keys must be unique to each resource. module Amazonka.DirectoryService.AddTagsToResource ( -- * Creating a Request AddTagsToResource (..), newAddTagsToResource, -- * Request Lenses addTagsToResource_resourceId, addTagsToResource_tags, -- * Destructuring the Response AddTagsToResourceResponse (..), newAddTagsToResourceResponse, -- * Response Lenses addTagsToResourceResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.DirectoryService.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newAddTagsToResource' smart constructor. data AddTagsToResource = AddTagsToResource' { -- | Identifier (ID) for the directory to which to add the tag. resourceId :: Prelude.Text, -- | The tags to be assigned to the directory. tags :: [Tag] } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'AddTagsToResource' 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: -- -- 'resourceId', 'addTagsToResource_resourceId' - Identifier (ID) for the directory to which to add the tag. -- -- 'tags', 'addTagsToResource_tags' - The tags to be assigned to the directory. newAddTagsToResource :: -- | 'resourceId' Prelude.Text -> AddTagsToResource newAddTagsToResource pResourceId_ = AddTagsToResource' { resourceId = pResourceId_, tags = Prelude.mempty } -- | Identifier (ID) for the directory to which to add the tag. addTagsToResource_resourceId :: Lens.Lens' AddTagsToResource Prelude.Text addTagsToResource_resourceId = Lens.lens (\AddTagsToResource' {resourceId} -> resourceId) (\s@AddTagsToResource' {} a -> s {resourceId = a} :: AddTagsToResource) -- | The tags to be assigned to the directory. addTagsToResource_tags :: Lens.Lens' AddTagsToResource [Tag] addTagsToResource_tags = Lens.lens (\AddTagsToResource' {tags} -> tags) (\s@AddTagsToResource' {} a -> s {tags = a} :: AddTagsToResource) Prelude.. Lens.coerced instance Core.AWSRequest AddTagsToResource where type AWSResponse AddTagsToResource = AddTagsToResourceResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveEmpty ( \s h x -> AddTagsToResourceResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable AddTagsToResource where hashWithSalt _salt AddTagsToResource' {..} = _salt `Prelude.hashWithSalt` resourceId `Prelude.hashWithSalt` tags instance Prelude.NFData AddTagsToResource where rnf AddTagsToResource' {..} = Prelude.rnf resourceId `Prelude.seq` Prelude.rnf tags instance Data.ToHeaders AddTagsToResource where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "DirectoryService_20150416.AddTagsToResource" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON AddTagsToResource where toJSON AddTagsToResource' {..} = Data.object ( Prelude.catMaybes [ Prelude.Just ("ResourceId" Data..= resourceId), Prelude.Just ("Tags" Data..= tags) ] ) instance Data.ToPath AddTagsToResource where toPath = Prelude.const "/" instance Data.ToQuery AddTagsToResource where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newAddTagsToResourceResponse' smart constructor. data AddTagsToResourceResponse = AddTagsToResourceResponse' { -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'AddTagsToResourceResponse' 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', 'addTagsToResourceResponse_httpStatus' - The response's http status code. newAddTagsToResourceResponse :: -- | 'httpStatus' Prelude.Int -> AddTagsToResourceResponse newAddTagsToResourceResponse pHttpStatus_ = AddTagsToResourceResponse' { httpStatus = pHttpStatus_ } -- | The response's http status code. addTagsToResourceResponse_httpStatus :: Lens.Lens' AddTagsToResourceResponse Prelude.Int addTagsToResourceResponse_httpStatus = Lens.lens (\AddTagsToResourceResponse' {httpStatus} -> httpStatus) (\s@AddTagsToResourceResponse' {} a -> s {httpStatus = a} :: AddTagsToResourceResponse) instance Prelude.NFData AddTagsToResourceResponse where rnf AddTagsToResourceResponse' {..} = Prelude.rnf httpStatus