{-# 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.Redshift.DescribeTags
-- 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 tags. You can return tags from a specific resource by
-- specifying an ARN, or you can return all tags for a given type of
-- resource, such as clusters, snapshots, and so on.
--
-- The following are limitations for @DescribeTags@:
--
-- -   You cannot specify an ARN and a resource-type value together in the
--     same request.
--
-- -   You cannot use the @MaxRecords@ and @Marker@ parameters together
--     with the ARN parameter.
--
-- -   The @MaxRecords@ parameter can be a range from 10 to 50 results to
--     return in a request.
--
-- If you specify both tag keys and tag values in the same request, Amazon
-- Redshift returns all resources that match any combination of the
-- specified keys and values. For example, if you have @owner@ and
-- @environment@ for tag keys, and @admin@ and @test@ for tag values, all
-- resources that have any combination of those values are returned.
--
-- If both tag keys and values are omitted from the request, resources are
-- returned regardless of whether they have tag keys or values associated
-- with them.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeTags
  ( -- * Creating a Request
    DescribeTags (..),
    newDescribeTags,

    -- * Request Lenses
    describeTags_marker,
    describeTags_maxRecords,
    describeTags_resourceName,
    describeTags_resourceType,
    describeTags_tagKeys,
    describeTags_tagValues,

    -- * Destructuring the Response
    DescribeTagsResponse (..),
    newDescribeTagsResponse,

    -- * Response Lenses
    describeTagsResponse_marker,
    describeTagsResponse_taggedResources,
    describeTagsResponse_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 Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDescribeTags' smart constructor.
data DescribeTags = DescribeTags'
  { -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- marker value in the @marker@ parameter and retrying the command. If the
    -- @marker@ field is empty, all response records have been retrieved for
    -- the request.
    DescribeTags -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number or response records to return in each call. If the
    -- number of remaining response records exceeds the specified @MaxRecords@
    -- value, a value is returned in a @marker@ field of the response. You can
    -- retrieve the next set of records by retrying the command with the
    -- returned @marker@ value.
    DescribeTags -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) for which you want to describe the tag or
    -- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
    DescribeTags -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
    -- | The type of resource with which you want to view tags. Valid resource
    -- types are:
    --
    -- -   Cluster
    --
    -- -   CIDR\/IP
    --
    -- -   EC2 security group
    --
    -- -   Snapshot
    --
    -- -   Cluster security group
    --
    -- -   Subnet group
    --
    -- -   HSM connection
    --
    -- -   HSM certificate
    --
    -- -   Parameter group
    --
    -- -   Snapshot copy grant
    --
    -- For more information about Amazon Redshift resource types and
    -- constructing ARNs, go to
    -- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-overview.html#redshift-iam-access-control-specify-actions Specifying Policy Elements: Actions, Effects, Resources, and Principals>
    -- in the Amazon Redshift Cluster Management Guide.
    DescribeTags -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | A tag key or keys for which you want to return all matching resources
    -- that are associated with the specified key or keys. For example, suppose
    -- that you have resources tagged with keys called @owner@ and
    -- @environment@. If you specify both of these tag keys in the request,
    -- Amazon Redshift returns a response with all resources that have either
    -- or both of these tag keys associated with them.
    DescribeTags -> Maybe [Text]
tagKeys :: Prelude.Maybe [Prelude.Text],
    -- | A tag value or values for which you want to return all matching
    -- resources that are associated with the specified value or values. For
    -- example, suppose that you have resources tagged with values called
    -- @admin@ and @test@. If you specify both of these tag values in the
    -- request, Amazon Redshift returns a response with all resources that have
    -- either or both of these tag values associated with them.
    DescribeTags -> Maybe [Text]
tagValues :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeTags -> DescribeTags -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTags -> DescribeTags -> Bool
$c/= :: DescribeTags -> DescribeTags -> Bool
== :: DescribeTags -> DescribeTags -> Bool
$c== :: DescribeTags -> DescribeTags -> Bool
Prelude.Eq, ReadPrec [DescribeTags]
ReadPrec DescribeTags
Int -> ReadS DescribeTags
ReadS [DescribeTags]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTags]
$creadListPrec :: ReadPrec [DescribeTags]
readPrec :: ReadPrec DescribeTags
$creadPrec :: ReadPrec DescribeTags
readList :: ReadS [DescribeTags]
$creadList :: ReadS [DescribeTags]
readsPrec :: Int -> ReadS DescribeTags
$creadsPrec :: Int -> ReadS DescribeTags
Prelude.Read, Int -> DescribeTags -> ShowS
[DescribeTags] -> ShowS
DescribeTags -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTags] -> ShowS
$cshowList :: [DescribeTags] -> ShowS
show :: DescribeTags -> String
$cshow :: DescribeTags -> String
showsPrec :: Int -> DescribeTags -> ShowS
$cshowsPrec :: Int -> DescribeTags -> ShowS
Prelude.Show, forall x. Rep DescribeTags x -> DescribeTags
forall x. DescribeTags -> Rep DescribeTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTags x -> DescribeTags
$cfrom :: forall x. DescribeTags -> Rep DescribeTags x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTags' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'marker', 'describeTags_marker' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @marker@ parameter and retrying the command. If the
-- @marker@ field is empty, all response records have been retrieved for
-- the request.
--
-- 'maxRecords', 'describeTags_maxRecords' - The maximum number or response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned @marker@ value.
--
-- 'resourceName', 'describeTags_resourceName' - The Amazon Resource Name (ARN) for which you want to describe the tag or
-- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
--
-- 'resourceType', 'describeTags_resourceType' - The type of resource with which you want to view tags. Valid resource
-- types are:
--
-- -   Cluster
--
-- -   CIDR\/IP
--
-- -   EC2 security group
--
-- -   Snapshot
--
-- -   Cluster security group
--
-- -   Subnet group
--
-- -   HSM connection
--
-- -   HSM certificate
--
-- -   Parameter group
--
-- -   Snapshot copy grant
--
-- For more information about Amazon Redshift resource types and
-- constructing ARNs, go to
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-overview.html#redshift-iam-access-control-specify-actions Specifying Policy Elements: Actions, Effects, Resources, and Principals>
-- in the Amazon Redshift Cluster Management Guide.
--
-- 'tagKeys', 'describeTags_tagKeys' - A tag key or keys for which you want to return all matching resources
-- that are associated with the specified key or keys. For example, suppose
-- that you have resources tagged with keys called @owner@ and
-- @environment@. If you specify both of these tag keys in the request,
-- Amazon Redshift returns a response with all resources that have either
-- or both of these tag keys associated with them.
--
-- 'tagValues', 'describeTags_tagValues' - A tag value or values for which you want to return all matching
-- resources that are associated with the specified value or values. For
-- example, suppose that you have resources tagged with values called
-- @admin@ and @test@. If you specify both of these tag values in the
-- request, Amazon Redshift returns a response with all resources that have
-- either or both of these tag values associated with them.
newDescribeTags ::
  DescribeTags
