{-# 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.CostExplorer.GetTags
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Queries for available tag keys and tag values for a specified period.
-- You can search the tag values for an arbitrary string.
module Amazonka.CostExplorer.GetTags
  ( -- * Creating a Request
    GetTags (..),
    newGetTags,

    -- * Request Lenses
    getTags_nextPageToken,
    getTags_searchString,
    getTags_tagKey,
    getTags_filter,
    getTags_maxResults,
    getTags_sortBy,
    getTags_timePeriod,

    -- * Destructuring the Response
    GetTagsResponse (..),
    newGetTagsResponse,

    -- * Response Lenses
    getTagsResponse_nextPageToken,
    getTagsResponse_httpStatus,
    getTagsResponse_tags,
    getTagsResponse_returnSize,
    getTagsResponse_totalSize,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetTags' smart constructor.
data GetTags = GetTags'
  { -- | The token to retrieve the next set of results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetTags -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The value that you want to search for.
    GetTags -> Maybe Text
searchString :: Prelude.Maybe Prelude.Text,
    -- | The key of the tag that you want to return values for.
    GetTags -> Maybe Text
tagKey :: Prelude.Maybe Prelude.Text,
    GetTags -> Maybe Expression
filter' :: Prelude.Maybe Expression,
    -- | This field is only used when SortBy is provided in the request. The
    -- maximum number of objects that to be returned for this request. If
    -- MaxResults is not specified with SortBy, the request will return 1000
    -- results as the default value for this parameter.
    --
    -- For @GetTags@, MaxResults has an upper limit of 1000.
    GetTags -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The value by which you want to sort the data.
    --
    -- The key represents cost and usage metrics. The following values are
    -- supported:
    --
    -- -   @BlendedCost@
    --
    -- -   @UnblendedCost@
    --
    -- -   @AmortizedCost@
    --
    -- -   @NetAmortizedCost@
    --
    -- -   @NetUnblendedCost@
    --
    -- -   @UsageQuantity@
    --
    -- -   @NormalizedUsageAmount@
    --
    -- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
    --
    -- When using @SortBy@, @NextPageToken@ and @SearchString@ are not
    -- supported.
    GetTags -> Maybe [SortDefinition]
sortBy :: Prelude.Maybe [SortDefinition],
    -- | The start and end dates for retrieving the dimension values. The start
    -- date is inclusive, but the end date is exclusive. For example, if
    -- @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the cost and
    -- usage data is retrieved from @2017-01-01@ up to and including
    -- @2017-04-30@ but not including @2017-05-01@.
    GetTags -> DateInterval
timePeriod :: DateInterval
  }
  deriving (GetTags -> GetTags -> Bool
(GetTags -> GetTags -> Bool)
-> (GetTags -> GetTags -> Bool) -> Eq GetTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTags -> GetTags -> Bool
$c/= :: GetTags -> GetTags -> Bool
== :: GetTags -> GetTags -> Bool
$c== :: GetTags -> GetTags -> Bool
Prelude.Eq, ReadPrec [GetTags]
ReadPrec GetTags
Int -> ReadS GetTags
ReadS [GetTags]
(Int -> ReadS GetTags)
-> ReadS [GetTags]
-> ReadPrec GetTags
-> ReadPrec [GetTags]
-> Read GetTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTags]
$creadListPrec :: ReadPrec [GetTags]
readPrec :: ReadPrec GetTags
$creadPrec :: ReadPrec GetTags
readList :: ReadS [GetTags]
$creadList :: ReadS [GetTags]
readsPrec :: Int -> ReadS GetTags
$creadsPrec :: Int -> ReadS GetTags
Prelude.Read, Int -> GetTags -> ShowS
[GetTags] -> ShowS
GetTags -> String
(Int -> GetTags -> ShowS)
-> (GetTags -> String) -> ([GetTags] -> ShowS) -> Show GetTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTags] -> ShowS
$cshowList :: [GetTags] -> ShowS
show :: GetTags -> String
$cshow :: GetTags -> String
showsPrec :: Int -> GetTags -> ShowS
$cshowsPrec :: Int -> GetTags -> ShowS
Prelude.Show, (forall x. GetTags -> Rep GetTags x)
-> (forall x. Rep GetTags x -> GetTags) -> Generic GetTags
forall x. Rep GetTags x -> GetTags
forall x. GetTags -> Rep GetTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTags x -> GetTags
$cfrom :: forall x. GetTags -> Rep GetTags x
Prelude.Generic)

