{-# 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.SSOAdmin.ListTagsForResource -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Lists the tags that are attached to a specified resource. -- -- This operation returns paginated results. module Amazonka.SSOAdmin.ListTagsForResource ( -- * Creating a Request ListTagsForResource (..), newListTagsForResource, -- * Request Lenses listTagsForResource_nextToken, listTagsForResource_instanceArn, listTagsForResource_resourceArn, -- * Destructuring the Response ListTagsForResourceResponse (..), newListTagsForResourceResponse, -- * Response Lenses listTagsForResourceResponse_nextToken, listTagsForResourceResponse_tags, listTagsForResourceResponse_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.SSOAdmin.Types -- | /See:/ 'newListTagsForResource' smart constructor. data ListTagsForResource = ListTagsForResource' { -- | The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. nextToken :: Prelude.Maybe Prelude.Text, -- | The ARN of the IAM Identity Center instance under which the operation -- will be executed. For more information about ARNs, see -- -- in the /AWS General Reference/. instanceArn :: Prelude.Text, -- | The ARN of the resource with the tags to be listed. resourceArn :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListTagsForResource' 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: -- -- 'nextToken', 'listTagsForResource_nextToken' - The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. -- -- 'instanceArn', 'listTagsForResource_instanceArn' - The ARN of the IAM Identity Center instance under which the operation -- will be executed. For more information about ARNs, see -- -- in the /AWS General Reference/. -- -- 'resourceArn', 'listTagsForResource_resourceArn' - The ARN of the resource with the tags to be listed. newListTagsForResource :: -- | 'instanceArn' Prelude.Text -> -- | 'resourceArn' Prelude.Text -> ListTagsForResource newListTagsForResource pInstanceArn_ pResourceArn_ = ListTagsForResource' { nextToken = Prelude.Nothing, instanceArn = pInstanceArn_, resourceArn = pResourceArn_ } -- | The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. listTagsForResource_nextToken :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Text) listTagsForResource_nextToken = Lens.lens (\ListTagsForResource' {nextToken} -> nextToken) (\s@ListTagsForResource' {} a -> s {nextToken = a} :: ListTagsForResource) -- | The ARN of the IAM Identity Center instance under which the operation -- will be executed. For more information about ARNs, see -- -- in the /AWS General Reference/. listTagsForResource_instanceArn :: Lens.Lens' ListTagsForResource Prelude.Text listTagsForResource_instanceArn = Lens.lens (\ListTagsForResource' {instanceArn} -> instanceArn) (\s@ListTagsForResource' {} a -> s {instanceArn = a} :: ListTagsForResource) -- | The ARN of the resource with the tags to be listed. listTagsForResource_resourceArn :: Lens.Lens' ListTagsForResource Prelude.Text listTagsForResource_resourceArn = Lens.lens (\ListTagsForResource' {resourceArn} -> resourceArn) (\s@ListTagsForResource' {} a -> s {resourceArn = a} :: ListTagsForResource) instance Core.AWSPager ListTagsForResource where page rq rs | Core.stop ( rs Lens.^? listTagsForResourceResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listTagsForResourceResponse_tags Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listTagsForResource_nextToken Lens..~ rs Lens.^? listTagsForResourceResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListTagsForResource where type AWSResponse ListTagsForResource = ListTagsForResourceResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListTagsForResourceResponse' Prelude.<$> (x Data..?> "NextToken") Prelude.<*> (x Data..?> "Tags" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListTagsForResource where hashWithSalt _salt ListTagsForResource' {..} = _salt `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` instanceArn `Prelude.hashWithSalt` resourceArn instance Prelude.NFData ListTagsForResource where rnf ListTagsForResource' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf instanceArn `Prelude.seq` Prelude.rnf resourceArn instance Data.ToHeaders ListTagsForResource where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "SWBExternalService.ListTagsForResource" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListTagsForResource where toJSON ListTagsForResource' {..} = Data.object ( Prelude.catMaybes [ ("NextToken" Data..=) Prelude.<$> nextToken, Prelude.Just ("InstanceArn" Data..= instanceArn), Prelude.Just ("ResourceArn" Data..= resourceArn) ] ) instance Data.ToPath ListTagsForResource where toPath = Prelude.const "/" instance Data.ToQuery ListTagsForResource where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListTagsForResourceResponse' smart constructor. data ListTagsForResourceResponse = ListTagsForResourceResponse' { -- | The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. nextToken :: Prelude.Maybe Prelude.Text, -- | A set of key-value pairs that are used to manage the resource. tags :: Prelude.Maybe [Tag], -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListTagsForResourceResponse' 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: -- -- 'nextToken', 'listTagsForResourceResponse_nextToken' - The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. -- -- 'tags', 'listTagsForResourceResponse_tags' - A set of key-value pairs that are used to manage the resource. -- -- 'httpStatus', 'listTagsForResourceResponse_httpStatus' - The response's http status code. newListTagsForResourceResponse :: -- | 'httpStatus' Prelude.Int -> ListTagsForResourceResponse newListTagsForResourceResponse pHttpStatus_ = ListTagsForResourceResponse' { nextToken = Prelude.Nothing, tags = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The pagination token for the list API. Initially the value is null. Use -- the output of previous API calls to make subsequent calls. listTagsForResourceResponse_nextToken :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe Prelude.Text) listTagsForResourceResponse_nextToken = Lens.lens (\ListTagsForResourceResponse' {nextToken} -> nextToken) (\s@ListTagsForResourceResponse' {} a -> s {nextToken = a} :: ListTagsForResourceResponse) -- | A set of key-value pairs that are used to manage the resource. listTagsForResourceResponse_tags :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe [Tag]) listTagsForResourceResponse_tags = Lens.lens (\ListTagsForResourceResponse' {tags} -> tags) (\s@ListTagsForResourceResponse' {} a -> s {tags = a} :: ListTagsForResourceResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listTagsForResourceResponse_httpStatus :: Lens.Lens' ListTagsForResourceResponse Prelude.Int listTagsForResourceResponse_httpStatus = Lens.lens (\ListTagsForResourceResponse' {httpStatus} -> httpStatus) (\s@ListTagsForResourceResponse' {} a -> s {httpStatus = a} :: ListTagsForResourceResponse) instance Prelude.NFData ListTagsForResourceResponse where rnf ListTagsForResourceResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf httpStatus