{-# 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.DAX.ListTags -- 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 all of the tags for a DAX cluster. You can call @ListTags@ up to 10 -- times per second, per account. -- -- This operation returns paginated results. module Amazonka.DAX.ListTags ( -- * Creating a Request ListTags (..), newListTags, -- * Request Lenses listTags_nextToken, listTags_resourceName, -- * Destructuring the Response ListTagsResponse (..), newListTagsResponse, -- * Response Lenses listTagsResponse_nextToken, listTagsResponse_tags, listTagsResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import Amazonka.DAX.Types 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:/ 'newListTags' smart constructor. data ListTags = ListTags' { -- | An optional token returned from a prior request. Use this token for -- pagination of results from this action. If this parameter is specified, -- the response includes only results beyond the token. nextToken :: Prelude.Maybe Prelude.Text, -- | The name of the DAX resource to which the tags belong. resourceName :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListTags' 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', 'listTags_nextToken' - An optional token returned from a prior request. Use this token for -- pagination of results from this action. If this parameter is specified, -- the response includes only results beyond the token. -- -- 'resourceName', 'listTags_resourceName' - The name of the DAX resource to which the tags belong. newListTags :: -- | 'resourceName' Prelude.Text -> ListTags newListTags pResourceName_ = ListTags' { nextToken = Prelude.Nothing, resourceName = pResourceName_ } -- | An optional token returned from a prior request. Use this token for -- pagination of results from this action. If this parameter is specified, -- the response includes only results beyond the token. listTags_nextToken :: Lens.Lens' ListTags (Prelude.Maybe Prelude.Text) listTags_nextToken = Lens.lens (\ListTags' {nextToken} -> nextToken) (\s@ListTags' {} a -> s {nextToken = a} :: ListTags) -- | The name of the DAX resource to which the tags belong. listTags_resourceName :: Lens.Lens' ListTags Prelude.Text listTags_resourceName = Lens.lens (\ListTags' {resourceName} -> resourceName) (\s@ListTags' {} a -> s {resourceName = a} :: ListTags) instance Core.AWSPager ListTags where page rq rs | Core.stop ( rs Lens.^? listTagsResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listTagsResponse_tags Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listTags_nextToken Lens..~ rs Lens.^? listTagsResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListTags where type AWSResponse ListTags = ListTagsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListTagsResponse' Prelude.<$> (x Data..?> "NextToken") Prelude.<*> (x Data..?> "Tags" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListTags where hashWithSalt _salt ListTags' {..} = _salt `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` resourceName instance Prelude.NFData ListTags where rnf ListTags' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf resourceName instance Data.ToHeaders ListTags where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ("AmazonDAXV3.ListTags" :: Prelude.ByteString), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListTags where toJSON ListTags' {..} = Data.object ( Prelude.catMaybes [ ("NextToken" Data..=) Prelude.<$> nextToken, Prelude.Just ("ResourceName" Data..= resourceName) ] ) instance Data.ToPath ListTags where toPath = Prelude.const "/" instance Data.ToQuery ListTags where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListTagsResponse' smart constructor. data ListTagsResponse = ListTagsResponse' { -- | If this value is present, there are additional results to be displayed. -- To retrieve them, call @ListTags@ again, with @NextToken@ set to this -- value. nextToken :: Prelude.Maybe Prelude.Text, -- | A list of tags currently associated with the DAX cluster. 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 'ListTagsResponse' 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', 'listTagsResponse_nextToken' - If this value is present, there are additional results to be displayed. -- To retrieve them, call @ListTags@ again, with @NextToken@ set to this -- value. -- -- 'tags', 'listTagsResponse_tags' - A list of tags currently associated with the DAX cluster. -- -- 'httpStatus', 'listTagsResponse_httpStatus' - The response's http status code. newListTagsResponse :: -- | 'httpStatus' Prelude.Int -> ListTagsResponse newListTagsResponse pHttpStatus_ = ListTagsResponse' { nextToken = Prelude.Nothing, tags = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | If this value is present, there are additional results to be displayed. -- To retrieve them, call @ListTags@ again, with @NextToken@ set to this -- value. listTagsResponse_nextToken :: Lens.Lens' ListTagsResponse (Prelude.Maybe Prelude.Text) listTagsResponse_nextToken = Lens.lens (\ListTagsResponse' {nextToken} -> nextToken) (\s@ListTagsResponse' {} a -> s {nextToken = a} :: ListTagsResponse) -- | A list of tags currently associated with the DAX cluster. listTagsResponse_tags :: Lens.Lens' ListTagsResponse (Prelude.Maybe [Tag]) listTagsResponse_tags = Lens.lens (\ListTagsResponse' {tags} -> tags) (\s@ListTagsResponse' {} a -> s {tags = a} :: ListTagsResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listTagsResponse_httpStatus :: Lens.Lens' ListTagsResponse Prelude.Int listTagsResponse_httpStatus = Lens.lens (\ListTagsResponse' {httpStatus} -> httpStatus) (\s@ListTagsResponse' {} a -> s {httpStatus = a} :: ListTagsResponse) instance Prelude.NFData ListTagsResponse where rnf ListTagsResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf httpStatus