-- |
-- Create a value of 'GetTags' 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:
--
-- 'nextPageToken', 'getTags_nextPageToken' - The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'searchString', 'getTags_searchString' - The value that you want to search for.
--
-- 'tagKey', 'getTags_tagKey' - The key of the tag that you want to return values for.
--
-- 'filter'', 'getTags_filter' - Undocumented member.
--
-- 'maxResults', 'getTags_maxResults' - This field is only used when SortBy is provided in the request. The
-- maximum number of objects that to be returned for this request. If
-- MaxResults is not specified with SortBy, the request will return 1000
-- results as the default value for this parameter.
--
-- For @GetTags@, MaxResults has an upper limit of 1000.
--
-- 'sortBy', 'getTags_sortBy' - The value by which you want to sort the data.
--
-- The key represents cost and usage metrics. The following values are
-- supported:
--
-- -   @BlendedCost@
--
-- -   @UnblendedCost@
--
-- -   @AmortizedCost@
--
-- -   @NetAmortizedCost@
--
-- -   @NetUnblendedCost@
--
-- -   @UsageQuantity@
--
-- -   @NormalizedUsageAmount@
--
-- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
--
-- When using @SortBy@, @NextPageToken@ and @SearchString@ are not
-- supported.
--
-- 'timePeriod', 'getTags_timePeriod' - The start and end dates for retrieving the dimension values. The start
-- date is inclusive, but the end date is exclusive. For example, if
-- @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the cost and
-- usage data is retrieved from @2017-01-01@ up to and including
-- @2017-04-30@ but not including @2017-05-01@.
newGetTags ::
  -- | 'timePeriod'
  DateInterval ->
  GetTags
newGetTags :: DateInterval -> GetTags
newGetTags DateInterval
pTimePeriod_ =
  GetTags' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Expression
