{-# 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 #-}
module Amazonka.ResourceGroupsTagging.GetTagValues
(
GetTagValues (..),
newGetTagValues,
getTagValues_paginationToken,
getTagValues_key,
GetTagValuesResponse (..),
newGetTagValuesResponse,
getTagValuesResponse_paginationToken,
getTagValuesResponse_tagValues,
getTagValuesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import Amazonka.ResourceGroupsTagging.Types
import qualified Amazonka.Response as Response
data GetTagValues = GetTagValues'
{
:: Prelude.Maybe Prelude.Text,
GetTagValues -> Text
key :: Prelude.Text
}
deriving (GetTagValues -> GetTagValues -> Bool
(GetTagValues -> GetTagValues -> Bool)
-> (GetTagValues -> GetTagValues -> Bool) -> Eq GetTagValues
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTagValues -> GetTagValues -> Bool
$c/= :: GetTagValues -> GetTagValues -> Bool
== :: GetTagValues -> GetTagValues -> Bool
$c== :: GetTagValues -> GetTagValues -> Bool
Prelude.Eq, ReadPrec [GetTagValues]
ReadPrec GetTagValues
Int -> ReadS GetTagValues
ReadS [GetTagValues]
(Int -> ReadS GetTagValues)
-> ReadS [GetTagValues]
-> ReadPrec GetTagValues
-> ReadPrec [GetTagValues]
-> Read GetTagValues
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTagValues]
$creadListPrec :: ReadPrec [GetTagValues]
readPrec :: ReadPrec GetTagValues
$creadPrec :: ReadPrec GetTagValues
readList :: ReadS [GetTagValues]
$creadList :: ReadS [GetTagValues]
readsPrec :: Int -> ReadS GetTagValues
$creadsPrec :: Int -> ReadS GetTagValues
Prelude.Read, Int -> GetTagValues -> ShowS
[GetTagValues] -> ShowS
GetTagValues -> String
(Int -> GetTagValues -> ShowS)
-> (GetTagValues -> String)
-> ([GetTagValues] -> ShowS)
-> Show GetTagValues
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTagValues] -> ShowS
$cshowList :: [GetTagValues] -> ShowS
show :: GetTagValues -> String
$cshow :: GetTagValues -> String
showsPrec :: Int -> GetTagValues -> ShowS
$cshowsPrec :: Int -> GetTagValues -> ShowS
Prelude.Show, (forall x. GetTagValues -> Rep GetTagValues x)
-> (forall x. Rep GetTagValues x -> GetTagValues)
-> Generic GetTagValues
forall x. Rep GetTagValues x -> GetTagValues
forall x. GetTagValues -> Rep GetTagValues x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTagValues x -> GetTagValues
$cfrom :: forall x. GetTagValues -> Rep GetTagValues x
Prelude.Generic)
newGetTagValues ::
Prelude.Text ->
GetTagValues
newGetTagValues :: Text -> GetTagValues
newGetTagValues Text
pKey_ =
GetTagValues' :: Maybe Text -> Text -> GetTagValues
GetTagValues'
{ $sel:paginationToken:GetTagValues' :: Maybe Text
paginationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:key:GetTagValues' :: Text
key = Text
pKey_
}
getTagValues_paginationToken :: Lens.Lens' GetTagValues (Prelude.Maybe Prelude.Text)
= (GetTagValues -> Maybe Text)
-> (GetTagValues -> Maybe Text -> GetTagValues)
-> Lens GetTagValues GetTagValues (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagValues' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:GetTagValues' :: GetTagValues -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: GetTagValues
s@GetTagValues' {} Maybe Text
a -> GetTagValues
s {$sel:paginationToken:GetTagValues' :: Maybe Text
paginationToken = Maybe Text
a} :: GetTagValues)
getTagValues_key :: Lens.Lens' GetTagValues Prelude.Text
getTagValues_key :: (Text -> f Text) -> GetTagValues -> f GetTagValues
getTagValues_key = (GetTagValues -> Text)
-> (GetTagValues -> Text -> GetTagValues)
-> Lens GetTagValues GetTagValues Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagValues' {Text
key :: Text
$sel:key:GetTagValues' :: GetTagValues -> Text
key} -> Text
key) (\s :: GetTagValues
s@GetTagValues' {} Text
a -> GetTagValues
s {$sel:key:GetTagValues' :: Text
key = Text
a} :: GetTagValues)
instance Core.AWSPager GetTagValues where
page :: GetTagValues -> AWSResponse GetTagValues -> Maybe GetTagValues
page GetTagValues
rq AWSResponse GetTagValues
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetTagValues
GetTagValuesResponse
rs
GetTagValuesResponse
-> Getting (First Text) GetTagValuesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagValuesResponse -> Const (First Text) GetTagValuesResponse
Lens' GetTagValuesResponse (Maybe Text)
getTagValuesResponse_paginationToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagValuesResponse -> Const (First Text) GetTagValuesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetTagValuesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetTagValues
forall a. Maybe a
Prelude.Nothing
| Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetTagValues
GetTagValuesResponse
rs
GetTagValuesResponse
-> Getting (First [Text]) GetTagValuesResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetTagValuesResponse
-> Const (First [Text]) GetTagValuesResponse
Lens' GetTagValuesResponse (Maybe [Text])
getTagValuesResponse_tagValues ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetTagValuesResponse
-> Const (First [Text]) GetTagValuesResponse)
-> (([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) GetTagValuesResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetTagValues
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetTagValues -> Maybe GetTagValues
forall a. a -> Maybe a
Prelude.Just (GetTagValues -> Maybe GetTagValues)
-> GetTagValues -> Maybe GetTagValues
forall a b. (a -> b) -> a -> b
Prelude.$
GetTagValues
rq
GetTagValues -> (GetTagValues -> GetTagValues) -> GetTagValues
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetTagValues -> Identity GetTagValues
Lens GetTagValues GetTagValues (Maybe Text) (Maybe Text)
getTagValues_paginationToken
((Maybe Text -> Identity (Maybe Text))
-> GetTagValues -> Identity GetTagValues)
-> Maybe Text -> GetTagValues -> GetTagValues
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetTagValues
GetTagValuesResponse
rs
GetTagValuesResponse
-> Getting (First Text) GetTagValuesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagValuesResponse -> Const (First Text) GetTagValuesResponse
Lens' GetTagValuesResponse (Maybe Text)
getTagValuesResponse_paginationToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagValuesResponse -> Const (First Text) GetTagValuesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetTagValuesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetTagValues where
type AWSResponse GetTagValues = GetTagValuesResponse
request :: GetTagValues -> Request GetTagValues
request = Service -> GetTagValues -> Request GetTagValues
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetTagValues
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTagValues)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetTagValues))
-> Logger
-> Service
-> Proxy GetTagValues
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTagValues)))
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 -> Maybe [Text] -> Int -> GetTagValuesResponse
GetTagValuesResponse'
(Maybe Text -> Maybe [Text] -> Int -> GetTagValuesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> Int -> GetTagValuesResponse)
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
"PaginationToken")
Either String (Maybe [Text] -> Int -> GetTagValuesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> GetTagValuesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TagValues" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetTagValuesResponse)
-> Either String Int -> Either String GetTagValuesResponse
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))
)
instance Prelude.Hashable GetTagValues
instance Prelude.NFData GetTagValues
instance Core.ToHeaders GetTagValues where
toHeaders :: GetTagValues -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetTagValues -> 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
"ResourceGroupsTaggingAPI_20170126.GetTagValues" ::
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 GetTagValues where
toJSON :: GetTagValues -> Value
toJSON GetTagValues' {Maybe Text
Text
key :: Text
paginationToken :: Maybe Text
$sel:key:GetTagValues' :: GetTagValues -> Text
$sel:paginationToken:GetTagValues' :: GetTagValues -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PaginationToken" 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
paginationToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key)
]
)
instance Core.ToPath GetTagValues where
toPath :: GetTagValues -> ByteString
toPath = ByteString -> GetTagValues -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTagValues where
toQuery :: GetTagValues -> QueryString
toQuery = QueryString -> GetTagValues -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetTagValuesResponse = GetTagValuesResponse'
{
:: Prelude.Maybe Prelude.Text,
GetTagValuesResponse -> Maybe [Text]
tagValues :: Prelude.Maybe [Prelude.Text],
GetTagValuesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTagValuesResponse -> GetTagValuesResponse -> Bool
(GetTagValuesResponse -> GetTagValuesResponse -> Bool)
-> (GetTagValuesResponse -> GetTagValuesResponse -> Bool)
-> Eq GetTagValuesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTagValuesResponse -> GetTagValuesResponse -> Bool
$c/= :: GetTagValuesResponse -> GetTagValuesResponse -> Bool
== :: GetTagValuesResponse -> GetTagValuesResponse -> Bool
$c== :: GetTagValuesResponse -> GetTagValuesResponse -> Bool
Prelude.Eq, ReadPrec [GetTagValuesResponse]
ReadPrec GetTagValuesResponse
Int -> ReadS GetTagValuesResponse
ReadS [GetTagValuesResponse]
(Int -> ReadS GetTagValuesResponse)
-> ReadS [GetTagValuesResponse]
-> ReadPrec GetTagValuesResponse
-> ReadPrec [GetTagValuesResponse]
-> Read GetTagValuesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTagValuesResponse]
$creadListPrec :: ReadPrec [GetTagValuesResponse]
readPrec :: ReadPrec GetTagValuesResponse
$creadPrec :: ReadPrec GetTagValuesResponse
readList :: ReadS [GetTagValuesResponse]
$creadList :: ReadS [GetTagValuesResponse]
readsPrec :: Int -> ReadS GetTagValuesResponse
$creadsPrec :: Int -> ReadS GetTagValuesResponse
Prelude.Read, Int -> GetTagValuesResponse -> ShowS
[GetTagValuesResponse] -> ShowS
GetTagValuesResponse -> String
(Int -> GetTagValuesResponse -> ShowS)
-> (GetTagValuesResponse -> String)
-> ([GetTagValuesResponse] -> ShowS)
-> Show GetTagValuesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTagValuesResponse] -> ShowS
$cshowList :: [GetTagValuesResponse] -> ShowS
show :: GetTagValuesResponse -> String
$cshow :: GetTagValuesResponse -> String
showsPrec :: Int -> GetTagValuesResponse -> ShowS
$cshowsPrec :: Int -> GetTagValuesResponse -> ShowS
Prelude.Show, (forall x. GetTagValuesResponse -> Rep GetTagValuesResponse x)
-> (forall x. Rep GetTagValuesResponse x -> GetTagValuesResponse)
-> Generic GetTagValuesResponse
forall x. Rep GetTagValuesResponse x -> GetTagValuesResponse
forall x. GetTagValuesResponse -> Rep GetTagValuesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTagValuesResponse x -> GetTagValuesResponse
$cfrom :: forall x. GetTagValuesResponse -> Rep GetTagValuesResponse x
Prelude.Generic)
newGetTagValuesResponse ::
Prelude.Int ->
GetTagValuesResponse
newGetTagValuesResponse :: Int -> GetTagValuesResponse
newGetTagValuesResponse Int
pHttpStatus_ =
GetTagValuesResponse' :: Maybe Text -> Maybe [Text] -> Int -> GetTagValuesResponse
GetTagValuesResponse'
{ $sel:paginationToken:GetTagValuesResponse' :: Maybe Text
paginationToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagValues:GetTagValuesResponse' :: Maybe [Text]
tagValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTagValuesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTagValuesResponse_paginationToken :: Lens.Lens' GetTagValuesResponse (Prelude.Maybe Prelude.Text)
= (GetTagValuesResponse -> Maybe Text)
-> (GetTagValuesResponse -> Maybe Text -> GetTagValuesResponse)
-> Lens' GetTagValuesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagValuesResponse' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:GetTagValuesResponse' :: GetTagValuesResponse -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: GetTagValuesResponse
s@GetTagValuesResponse' {} Maybe Text
a -> GetTagValuesResponse
s {$sel:paginationToken:GetTagValuesResponse' :: Maybe Text
paginationToken = Maybe Text
a} :: GetTagValuesResponse)
getTagValuesResponse_tagValues :: Lens.Lens' GetTagValuesResponse (Prelude.Maybe [Prelude.Text])
getTagValuesResponse_tagValues :: (Maybe [Text] -> f (Maybe [Text]))
-> GetTagValuesResponse -> f GetTagValuesResponse
getTagValuesResponse_tagValues = (GetTagValuesResponse -> Maybe [Text])
-> (GetTagValuesResponse -> Maybe [Text] -> GetTagValuesResponse)
-> Lens' GetTagValuesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagValuesResponse' {Maybe [Text]
tagValues :: Maybe [Text]
$sel:tagValues:GetTagValuesResponse' :: GetTagValuesResponse -> Maybe [Text]
tagValues} -> Maybe [Text]
tagValues) (\s :: GetTagValuesResponse
s@GetTagValuesResponse' {} Maybe [Text]
a -> GetTagValuesResponse
s {$sel:tagValues:GetTagValuesResponse' :: Maybe [Text]
tagValues = Maybe [Text]
a} :: GetTagValuesResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> GetTagValuesResponse -> f GetTagValuesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetTagValuesResponse
-> f GetTagValuesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTagValuesResponse_httpStatus :: Lens.Lens' GetTagValuesResponse Prelude.Int
getTagValuesResponse_httpStatus :: (Int -> f Int) -> GetTagValuesResponse -> f GetTagValuesResponse
getTagValuesResponse_httpStatus = (GetTagValuesResponse -> Int)
-> (GetTagValuesResponse -> Int -> GetTagValuesResponse)
-> Lens GetTagValuesResponse GetTagValuesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagValuesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTagValuesResponse' :: GetTagValuesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTagValuesResponse
s@GetTagValuesResponse' {} Int
a -> GetTagValuesResponse
s {$sel:httpStatus:GetTagValuesResponse' :: Int
httpStatus = Int
a} :: GetTagValuesResponse)
instance Prelude.NFData GetTagValuesResponse