{-# 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.AppMesh.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) -- -- List the tags for an App Mesh resource. -- -- This operation returns paginated results. module Amazonka.AppMesh.ListTagsForResource ( -- * Creating a Request ListTagsForResource (..), newListTagsForResource, -- * Request Lenses listTagsForResource_limit, listTagsForResource_nextToken, listTagsForResource_resourceArn, -- * Destructuring the Response ListTagsForResourceResponse (..), newListTagsForResourceResponse, -- * Response Lenses listTagsForResourceResponse_nextToken, listTagsForResourceResponse_httpStatus, listTagsForResourceResponse_tags, ) where import Amazonka.AppMesh.Types 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 -- | -- -- /See:/ 'newListTagsForResource' smart constructor. data ListTagsForResource = ListTagsForResource' { -- | The maximum number of tag results returned by @ListTagsForResource@ in -- paginated output. When this parameter is used, @ListTagsForResource@ -- returns only @limit@ results in a single page along with a @nextToken@ -- response element. You can see the remaining results of the initial -- request by sending another @ListTagsForResource@ request with the -- returned @nextToken@ value. This value can be between 1 and 100. If you -- don\'t use this parameter, @ListTagsForResource@ returns up to 100 -- results and a @nextToken@ value if applicable. limit :: Prelude.Maybe Prelude.Natural, -- | The @nextToken@ value returned from a previous paginated -- @ListTagsForResource@ request where @limit@ was used and the results -- exceeded the value of that parameter. Pagination continues from the end -- of the previous results that returned the @nextToken@ value. nextToken :: Prelude.Maybe Prelude.Text, -- | The Amazon Resource Name (ARN) that identifies the resource to list the -- tags for. 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: -- -- 'limit', 'listTagsForResource_limit' - The maximum number of tag results returned by @ListTagsForResource@ in -- paginated output. When this parameter is used, @ListTagsForResource@ -- returns only @limit@ results in a single page along with a @nextToken@ -- response element. You can see the remaining results of the initial -- request by sending another @ListTagsForResource@ request with the -- returned @nextToken@ value. This value can be between 1 and 100. If you -- don\'t use this parameter, @ListTagsForResource@ returns up to 100 -- results and a @nextToken@ value if applicable. -- -- 'nextToken', 'listTagsForResource_nextToken' - The @nextToken@ value returned from a previous paginated -- @ListTagsForResource@ request where @limit@ was used and the results -- exceeded the value of that parameter. Pagination continues from the end -- of the previous results that returned the @nextToken@ value. -- -- 'resourceArn', 'listTagsForResource_resourceArn' - The Amazon Resource Name (ARN) that identifies the resource to list the -- tags for. newListTagsForResource :: -- | 'resourceArn' Prelude.Text -> ListTagsForResource newListTagsForResource pResourceArn_ = ListTagsForResource' { limit = Prelude.Nothing, nextToken = Prelude.Nothing, resourceArn = pResourceArn_ } -- | The maximum number of tag results returned by @ListTagsForResource@ in -- paginated output. When this parameter is used, @ListTagsForResource@ -- returns only @limit@ results in a single page along with a @nextToken@ -- response element. You can see the remaining results of the initial -- request by sending another @ListTagsForResource@ request with the -- returned @nextToken@ value. This value can be between 1 and 100. If you -- don\'t use this parameter, @ListTagsForResource@ returns up to 100 -- results and a @nextToken@ value if applicable. listTagsForResource_limit :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Natural) listTagsForResource_limit = Lens.lens (\ListTagsForResource' {limit} -> limit) (\s@ListTagsForResource' {} a -> s {limit = a} :: ListTagsForResource) -- | The @nextToken@ value returned from a previous paginated -- @ListTagsForResource@ request where @limit@ was used and the results -- exceeded the value of that parameter. Pagination continues from the end -- of the previous results that returned the @nextToken@ value. listTagsForResource_nextToken :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Text) listTagsForResource_nextToken = Lens.lens (\ListTagsForResource' {nextToken} -> nextToken) (\s@ListTagsForResource' {} a -> s {nextToken = a} :: ListTagsForResource) -- | The Amazon Resource Name (ARN) that identifies the resource to list the -- tags for. 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.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.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListTagsForResourceResponse' Prelude.<$> (x Data..?> "nextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) Prelude.<*> (x Data..?> "tags" Core..!@ Prelude.mempty) ) instance Prelude.Hashable ListTagsForResource where hashWithSalt _salt ListTagsForResource' {..} = _salt `Prelude.hashWithSalt` limit `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` resourceArn instance Prelude.NFData ListTagsForResource where rnf ListTagsForResource' {..} = Prelude.rnf limit `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf resourceArn instance Data.ToHeaders ListTagsForResource where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListTagsForResource where toPath = Prelude.const "/v20190125/tags" instance Data.ToQuery ListTagsForResource where toQuery ListTagsForResource' {..} = Prelude.mconcat [ "limit" Data.=: limit, "nextToken" Data.=: nextToken, "resourceArn" Data.=: resourceArn ] -- | -- -- /See:/ 'newListTagsForResourceResponse' smart constructor. data ListTagsForResourceResponse = ListTagsForResourceResponse' { -- | The @nextToken@ value to include in a future @ListTagsForResource@ -- request. When the results of a @ListTagsForResource@ request exceed -- @limit@, you can use this value to retrieve the next page of results. -- This value is @null@ when there are no more results to return. nextToken :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int, -- | The tags for the resource. tags :: [TagRef] } 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 @nextToken@ value to include in a future @ListTagsForResource@ -- request. When the results of a @ListTagsForResource@ request exceed -- @limit@, you can use this value to retrieve the next page of results. -- This value is @null@ when there are no more results to return. -- -- 'httpStatus', 'listTagsForResourceResponse_httpStatus' - The response's http status code. -- -- 'tags', 'listTagsForResourceResponse_tags' - The tags for the resource. newListTagsForResourceResponse :: -- | 'httpStatus' Prelude.Int -> ListTagsForResourceResponse newListTagsForResourceResponse pHttpStatus_ = ListTagsForResourceResponse' { nextToken = Prelude.Nothing, httpStatus = pHttpStatus_, tags = Prelude.mempty } -- | The @nextToken@ value to include in a future @ListTagsForResource@ -- request. When the results of a @ListTagsForResource@ request exceed -- @limit@, you can use this value to retrieve the next page of results. -- This value is @null@ when there are no more results to return. listTagsForResourceResponse_nextToken :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe Prelude.Text) listTagsForResourceResponse_nextToken = Lens.lens (\ListTagsForResourceResponse' {nextToken} -> nextToken) (\s@ListTagsForResourceResponse' {} a -> s {nextToken = a} :: ListTagsForResourceResponse) -- | 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) -- | The tags for the resource. listTagsForResourceResponse_tags :: Lens.Lens' ListTagsForResourceResponse [TagRef] listTagsForResourceResponse_tags = Lens.lens (\ListTagsForResourceResponse' {tags} -> tags) (\s@ListTagsForResourceResponse' {} a -> s {tags = a} :: ListTagsForResourceResponse) Prelude.. Lens.coerced instance Prelude.NFData ListTagsForResourceResponse where rnf ListTagsForResourceResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus `Prelude.seq` Prelude.rnf tags