-> Maybe Natural
-> Maybe [SortDefinition]
-> DateInterval
-> GetTags
GetTags'
    { $sel:nextPageToken:GetTags' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:searchString:GetTags' :: Maybe Text
searchString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tagKey:GetTags' :: Maybe Text
tagKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':GetTags' :: Maybe Expression
filter' = Maybe Expression
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetTags' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:GetTags' :: Maybe [SortDefinition]
sortBy = Maybe [SortDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:timePeriod:GetTags' :: DateInterval
timePeriod = DateInterval
pTimePeriod_
    }

-- | The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getTags_nextPageToken :: Lens.Lens' GetTags (Prelude.Maybe Prelude.Text)
getTags_nextPageToken :: (Maybe Text -> f (Maybe Text)) -> GetTags -> f GetTags
getTags_nextPageToken = (GetTags -> Maybe Text)
-> (GetTags -> Maybe Text -> GetTags)
-> Lens GetTags GetTags (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetTags' :: GetTags -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetTags
s@GetTags' {} Maybe Text
a -> GetTags
s {$sel:nextPageToken:GetTags' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetTags)

-- | The value that you want to search for.
getTags_searchString :: Lens.Lens' GetTags (Prelude.Maybe Prelude.Text)
getTags_searchString :: (Maybe Text -> f (Maybe Text)) -> GetTags -> f GetTags
getTags_searchString = (GetTags -> Maybe Text)
-> (GetTags -> Maybe Text -> GetTags)
-> Lens GetTags GetTags (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe Text
searchString :: Maybe Text
$sel:searchString:GetTags' :: GetTags -> Maybe Text
searchString} -> Maybe Text
searchString) (\s :: GetTags
s@GetTags' {} Maybe Text
a -> GetTags
s {$sel:searchString:GetTags' :: Maybe Text
searchString = Maybe Text
a} :: GetTags)

-- | The key of the tag that you want to return values for.
getTags_tagKey :: Lens.Lens' GetTags (Prelude.Maybe Prelude.Text)
getTags_tagKey :: (Maybe Text -> f (Maybe Text)) -> GetTags -> f GetTags
getTags_tagKey = (GetTags -> Maybe Text)
-> (GetTags -> Maybe Text -> GetTags)
-> Lens GetTags GetTags (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:GetTags' :: GetTags -> Maybe Text
tagKey} -> Maybe Text
tagKey) (\s :: GetTags
s@GetTags' {} Maybe Text
a -> GetTags
s {$sel:tagKey:GetTags' :: Maybe Text
tagKey = Maybe Text
a} :: GetTags)

-- | Undocumented member.
getTags_filter :: Lens.Lens' GetTags (Prelude.Maybe Expression)
getTags_filter :: (Maybe Expression -> f (Maybe Expression)) -> GetTags -> f GetTags
getTags_filter = (GetTags -> Maybe Expression)
-> (GetTags -> Maybe Expression -> GetTags)
-> Lens GetTags GetTags (Maybe Expression) (Maybe Expression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe Expression
filter' :: Maybe Expression
$sel:filter':GetTags' :: GetTags -> Maybe Expression
filter'} -> Maybe Expression
filter') (\s :: GetTags
s@GetTags' {} Maybe Expression
a -> GetTags
s {$sel:filter':GetTags' :: Maybe Expression
filter' = Maybe Expression
a} :: GetTags)

-- | This field is only used when SortBy is provided in the request. The
-- maximum number of objects that to be returned for this request. If
-- MaxResults is not specified with SortBy, the request will return 1000
-- results as the default value for this parameter.
--
-- For @GetTags@, MaxResults has an upper limit of 1000.
getTags_maxResults :: Lens.Lens' GetTags (Prelude.Maybe Prelude.Natural)
getTags_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> GetTags -> f GetTags
getTags_maxResults = (GetTags -> Maybe Natural)
-> (GetTags -> Maybe Natural -> GetTags)
-> Lens GetTags GetTags (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetTags' :: GetTags -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetTags
s@GetTags' {} Maybe Natural
a -> GetTags
s {$sel:maxResults:GetTags' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetTags)

-- | The value by which you want to sort the data.
--
-- The key represents cost and usage metrics. The following values are
-- supported:
--
-- -   @BlendedCost@
--
-- -   @UnblendedCost@
--
-- -   @AmortizedCost@
--
-- -   @NetAmortizedCost@
--
-- -   @NetUnblendedCost@
--
-- -   @UsageQuantity@
--
-- -   @NormalizedUsageAmount@
--
-- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
--
-- When using @SortBy@, @NextPageToken@ and @SearchString@ are not
-- supported.
getTags_sortBy :: Lens.Lens' GetTags (Prelude.Maybe [SortDefinition])
getTags_sortBy :: (Maybe [SortDefinition] -> f (Maybe [SortDefinition]))
-> GetTags -> f GetTags
getTags_sortBy = (GetTags -> Maybe [SortDefinition])
-> (GetTags -> Maybe [SortDefinition] -> GetTags)
-> Lens
     GetTags GetTags (Maybe [SortDefinition]) (Maybe [SortDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {Maybe [SortDefinition]
sortBy :: Maybe [SortDefinition]
$sel:sortBy:GetTags' :: GetTags -> Maybe [SortDefinition]
sortBy} -> Maybe [SortDefinition]
sortBy) (\s :: GetTags
s@GetTags' {} Maybe [SortDefinition]
a -> GetTags
s {$sel:sortBy:GetTags' :: Maybe [SortDefinition]
sortBy = Maybe [SortDefinition]
a} :: GetTags) ((Maybe [SortDefinition] -> f (Maybe [SortDefinition]))
 -> GetTags -> f GetTags)
-> ((Maybe [SortDefinition] -> f (Maybe [SortDefinition]))
    -> Maybe [SortDefinition] -> f (Maybe [SortDefinition]))
-> (Maybe [SortDefinition] -> f (Maybe [SortDefinition]))
-> GetTags
-> f GetTags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SortDefinition] [SortDefinition] [SortDefinition] [SortDefinition]
-> Iso
     (Maybe [SortDefinition])
     (Maybe [SortDefinition])
     (Maybe [SortDefinition])
     (Maybe [SortDefinition])
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 AnIso
  [SortDefinition] [SortDefinition] [SortDefinition] [SortDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The start and end dates for retrieving the dimension values. The start
-- date is inclusive, but the end date is exclusive. For example, if
-- @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the cost and
-- usage data is retrieved from @2017-01-01@ up to and including
-- @2017-04-30@ but not including @2017-05-01@.
getTags_timePeriod :: Lens.Lens' GetTags DateInterval
getTags_timePeriod :: (DateInterval -> f DateInterval) -> GetTags -> f GetTags
getTags_timePeriod = (GetTags -> DateInterval)
-> (GetTags -> DateInterval -> GetTags)
-> Lens GetTags GetTags DateInterval DateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTags' {DateInterval
timePeriod :: DateInterval
$sel:timePeriod:GetTags' :: GetTags -> DateInterval
timePeriod} -> DateInterval
timePeriod) (\s :: GetTags
s@GetTags' {} DateInterval
a -> GetTags
s {$sel:timePeriod:GetTags' :: DateInterval
timePeriod = DateInterval
a} :: GetTags)

instance Core.AWSRequest GetTags where
  type AWSResponse GetTags = GetTagsResponse
  request :: GetTags -> Request GetTags
request = Service -> GetTags -> Request GetTags
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTags)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetTags))
-> Logger
-> Service
-> Proxy GetTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTags)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> [Text] -> Int -> Int -> GetTagsResponse
GetTagsResponse'
            (Maybe Text -> Int -> [Text] -> Int -> Int -> GetTagsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> Int -> Int -> GetTagsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextPageToken")
            Either String (Int -> [Text] -> Int -> Int -> GetTagsResponse)
-> Either String Int
-> Either String ([Text] -> Int -> Int -> GetTagsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String ([Text] -> Int -> Int -> GetTagsResponse)
-> Either String [Text]
-> Either String (Int -> Int -> GetTagsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Tags" Either String (Maybe [Text]) -> [Text] -> Either String [Text]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> Int -> GetTagsResponse)
-> Either String Int -> Either String (Int -> GetTagsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Int
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ReturnSize")
            Either String (Int -> GetTagsResponse)
-> Either String Int -> Either String GetTagsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Int
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"TotalSize")
      )

instance Prelude.Hashable GetTags

instance Prelude.NFData GetTags

instance Core.ToHeaders GetTags where
  toHeaders :: GetTags -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetTags -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSInsightsIndexService.GetTags" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetTags where
  toJSON :: GetTags -> Value
toJSON GetTags' {Maybe Natural
Maybe [SortDefinition]
Maybe Text
Maybe Expression
DateInterval
timePeriod :: DateInterval
sortBy :: Maybe [SortDefinition]
maxResults :: Maybe Natural
filter' :: Maybe Expression
tagKey :: Maybe Text
searchString :: Maybe Text
nextPageToken :: Maybe Text
$sel:timePeriod:GetTags' :: GetTags -> DateInterval
$sel:sortBy:GetTags' :: GetTags -> Maybe [SortDefinition]
$sel:maxResults:GetTags' :: GetTags -> Maybe Natural
$sel:filter':GetTags' :: GetTags -> Maybe Expression
$sel:tagKey:GetTags' :: GetTags -> Maybe Text
$sel:searchString:GetTags' :: GetTags -> Maybe Text
$sel:nextPageToken:GetTags' :: GetTags -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextPageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextPageToken,
            (Text
"SearchString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
searchString,
            (Text
"TagKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
tagKey,
            (Text
"Filter" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Expression -> Pair) -> Maybe Expression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Expression
filter',
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"SortBy" Text -> [SortDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SortDefinition] -> Pair) -> Maybe [SortDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SortDefinition]
sortBy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimePeriod" Text -> DateInterval -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DateInterval
timePeriod)
          ]
      )

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