newDescribeTags :: DescribeTags
newDescribeTags =
  DescribeTags'
    { $sel:marker:DescribeTags' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeTags' :: Maybe Int
maxRecords = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceName:DescribeTags' :: Maybe Text
resourceName = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:DescribeTags' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeys:DescribeTags' :: Maybe [Text]
tagKeys = forall a. Maybe a
Prelude.Nothing,
      $sel:tagValues:DescribeTags' :: Maybe [Text]
tagValues = forall a. Maybe a
Prelude.Nothing
    }

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @marker@ parameter and retrying the command. If the
-- @marker@ field is empty, all response records have been retrieved for
-- the request.
describeTags_marker :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Text)
describeTags_marker :: Lens' DescribeTags (Maybe Text)
describeTags_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeTags' :: DescribeTags -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeTags
s@DescribeTags' {} Maybe Text
a -> DescribeTags
s {$sel:marker:DescribeTags' :: Maybe Text
marker = Maybe Text
a} :: DescribeTags)

-- | The maximum number or response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned @marker@ value.
describeTags_maxRecords :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Int)
describeTags_maxRecords :: Lens' DescribeTags (Maybe Int)
describeTags_maxRecords = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeTags' :: DescribeTags -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeTags
s@DescribeTags' {} Maybe Int
a -> DescribeTags
s {$sel:maxRecords:DescribeTags' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeTags)

-- | The Amazon Resource Name (ARN) for which you want to describe the tag or
-- tags. For example, @arn:aws:redshift:us-east-2:123456789:cluster:t1@.
describeTags_resourceName :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Text)
describeTags_resourceName :: Lens' DescribeTags (Maybe Text)
describeTags_resourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:DescribeTags' :: DescribeTags -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: DescribeTags
s@DescribeTags' {} Maybe Text
a -> DescribeTags
s {$sel:resourceName:DescribeTags' :: Maybe Text
resourceName = Maybe Text
a} :: DescribeTags)

-- | The type of resource with which you want to view tags. Valid resource
-- types are:
--
-- -   Cluster
--
-- -   CIDR\/IP
--
-- -   EC2 security group
--
-- -   Snapshot
--
-- -   Cluster security group
--
-- -   Subnet group
--
-- -   HSM connection
--
-- -   HSM certificate
--
-- -   Parameter group
--
-- -   Snapshot copy grant
--
-- For more information about Amazon Redshift resource types and
-- constructing ARNs, go to
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-overview.html#redshift-iam-access-control-specify-actions Specifying Policy Elements: Actions, Effects, Resources, and Principals>
-- in the Amazon Redshift Cluster Management Guide.
describeTags_resourceType :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Text)
describeTags_resourceType :: Lens' DescribeTags (Maybe Text)
describeTags_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:DescribeTags' :: DescribeTags -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: DescribeTags
s@DescribeTags' {} Maybe Text
a -> DescribeTags
s {$sel:resourceType:DescribeTags' :: Maybe Text
resourceType = Maybe Text
a} :: DescribeTags)

