{-# 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.WorkSpaces.CreateTags -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates the specified tags for the specified WorkSpaces resource. module Amazonka.WorkSpaces.CreateTags ( -- * Creating a Request CreateTags (..), newCreateTags, -- * Request Lenses createTags_resourceId, createTags_tags, -- * Destructuring the Response CreateTagsResponse (..), newCreateTagsResponse, -- * Response Lenses createTagsResponse_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.WorkSpaces.Types -- | /See:/ 'newCreateTags' smart constructor. data CreateTags = CreateTags' { -- | The identifier of the WorkSpaces resource. The supported resource types -- are WorkSpaces, registered directories, images, custom bundles, IP -- access control groups, and connection aliases. resourceId :: Prelude.Text, -- | The tags. Each WorkSpaces resource can have a maximum of 50 tags. tags :: [Tag] } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateTags' 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', 'createTags_resourceId' - The identifier of the WorkSpaces resource. The supported resource types -- are WorkSpaces, registered directories, images, custom bundles, IP -- access control groups, and connection aliases. -- -- 'tags', 'createTags_tags' - The tags. Each WorkSpaces resource can have a maximum of 50 tags. newCreateTags :: -- | 'resourceId' Prelude.Text -> CreateTags newCreateTags pResourceId_ = CreateTags' { resourceId = pResourceId_, tags = Prelude.mempty } -- | The identifier of the WorkSpaces resource. The supported resource types -- are WorkSpaces, registered directories, images, custom bundles, IP -- access control groups, and connection aliases. createTags_resourceId :: Lens.Lens' CreateTags Prelude.Text createTags_resourceId = Lens.lens (\CreateTags' {resourceId} -> resourceId) (\s@CreateTags' {} a -> s {resourceId = a} :: CreateTags) -- | The tags. Each WorkSpaces resource can have a maximum of 50 tags. createTags_tags :: Lens.Lens' CreateTags [Tag] createTags_tags = Lens.lens (\CreateTags' {tags} -> tags) (\s@CreateTags' {} a -> s {tags = a} :: CreateTags) Prelude.. Lens.coerced instance Core.AWSRequest CreateTags where type AWSResponse CreateTags = CreateTagsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveEmpty ( \s h x -> CreateTagsResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable CreateTags where hashWithSalt _salt CreateTags' {..} = _salt `Prelude.hashWithSalt` resourceId `Prelude.hashWithSalt` tags instance Prelude.NFData CreateTags where rnf CreateTags' {..} = Prelude.rnf resourceId `Prelude.seq` Prelude.rnf tags instance Data.ToHeaders CreateTags where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "WorkspacesService.CreateTags" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON CreateTags where toJSON CreateTags' {..} = Data.object ( Prelude.catMaybes [ Prelude.Just ("ResourceId" Data..= resourceId), Prelude.Just ("Tags" Data..= tags) ] ) instance Data.ToPath CreateTags where toPath = Prelude.const "/" instance Data.ToQuery CreateTags where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newCreateTagsResponse' smart constructor. data CreateTagsResponse = CreateTagsResponse' { -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateTagsResponse' 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', 'createTagsResponse_httpStatus' - The response's http status code. newCreateTagsResponse :: -- | 'httpStatus' Prelude.Int -> CreateTagsResponse newCreateTagsResponse pHttpStatus_ = CreateTagsResponse' {httpStatus = pHttpStatus_} -- | The response's http status code. createTagsResponse_httpStatus :: Lens.Lens' CreateTagsResponse Prelude.Int createTagsResponse_httpStatus = Lens.lens (\CreateTagsResponse' {httpStatus} -> httpStatus) (\s@CreateTagsResponse' {} a -> s {httpStatus = a} :: CreateTagsResponse) instance Prelude.NFData CreateTagsResponse where rnf CreateTagsResponse' {..} = Prelude.rnf httpStatus