instance Core.ToQuery GetTags where
  toQuery :: GetTags -> QueryString
toQuery = QueryString -> GetTags -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetTagsResponse' smart constructor.
data GetTagsResponse = GetTagsResponse'
  { -- | The token for the next set of retrievable results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetTagsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetTagsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The tags that match your request.
    GetTagsResponse -> [Text]
tags :: [Prelude.Text],
    -- | The number of query results that Amazon Web Services returns at a time.
    GetTagsResponse -> Int
returnSize :: Prelude.Int,
    -- | The total number of query results.
    GetTagsResponse -> Int
totalSize :: Prelude.Int
  }
  deriving (GetTagsResponse -> GetTagsResponse -> Bool
(GetTagsResponse -> GetTagsResponse -> Bool)
-> (GetTagsResponse -> GetTagsResponse -> Bool)
-> Eq GetTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTagsResponse -> GetTagsResponse -> Bool
$c/= :: GetTagsResponse -> GetTagsResponse -> Bool
== :: GetTagsResponse -> GetTagsResponse -> Bool
$c== :: GetTagsResponse -> GetTagsResponse -> Bool
Prelude.Eq, ReadPrec [GetTagsResponse]
ReadPrec GetTagsResponse
Int -> ReadS GetTagsResponse
ReadS [GetTagsResponse]
(Int -> ReadS GetTagsResponse)
-> ReadS [GetTagsResponse]
-> ReadPrec GetTagsResponse
-> ReadPrec [GetTagsResponse]
-> Read GetTagsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTagsResponse]
$creadListPrec :: ReadPrec [GetTagsResponse]
readPrec :: ReadPrec GetTagsResponse
$creadPrec :: ReadPrec GetTagsResponse
readList :: ReadS [GetTagsResponse]
$creadList :: ReadS [GetTagsResponse]
readsPrec :: Int -> ReadS GetTagsResponse
$creadsPrec :: Int -> ReadS GetTagsResponse
Prelude.Read, Int -> GetTagsResponse -> ShowS
[GetTagsResponse] -> ShowS
GetTagsResponse -> String
(Int -> GetTagsResponse -> ShowS)
-> (GetTagsResponse -> String)
-> ([GetTagsResponse] -> ShowS)
-> Show GetTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTagsResponse] -> ShowS
$cshowList :: [GetTagsResponse] -> ShowS
show :: GetTagsResponse -> String
$cshow :: GetTagsResponse -> String
showsPrec :: Int -> GetTagsResponse -> ShowS
$cshowsPrec :: Int -> GetTagsResponse -> ShowS
Prelude.Show, (forall x. GetTagsResponse -> Rep GetTagsResponse x)
-> (forall x. Rep GetTagsResponse x -> GetTagsResponse)
-> Generic GetTagsResponse
forall x. Rep GetTagsResponse x -> GetTagsResponse
forall x. GetTagsResponse -> Rep GetTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTagsResponse x -> GetTagsResponse
$cfrom :: forall x. GetTagsResponse -> Rep GetTagsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetTagsResponse' 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:
--
-- 'nextPageToken', 'getTagsResponse_nextPageToken' - The token for the next set of retrievable results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'httpStatus', 'getTagsResponse_httpStatus' - The response's http status code.
--
-- 'tags', 'getTagsResponse_tags' - The tags that match your request.
--
-- 'returnSize', 'getTagsResponse_returnSize' - The number of query results that Amazon Web Services returns at a time.
--
-- 'totalSize', 'getTagsResponse_totalSize' - The total number of query results.
newGetTagsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'returnSize'
  Prelude.Int ->
  -- | 'totalSize'
  Prelude.Int ->
  GetTagsResponse