-- | A tag key or keys for which you want to return all matching resources
-- that are associated with the specified key or keys. For example, suppose
-- that you have resources tagged with keys called @owner@ and
-- @environment@. If you specify both of these tag keys in the request,
-- Amazon Redshift returns a response with all resources that have either
-- or both of these tag keys associated with them.
describeTags_tagKeys :: Lens.Lens' DescribeTags (Prelude.Maybe [Prelude.Text])
describeTags_tagKeys :: Lens' DescribeTags (Maybe [Text])
describeTags_tagKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe [Text]
tagKeys :: Maybe [Text]
$sel:tagKeys:DescribeTags' :: DescribeTags -> Maybe [Text]
tagKeys} -> Maybe [Text]
tagKeys) (\s :: DescribeTags
s@DescribeTags' {} Maybe [Text]
a -> DescribeTags
s {$sel:tagKeys:DescribeTags' :: Maybe [Text]
tagKeys = Maybe [Text]
a} :: DescribeTags) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A tag value or values for which you want to return all matching
-- resources that are associated with the specified value or values. For
-- example, suppose that you have resources tagged with values called
-- @admin@ and @test@. If you specify both of these tag values in the
-- request, Amazon Redshift returns a response with all resources that have
-- either or both of these tag values associated with them.
describeTags_tagValues :: Lens.Lens' DescribeTags (Prelude.Maybe [Prelude.Text])
describeTags_tagValues :: Lens' DescribeTags (Maybe [Text])
describeTags_tagValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe [Text]
tagValues :: Maybe [Text]
$sel:tagValues:DescribeTags' :: DescribeTags -> Maybe [Text]
tagValues} -> Maybe [Text]
tagValues) (\s :: DescribeTags
s@DescribeTags' {} Maybe [Text]
a -> DescribeTags
s {$sel:tagValues:DescribeTags' :: Maybe [Text]
tagValues = Maybe [Text]
a} :: DescribeTags) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSPager DescribeTags where
  page :: DescribeTags -> AWSResponse DescribeTags -> Maybe DescribeTags
page DescribeTags
rq AWSResponse DescribeTags
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeTags
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_marker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeTags
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe [TaggedResource])
describeTagsResponse_taggedResources
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeTags
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeTags (Maybe Text)
describeTags_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeTags
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_marker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeTags where
  type AWSResponse DescribeTags = DescribeTagsResponse
  request :: (Service -> Service) -> DescribeTags -> Request DescribeTags
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeTagsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Maybe [TaggedResource] -> Int -> DescribeTagsResponse
DescribeTagsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TaggedResources"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"TaggedResource")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeTags where
  hashWithSalt :: Int -> DescribeTags -> Int
hashWithSalt Int
_salt DescribeTags' {Maybe Int
Maybe [Text]
Maybe Text
tagValues :: Maybe [Text]
tagKeys :: Maybe [Text]
resourceType :: Maybe Text
resourceName :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
$sel:tagValues:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:tagKeys:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:resourceType:DescribeTags' :: DescribeTags -> Maybe Text
$sel:resourceName:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxRecords:DescribeTags' :: DescribeTags -> Maybe Int
$sel:marker:DescribeTags' :: DescribeTags -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxRecords
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tagKeys
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tagValues

instance Prelude.NFData DescribeTags where
  rnf :: DescribeTags -> ()
rnf DescribeTags' {Maybe Int
Maybe [Text]
Maybe Text
tagValues :: Maybe [Text]
tagKeys :: Maybe [Text]
resourceType :: Maybe Text
resourceName :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
$sel:tagValues:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:tagKeys:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:resourceType:DescribeTags' :: DescribeTags -> Maybe Text
$sel:resourceName:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxRecords:DescribeTags' :: DescribeTags -> Maybe Int
$sel:marker:DescribeTags' :: DescribeTags -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxRecords
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tagKeys
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tagValues

instance Data.ToHeaders DescribeTags where
  toHeaders :: DescribeTags -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DescribeTags where
  toPath :: DescribeTags -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DescribeTags where
  toQuery :: DescribeTags -> QueryString
