{-# 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.Backup.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) -- -- Returns a list of key-value pairs assigned to a target recovery point, -- backup plan, or backup vault. -- -- @ListTags@ only works for resource types that support full Backup -- management of their backups. Those resource types are listed in the -- \"Full Backup management\" section of the -- -- table. module Amazonka.Backup.ListTags ( -- * Creating a Request ListTags (..), newListTags, -- * Request Lenses listTags_maxResults, listTags_nextToken, listTags_resourceArn, -- * Destructuring the Response ListTagsResponse (..), newListTagsResponse, -- * Response Lenses listTagsResponse_nextToken, listTagsResponse_tags, listTagsResponse_httpStatus, ) where import Amazonka.Backup.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:/ 'newListTags' smart constructor. data ListTags = ListTags' { -- | The maximum number of items to be returned. maxResults :: Prelude.Maybe Prelude.Natural, -- | The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. nextToken :: Prelude.Maybe Prelude.Text, -- | An Amazon Resource Name (ARN) that uniquely identifies a resource. The -- format of the ARN depends on the type of resource. Valid targets for -- @ListTags@ are recovery points, backup plans, and backup vaults. resourceArn :: 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: -- -- 'maxResults', 'listTags_maxResults' - The maximum number of items to be returned. -- -- 'nextToken', 'listTags_nextToken' - The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. -- -- 'resourceArn', 'listTags_resourceArn' - An Amazon Resource Name (ARN) that uniquely identifies a resource. The -- format of the ARN depends on the type of resource. Valid targets for -- @ListTags@ are recovery points, backup plans, and backup vaults. newListTags :: -- | 'resourceArn' Prelude.Text -> ListTags newListTags pResourceArn_ = ListTags' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, resourceArn = pResourceArn_ } -- | The maximum number of items to be returned. listTags_maxResults :: Lens.Lens' ListTags (Prelude.Maybe Prelude.Natural) listTags_maxResults = Lens.lens (\ListTags' {maxResults} -> maxResults) (\s@ListTags' {} a -> s {maxResults = a} :: ListTags) -- | The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. listTags_nextToken :: Lens.Lens' ListTags (Prelude.Maybe Prelude.Text) listTags_nextToken = Lens.lens (\ListTags' {nextToken} -> nextToken) (\s@ListTags' {} a -> s {nextToken = a} :: ListTags) -- | An Amazon Resource Name (ARN) that uniquely identifies a resource. The -- format of the ARN depends on the type of resource. Valid targets for -- @ListTags@ are recovery points, backup plans, and backup vaults. listTags_resourceArn :: Lens.Lens' ListTags Prelude.Text listTags_resourceArn = Lens.lens (\ListTags' {resourceArn} -> resourceArn) (\s@ListTags' {} a -> s {resourceArn = a} :: ListTags) instance Core.AWSRequest ListTags where type AWSResponse ListTags = ListTagsResponse request overrides = Request.get (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` maxResults `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` resourceArn instance Prelude.NFData ListTags where rnf ListTags' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf resourceArn instance Data.ToHeaders ListTags where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListTags where toPath ListTags' {..} = Prelude.mconcat ["/tags/", Data.toBS resourceArn, "/"] instance Data.ToQuery ListTags where toQuery ListTags' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken ] -- | /See:/ 'newListTagsResponse' smart constructor. data ListTagsResponse = ListTagsResponse' { -- | The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. nextToken :: Prelude.Maybe Prelude.Text, -- | To help organize your resources, you can assign your own metadata to the -- resources you create. Each tag is a key-value pair. tags :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)), -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, 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' - The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. -- -- 'tags', 'listTagsResponse_tags' - To help organize your resources, you can assign your own metadata to the -- resources you create. Each tag is a key-value pair. -- -- '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_ } -- | The next item following a partial list of returned items. For example, -- if a request is made to return @maxResults@ number of items, @NextToken@ -- allows you to return more items in your list starting at the location -- pointed to by the next token. listTagsResponse_nextToken :: Lens.Lens' ListTagsResponse (Prelude.Maybe Prelude.Text) listTagsResponse_nextToken = Lens.lens (\ListTagsResponse' {nextToken} -> nextToken) (\s@ListTagsResponse' {} a -> s {nextToken = a} :: ListTagsResponse) -- | To help organize your resources, you can assign your own metadata to the -- resources you create. Each tag is a key-value pair. listTagsResponse_tags :: Lens.Lens' ListTagsResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)) listTagsResponse_tags = Lens.lens (\ListTagsResponse' {tags} -> tags) (\s@ListTagsResponse' {} a -> s {tags = a} :: ListTagsResponse) Prelude.. Lens.mapping (Data._Sensitive Prelude.. 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