newGetTagsResponse :: Int -> Int -> Int -> GetTagsResponse
newGetTagsResponse
  Int
pHttpStatus_
  Int
pReturnSize_
  Int
pTotalSize_ =
    GetTagsResponse' :: Maybe Text -> Int -> [Text] -> Int -> Int -> GetTagsResponse
GetTagsResponse'
      { $sel:nextPageToken:GetTagsResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetTagsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:tags:GetTagsResponse' :: [Text]
tags = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:returnSize:GetTagsResponse' :: Int
returnSize = Int
pReturnSize_,
        $sel:totalSize:GetTagsResponse' :: Int
totalSize = Int
pTotalSize_
      }

-- | The token for the next set of retrievable results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getTagsResponse_nextPageToken :: Lens.Lens' GetTagsResponse (Prelude.Maybe Prelude.Text)
getTagsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetTagsResponse -> f GetTagsResponse
getTagsResponse_nextPageToken = (GetTagsResponse -> Maybe Text)
-> (GetTagsResponse -> Maybe Text -> GetTagsResponse)
-> Lens GetTagsResponse GetTagsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetTagsResponse' :: GetTagsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetTagsResponse
s@GetTagsResponse' {} Maybe Text
a -> GetTagsResponse
s {$sel:nextPageToken:GetTagsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetTagsResponse)

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

