{-# 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.WAFV2.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 TagInfoForResource for 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 -- WAF: web ACLs, rule groups, IP sets, and regex pattern sets. You can\'t -- manage or view tags through the WAF console. module Amazonka.WAFV2.ListTagsForResource ( -- * Creating a Request ListTagsForResource (..), newListTagsForResource, -- * Request Lenses listTagsForResource_limit, listTagsForResource_nextMarker, listTagsForResource_resourceARN, -- * Destructuring the Response ListTagsForResourceResponse (..), newListTagsForResourceResponse, -- * Response Lenses listTagsForResourceResponse_nextMarker, listTagsForResourceResponse_tagInfoForResource, 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.WAFV2.Types -- | /See:/ 'newListTagsForResource' smart constructor. data ListTagsForResource = ListTagsForResource' { -- | The maximum number of objects that you want WAF to return for this -- request. If more objects are available, in the response, WAF provides a -- @NextMarker@ value that you can use in a subsequent call to get the next -- batch of objects. limit :: Prelude.Maybe Prelude.Natural, -- | When you request a list of objects with a @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. nextMarker :: 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: -- -- 'limit', 'listTagsForResource_limit' - The maximum number of objects that you want WAF to return for this -- request. If more objects are available, in the response, WAF provides a -- @NextMarker@ value that you can use in a subsequent call to get the next -- batch of objects. -- -- 'nextMarker', 'listTagsForResource_nextMarker' - When you request a list of objects with a @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. -- -- 'resourceARN', 'listTagsForResource_resourceARN' - The Amazon Resource Name (ARN) of the resource. newListTagsForResource :: -- | 'resourceARN' Prelude.Text -> ListTagsForResource newListTagsForResource pResourceARN_ = ListTagsForResource' { limit = Prelude.Nothing, nextMarker = Prelude.Nothing, resourceARN = pResourceARN_ } -- | The maximum number of objects that you want WAF to return for this -- request. If more objects are available, in the response, WAF provides a -- @NextMarker@ value that you can use in a subsequent call to get the next -- batch of objects. listTagsForResource_limit :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Natural) listTagsForResource_limit = Lens.lens (\ListTagsForResource' {limit} -> limit) (\s@ListTagsForResource' {} a -> s {limit = a} :: ListTagsForResource) -- | When you request a list of objects with a @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. listTagsForResource_nextMarker :: Lens.Lens' ListTagsForResource (Prelude.Maybe Prelude.Text) listTagsForResource_nextMarker = Lens.lens (\ListTagsForResource' {nextMarker} -> nextMarker) (\s@ListTagsForResource' {} a -> s {nextMarker = 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.AWSRequest ListTagsForResource where type AWSResponse ListTagsForResource = ListTagsForResourceResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListTagsForResourceResponse' Prelude.<$> (x Data..?> "NextMarker") Prelude.<*> (x Data..?> "TagInfoForResource") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListTagsForResource where hashWithSalt _salt ListTagsForResource' {..} = _salt `Prelude.hashWithSalt` limit `Prelude.hashWithSalt` nextMarker `Prelude.hashWithSalt` resourceARN instance Prelude.NFData ListTagsForResource where rnf ListTagsForResource' {..} = Prelude.rnf limit `Prelude.seq` Prelude.rnf nextMarker `Prelude.seq` Prelude.rnf resourceARN instance Data.ToHeaders ListTagsForResource where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AWSWAF_20190729.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 [ ("Limit" Data..=) Prelude.<$> limit, ("NextMarker" Data..=) Prelude.<$> nextMarker, 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 @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. nextMarker :: Prelude.Maybe Prelude.Text, -- | The collection of tagging definitions for the resource. tagInfoForResource :: Prelude.Maybe TagInfoForResource, -- | 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: -- -- 'nextMarker', 'listTagsForResourceResponse_nextMarker' - When you request a list of objects with a @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. -- -- 'tagInfoForResource', 'listTagsForResourceResponse_tagInfoForResource' - The collection of tagging definitions for the resource. -- -- 'httpStatus', 'listTagsForResourceResponse_httpStatus' - The response's http status code. newListTagsForResourceResponse :: -- | 'httpStatus' Prelude.Int -> ListTagsForResourceResponse newListTagsForResourceResponse pHttpStatus_ = ListTagsForResourceResponse' { nextMarker = Prelude.Nothing, tagInfoForResource = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | When you request a list of objects with a @Limit@ setting, if the number -- of objects that are still available for retrieval exceeds the limit, WAF -- returns a @NextMarker@ value in the response. To retrieve the next batch -- of objects, provide the marker from the prior call in your next request. listTagsForResourceResponse_nextMarker :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe Prelude.Text) listTagsForResourceResponse_nextMarker = Lens.lens (\ListTagsForResourceResponse' {nextMarker} -> nextMarker) (\s@ListTagsForResourceResponse' {} a -> s {nextMarker = a} :: ListTagsForResourceResponse) -- | The collection of tagging definitions for the resource. listTagsForResourceResponse_tagInfoForResource :: Lens.Lens' ListTagsForResourceResponse (Prelude.Maybe TagInfoForResource) listTagsForResourceResponse_tagInfoForResource = Lens.lens (\ListTagsForResourceResponse' {tagInfoForResource} -> tagInfoForResource) (\s@ListTagsForResourceResponse' {} a -> s {tagInfoForResource = 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) instance Prelude.NFData ListTagsForResourceResponse where rnf ListTagsForResourceResponse' {..} = Prelude.rnf nextMarker `Prelude.seq` Prelude.rnf tagInfoForResource `Prelude.seq` Prelude.rnf httpStatus