{-# 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.Glue.GetTags -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Retrieves a list of tags associated with a resource. module Amazonka.Glue.GetTags ( -- * Creating a Request GetTags (..), newGetTags, -- * Request Lenses getTags_resourceArn, -- * Destructuring the Response GetTagsResponse (..), newGetTagsResponse, -- * Response Lenses getTagsResponse_tags, getTagsResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.Glue.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newGetTags' smart constructor. data GetTags = GetTags' { -- | The Amazon Resource Name (ARN) of the resource for which to retrieve -- tags. resourceArn :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetTags' 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: -- -- 'resourceArn', 'getTags_resourceArn' - The Amazon Resource Name (ARN) of the resource for which to retrieve -- tags. newGetTags :: -- | 'resourceArn' Prelude.Text -> GetTags newGetTags pResourceArn_ = GetTags' {resourceArn = pResourceArn_} -- | The Amazon Resource Name (ARN) of the resource for which to retrieve -- tags. getTags_resourceArn :: Lens.Lens' GetTags Prelude.Text getTags_resourceArn = Lens.lens (\GetTags' {resourceArn} -> resourceArn) (\s@GetTags' {} a -> s {resourceArn = a} :: GetTags) instance Core.AWSRequest GetTags where type AWSResponse GetTags = GetTagsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetTagsResponse' Prelude.<$> (x Data..?> "Tags" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetTags where hashWithSalt _salt GetTags' {..} = _salt `Prelude.hashWithSalt` resourceArn instance Prelude.NFData GetTags where rnf GetTags' {..} = Prelude.rnf resourceArn instance Data.ToHeaders GetTags where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ("AWSGlue.GetTags" :: Prelude.ByteString), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetTags where toJSON GetTags' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("ResourceArn" Data..= resourceArn)] ) instance Data.ToPath GetTags where toPath = Prelude.const "/" instance Data.ToQuery GetTags where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetTagsResponse' smart constructor. data GetTagsResponse = GetTagsResponse' { -- | The requested tags. tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text), -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetTagsResponse' 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: -- -- 'tags', 'getTagsResponse_tags' - The requested tags. -- -- 'httpStatus', 'getTagsResponse_httpStatus' - The response's http status code. newGetTagsResponse :: -- | 'httpStatus' Prelude.Int -> GetTagsResponse newGetTagsResponse pHttpStatus_ = GetTagsResponse' { tags = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The requested tags. getTagsResponse_tags :: Lens.Lens' GetTagsResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)) getTagsResponse_tags = Lens.lens (\GetTagsResponse' {tags} -> tags) (\s@GetTagsResponse' {} a -> s {tags = a} :: GetTagsResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. getTagsResponse_httpStatus :: Lens.Lens' GetTagsResponse Prelude.Int getTagsResponse_httpStatus = Lens.lens (\GetTagsResponse' {httpStatus} -> httpStatus) (\s@GetTagsResponse' {} a -> s {httpStatus = a} :: GetTagsResponse) instance Prelude.NFData GetTagsResponse where rnf GetTagsResponse' {..} = Prelude.rnf tags `Prelude.seq` Prelude.rnf httpStatus