-- | The tags that match your request.
getTagsResponse_tags :: Lens.Lens' GetTagsResponse [Prelude.Text]
getTagsResponse_tags :: ([Text] -> f [Text]) -> GetTagsResponse -> f GetTagsResponse
getTagsResponse_tags = (GetTagsResponse -> [Text])
-> (GetTagsResponse -> [Text] -> GetTagsResponse)
-> Lens GetTagsResponse GetTagsResponse [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagsResponse' {[Text]
tags :: [Text]
$sel:tags:GetTagsResponse' :: GetTagsResponse -> [Text]
tags} -> [Text]
tags) (\s :: GetTagsResponse
s@GetTagsResponse' {} [Text]
a -> GetTagsResponse
s {$sel:tags:GetTagsResponse' :: [Text]
tags = [Text]
a} :: GetTagsResponse) (([Text] -> f [Text]) -> GetTagsResponse -> f GetTagsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetTagsResponse
-> f GetTagsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of query results that Amazon Web Services returns at a time.
getTagsResponse_returnSize :: Lens.Lens' GetTagsResponse Prelude.Int
getTagsResponse_returnSize :: (Int -> f Int) -> GetTagsResponse -> f GetTagsResponse
getTagsResponse_returnSize = (GetTagsResponse -> Int)
-> (GetTagsResponse -> Int -> GetTagsResponse)
-> Lens GetTagsResponse GetTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagsResponse' {Int
returnSize :: Int
$sel:returnSize:GetTagsResponse' :: GetTagsResponse -> Int
returnSize} -> Int
returnSize) (\s :: GetTagsResponse
s@GetTagsResponse' {} Int
a -> GetTagsResponse
s {$sel:returnSize:GetTagsResponse' :: Int
returnSize = Int
a} :: GetTagsResponse)

-- | The total number of query results.
getTagsResponse_totalSize :: Lens.Lens' GetTagsResponse Prelude.Int
getTagsResponse_totalSize :: (Int -> f Int) -> GetTagsResponse -> f GetTagsResponse
getTagsResponse_totalSize = (GetTagsResponse -> Int)
-> (GetTagsResponse -> Int -> GetTagsResponse)
-> Lens GetTagsResponse GetTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagsResponse' {Int
totalSize :: Int
$sel:totalSize:GetTagsResponse' :: GetTagsResponse -> Int
totalSize} -> Int
totalSize) (\s :: GetTagsResponse
s@GetTagsResponse' {} Int
a -> GetTagsResponse
s {$sel:totalSize:GetTagsResponse' :: Int
totalSize = Int
a} :: GetTagsResponse)

instance Prelude.NFData GetTagsResponse