toQuery DescribeTags' {Maybe Int
Maybe [Text]
Maybe Text
tagValues :: Maybe [Text]
tagKeys :: Maybe [Text]
resourceType :: Maybe Text
resourceName :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
$sel:tagValues:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:tagKeys:DescribeTags' :: DescribeTags -> Maybe [Text]
$sel:resourceType:DescribeTags' :: DescribeTags -> Maybe Text
$sel:resourceName:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxRecords:DescribeTags' :: DescribeTags -> Maybe Int
$sel:marker:DescribeTags' :: DescribeTags -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeTags" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"MaxRecords" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxRecords,
        ByteString
"ResourceName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
resourceName,
        ByteString
"ResourceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
resourceType,
        ByteString
"TagKeys"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagKey" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagKeys),
        ByteString
"TagValues"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagValue" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagValues)
      ]

-- |
--
-- /See:/ 'newDescribeTagsResponse' smart constructor.
data DescribeTagsResponse = DescribeTagsResponse'
  { -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- marker value in the @Marker@ parameter and retrying the command. If the
    -- @Marker@ field is empty, all response records have been retrieved for
    -- the request.
    DescribeTagsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of tags with their associated resources.
    DescribeTagsResponse -> Maybe [TaggedResource]
taggedResources :: Prelude.Maybe [TaggedResource],
    -- | The response's http status code.
    DescribeTagsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTagsResponse -> DescribeTagsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
$c/= :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
== :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
$c== :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTagsResponse]
ReadPrec DescribeTagsResponse
Int -> ReadS DescribeTagsResponse
ReadS [DescribeTagsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTagsResponse]
$creadListPrec :: ReadPrec [DescribeTagsResponse]
readPrec :: ReadPrec DescribeTagsResponse
$creadPrec :: ReadPrec DescribeTagsResponse
readList :: ReadS [DescribeTagsResponse]
$creadList :: ReadS [DescribeTagsResponse]
readsPrec :: Int -> ReadS DescribeTagsResponse
$creadsPrec :: Int -> ReadS DescribeTagsResponse
Prelude.Read, Int -> DescribeTagsResponse -> ShowS
[DescribeTagsResponse] -> ShowS
DescribeTagsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTagsResponse] -> ShowS
$cshowList :: [DescribeTagsResponse] -> ShowS
show :: DescribeTagsResponse -> String
$cshow :: DescribeTagsResponse -> String
showsPrec :: Int -> DescribeTagsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTagsResponse -> ShowS
Prelude.Show, forall x. Rep DescribeTagsResponse x -> DescribeTagsResponse
forall x. DescribeTagsResponse -> Rep DescribeTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTagsResponse x -> DescribeTagsResponse
$cfrom :: forall x. DescribeTagsResponse -> Rep DescribeTagsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTagsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'marker', 'describeTagsResponse_marker' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
--
-- 'taggedResources', 'describeTagsResponse_taggedResources' - A list of tags with their associated resources.
--
-- 'httpStatus', 'describeTagsResponse_httpStatus' - The response's http status code.
newDescribeTagsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTagsResponse
newDescribeTagsResponse :: Int -> DescribeTagsResponse
newDescribeTagsResponse Int
pHttpStatus_ =
  DescribeTagsResponse'
    { $sel:marker:DescribeTagsResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:taggedResources:DescribeTagsResponse' :: Maybe [TaggedResource]
taggedResources = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
describeTagsResponse_marker :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe Prelude.Text)
describeTagsResponse_marker :: Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe Text
a -> DescribeTagsResponse
s {$sel:marker:DescribeTagsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeTagsResponse)

-- | A list of tags with their associated resources.
describeTagsResponse_taggedResources :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe [TaggedResource])
describeTagsResponse_taggedResources :: Lens' DescribeTagsResponse (Maybe [TaggedResource])
describeTagsResponse_taggedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe [TaggedResource]
taggedResources :: Maybe [TaggedResource]
$sel:taggedResources:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [TaggedResource]
taggedResources} -> Maybe [TaggedResource]
taggedResources) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe [TaggedResource]
a -> DescribeTagsResponse
s {$sel:taggedResources:DescribeTagsResponse' :: Maybe [TaggedResource]
taggedResources = Maybe [TaggedResource]
a} :: DescribeTagsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
describeTagsResponse_httpStatus :: Lens.Lens' DescribeTagsResponse Prelude.Int
describeTagsResponse_httpStatus :: Lens' DescribeTagsResponse Int
describeTagsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTagsResponse' :: DescribeTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Int
a -> DescribeTagsResponse
s {$sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
a} :: DescribeTagsResponse)

instance Prelude.NFData DescribeTagsResponse where
  rnf :: DescribeTagsResponse -> ()
rnf DescribeTagsResponse' {Int
Maybe [TaggedResource]
Maybe Text
httpStatus :: Int
taggedResources :: Maybe [TaggedResource]
marker :: Maybe Text
$sel:httpStatus:DescribeTagsResponse' :: DescribeTagsResponse -> Int
$sel:taggedResources:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [TaggedResource]
$sel:marker:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TaggedResource]
taggedResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus