{-# 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.NetworkFirewall.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) -- -- Retrieves the tags associated with the specified resource. Tags are -- key:value pairs that you can use to categorize and manage your -- resources, for purposes like billing. For example, you might set the tag -- key to \"customer\" and the value to the customer name or ID. You can -- specify one or more tags to add to each Amazon Web Services resource, up -- to 50 tags for a resource. -- -- You can tag the Amazon Web Services resources that you manage through -- Network Firewall: firewalls, firewall policies, and rule groups. -- -- This operation returns paginated results. module Amazonka.NetworkFirewall.ListTagsForResource ( -- * Creating a Request ListTagsForResource (..), newListTagsForResource, -- * Request Lenses listTagsForResource_maxResults, listTagsForResource_nextToken, 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 Amazonka.NetworkFirewall.Types 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 objects that you want Network Firewall to return -- for this request. If more objects are available, in the response, -- Network Firewall provides a @NextToken@ value that you can use in a -- subsequent call to get the next batch of objects. maxResults :: Prelude.Maybe Prelude.Natural, -- | When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. nextToken :: Prelude.Maybe Prelude.Text, -- | The Amazon Resource Name (ARN) of the resource. 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: -- -- 'maxResults', 'listTagsForResource_maxResults' - The maximum number of objects that you want Network Firewall to return -- for this request. If more objects are available, in the response, -- Network Firewall provides a @NextToken@ value that you can use in a -- subsequent call to get the next batch of objects. -- -- 'nextToken', 'listTagsForResource_nextToken' - When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. -- -- 'resourceArn', 'listTagsForResource_resourceArn' - The Amazon Resource Name (ARN) of the resource. newListTagsForResource :: -- | 'resourceArn' Prelude.Text -> ListTagsForResource newListTagsForResource pResourceArn_ = ListTagsForResource' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, resourceArn = pResourceArn_ } -- | The maximum number of objects that you want Network Firewall to return -- for this request. If more objects are available, in the response, -- Network Firewall provides a @NextToken@ value that you can use in a -- subsequent call to get the next batch of objects. listTagsForResource_maxResults :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Natural) listTagsForResource_maxResults = Lens.lens (\ListTagsForResource' {maxResults} -> maxResults) (\s@ListTagsForResource' {} a -> s {maxResults = a} :: ListTagsForResource) -- | When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. 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) of the resource. 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.. Lens.to Prelude.toList ) = 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") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListTagsForResource where hashWithSalt _salt ListTagsForResource' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` resourceArn instance Prelude.NFData ListTagsForResource where rnf ListTagsForResource' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf resourceArn instance Data.ToHeaders ListTagsForResource where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "NetworkFirewall_20201112.ListTagsForResource" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.0" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListTagsForResource where toJSON ListTagsForResource' {..} = Data.object ( Prelude.catMaybes [ ("MaxResults" Data..=) Prelude.<$> maxResults, ("NextToken" Data..=) Prelude.<$> nextToken, 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' { -- | When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. nextToken :: Prelude.Maybe Prelude.Text, -- | The tags that are associated with the resource. tags :: Prelude.Maybe (Prelude.NonEmpty 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' - When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. -- -- 'tags', 'listTagsForResourceResponse_tags' - The tags that are associated with 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_ } -- | When you request a list of objects with a @MaxResults@ setting, if the -- number of objects that are still available for retrieval exceeds the -- maximum you requested, Network Firewall returns a @NextToken@ value in -- the response. To retrieve the next batch of objects, use the token -- returned from the prior request in your next request. listTagsForResourceResponse_nextToken :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe Prelude.Text) listTagsForResourceResponse_nextToken = Lens.lens (\ListTagsForResourceResponse' {nextToken} -> nextToken) (\s@ListTagsForResourceResponse' {} a -> s {nextToken = a} :: ListTagsForResourceResponse) -- | The tags that are associated with the resource. listTagsForResourceResponse_tags :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe (Prelude.NonEmpty 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