{-# 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.GetTagKeys
(
GetTagKeys (..),
newGetTagKeys,
getTagKeys_paginationToken,
GetTagKeysResponse (..),
newGetTagKeysResponse,
getTagKeysResponse_paginationToken,
getTagKeysResponse_tagKeys,
getTagKeysResponse_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 GetTagKeys = GetTagKeys'
{
:: Prelude.Maybe Prelude.Text
}
deriving (GetTagKeys -> GetTagKeys -> Bool
(GetTagKeys -> GetTagKeys -> Bool)
-> (GetTagKeys -> GetTagKeys -> Bool) -> Eq GetTagKeys
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTagKeys -> GetTagKeys -> Bool
$c/= :: GetTagKeys -> GetTagKeys -> Bool
== :: GetTagKeys -> GetTagKeys -> Bool
$c== :: GetTagKeys -> GetTagKeys -> Bool
Prelude.Eq, ReadPrec [GetTagKeys]
ReadPrec GetTagKeys
Int -> ReadS GetTagKeys
ReadS [GetTagKeys]
(Int -> ReadS GetTagKeys)
-> ReadS [GetTagKeys]
-> ReadPrec GetTagKeys
-> ReadPrec [GetTagKeys]
-> Read GetTagKeys
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTagKeys]
$creadListPrec :: ReadPrec [GetTagKeys]
readPrec :: ReadPrec GetTagKeys
$creadPrec :: ReadPrec GetTagKeys
readList :: ReadS [GetTagKeys]
$creadList :: ReadS [GetTagKeys]
readsPrec :: Int -> ReadS GetTagKeys
$creadsPrec :: Int -> ReadS GetTagKeys
Prelude.Read, Int -> GetTagKeys -> ShowS
[GetTagKeys] -> ShowS
GetTagKeys -> String
(Int -> GetTagKeys -> ShowS)
-> (GetTagKeys -> String)
-> ([GetTagKeys] -> ShowS)
-> Show GetTagKeys
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTagKeys] -> ShowS
$cshowList :: [GetTagKeys] -> ShowS
show :: GetTagKeys -> String
$cshow :: GetTagKeys -> String
showsPrec :: Int -> GetTagKeys -> ShowS
$cshowsPrec :: Int -> GetTagKeys -> ShowS
Prelude.Show, (forall x. GetTagKeys -> Rep GetTagKeys x)
-> (forall x. Rep GetTagKeys x -> GetTagKeys) -> Generic GetTagKeys
forall x. Rep GetTagKeys x -> GetTagKeys
forall x. GetTagKeys -> Rep GetTagKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTagKeys x -> GetTagKeys
$cfrom :: forall x. GetTagKeys -> Rep GetTagKeys x
Prelude.Generic)
newGetTagKeys ::
GetTagKeys
newGetTagKeys :: GetTagKeys
newGetTagKeys =
GetTagKeys' :: Maybe Text -> GetTagKeys
GetTagKeys' {$sel:paginationToken:GetTagKeys' :: Maybe Text
paginationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
getTagKeys_paginationToken :: Lens.Lens' GetTagKeys (Prelude.Maybe Prelude.Text)
= (GetTagKeys -> Maybe Text)
-> (GetTagKeys -> Maybe Text -> GetTagKeys)
-> Lens GetTagKeys GetTagKeys (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagKeys' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:GetTagKeys' :: GetTagKeys -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: GetTagKeys
s@GetTagKeys' {} Maybe Text
a -> GetTagKeys
s {$sel:paginationToken:GetTagKeys' :: Maybe Text
paginationToken = Maybe Text
a} :: GetTagKeys)
instance Core.AWSPager GetTagKeys where
page :: GetTagKeys -> AWSResponse GetTagKeys -> Maybe GetTagKeys
page GetTagKeys
rq AWSResponse GetTagKeys
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetTagKeys
GetTagKeysResponse
rs
GetTagKeysResponse
-> Getting (First Text) GetTagKeysResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagKeysResponse -> Const (First Text) GetTagKeysResponse
Lens' GetTagKeysResponse (Maybe Text)
getTagKeysResponse_paginationToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagKeysResponse -> Const (First Text) GetTagKeysResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetTagKeysResponse 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 GetTagKeys
forall a. Maybe a
Prelude.Nothing
| Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetTagKeys
GetTagKeysResponse
rs
GetTagKeysResponse
-> Getting (First [Text]) GetTagKeysResponse [Text] -> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetTagKeysResponse -> Const (First [Text]) GetTagKeysResponse
Lens' GetTagKeysResponse (Maybe [Text])
getTagKeysResponse_tagKeys ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetTagKeysResponse -> Const (First [Text]) GetTagKeysResponse)
-> (([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) GetTagKeysResponse [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 GetTagKeys
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetTagKeys -> Maybe GetTagKeys
forall a. a -> Maybe a
Prelude.Just (GetTagKeys -> Maybe GetTagKeys) -> GetTagKeys -> Maybe GetTagKeys
forall a b. (a -> b) -> a -> b
Prelude.$
GetTagKeys
rq
GetTagKeys -> (GetTagKeys -> GetTagKeys) -> GetTagKeys
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetTagKeys -> Identity GetTagKeys
Lens GetTagKeys GetTagKeys (Maybe Text) (Maybe Text)
getTagKeys_paginationToken
((Maybe Text -> Identity (Maybe Text))
-> GetTagKeys -> Identity GetTagKeys)
-> Maybe Text -> GetTagKeys -> GetTagKeys
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetTagKeys
GetTagKeysResponse
rs
GetTagKeysResponse
-> Getting (First Text) GetTagKeysResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagKeysResponse -> Const (First Text) GetTagKeysResponse
Lens' GetTagKeysResponse (Maybe Text)
getTagKeysResponse_paginationToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetTagKeysResponse -> Const (First Text) GetTagKeysResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetTagKeysResponse 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 GetTagKeys where
type AWSResponse GetTagKeys = GetTagKeysResponse
request :: GetTagKeys -> Request GetTagKeys
request = Service -> GetTagKeys -> Request GetTagKeys
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetTagKeys
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTagKeys)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetTagKeys))
-> Logger
-> Service
-> Proxy GetTagKeys
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTagKeys)))
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 -> GetTagKeysResponse
GetTagKeysResponse'
(Maybe Text -> Maybe [Text] -> Int -> GetTagKeysResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> Int -> GetTagKeysResponse)
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 -> GetTagKeysResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> GetTagKeysResponse)
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
"TagKeys" 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 -> GetTagKeysResponse)
-> Either String Int -> Either String GetTagKeysResponse
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 GetTagKeys
instance Prelude.NFData GetTagKeys
instance Core.ToHeaders GetTagKeys where
toHeaders :: GetTagKeys -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetTagKeys -> 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.GetTagKeys" ::
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 GetTagKeys where
toJSON :: GetTagKeys -> Value
toJSON GetTagKeys' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:GetTagKeys' :: GetTagKeys -> 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
]
)
instance Core.ToPath GetTagKeys where
toPath :: GetTagKeys -> ByteString
toPath = ByteString -> GetTagKeys -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTagKeys where
toQuery :: GetTagKeys -> QueryString
toQuery = QueryString -> GetTagKeys -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetTagKeysResponse = GetTagKeysResponse'
{
:: Prelude.Maybe Prelude.Text,
GetTagKeysResponse -> Maybe [Text]
tagKeys :: Prelude.Maybe [Prelude.Text],
GetTagKeysResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTagKeysResponse -> GetTagKeysResponse -> Bool
(GetTagKeysResponse -> GetTagKeysResponse -> Bool)
-> (GetTagKeysResponse -> GetTagKeysResponse -> Bool)
-> Eq GetTagKeysResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTagKeysResponse -> GetTagKeysResponse -> Bool
$c/= :: GetTagKeysResponse -> GetTagKeysResponse -> Bool
== :: GetTagKeysResponse -> GetTagKeysResponse -> Bool
$c== :: GetTagKeysResponse -> GetTagKeysResponse -> Bool
Prelude.Eq, ReadPrec [GetTagKeysResponse]
ReadPrec GetTagKeysResponse
Int -> ReadS GetTagKeysResponse
ReadS [GetTagKeysResponse]
(Int -> ReadS GetTagKeysResponse)
-> ReadS [GetTagKeysResponse]
-> ReadPrec GetTagKeysResponse
-> ReadPrec [GetTagKeysResponse]
-> Read GetTagKeysResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTagKeysResponse]
$creadListPrec :: ReadPrec [GetTagKeysResponse]
readPrec :: ReadPrec GetTagKeysResponse
$creadPrec :: ReadPrec GetTagKeysResponse
readList :: ReadS [GetTagKeysResponse]
$creadList :: ReadS [GetTagKeysResponse]
readsPrec :: Int -> ReadS GetTagKeysResponse
$creadsPrec :: Int -> ReadS GetTagKeysResponse
Prelude.Read, Int -> GetTagKeysResponse -> ShowS
[GetTagKeysResponse] -> ShowS
GetTagKeysResponse -> String
(Int -> GetTagKeysResponse -> ShowS)
-> (GetTagKeysResponse -> String)
-> ([GetTagKeysResponse] -> ShowS)
-> Show GetTagKeysResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTagKeysResponse] -> ShowS
$cshowList :: [GetTagKeysResponse] -> ShowS
show :: GetTagKeysResponse -> String
$cshow :: GetTagKeysResponse -> String
showsPrec :: Int -> GetTagKeysResponse -> ShowS
$cshowsPrec :: Int -> GetTagKeysResponse -> ShowS
Prelude.Show, (forall x. GetTagKeysResponse -> Rep GetTagKeysResponse x)
-> (forall x. Rep GetTagKeysResponse x -> GetTagKeysResponse)
-> Generic GetTagKeysResponse
forall x. Rep GetTagKeysResponse x -> GetTagKeysResponse
forall x. GetTagKeysResponse -> Rep GetTagKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTagKeysResponse x -> GetTagKeysResponse
$cfrom :: forall x. GetTagKeysResponse -> Rep GetTagKeysResponse x
Prelude.Generic)
newGetTagKeysResponse ::
Prelude.Int ->
GetTagKeysResponse
newGetTagKeysResponse :: Int -> GetTagKeysResponse
newGetTagKeysResponse Int
pHttpStatus_ =
GetTagKeysResponse' :: Maybe Text -> Maybe [Text] -> Int -> GetTagKeysResponse
GetTagKeysResponse'
{ $sel:paginationToken:GetTagKeysResponse' :: Maybe Text
paginationToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagKeys:GetTagKeysResponse' :: Maybe [Text]
tagKeys = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTagKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTagKeysResponse_paginationToken :: Lens.Lens' GetTagKeysResponse (Prelude.Maybe Prelude.Text)
= (GetTagKeysResponse -> Maybe Text)
-> (GetTagKeysResponse -> Maybe Text -> GetTagKeysResponse)
-> Lens' GetTagKeysResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagKeysResponse' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:GetTagKeysResponse' :: GetTagKeysResponse -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: GetTagKeysResponse
s@GetTagKeysResponse' {} Maybe Text
a -> GetTagKeysResponse
s {$sel:paginationToken:GetTagKeysResponse' :: Maybe Text
paginationToken = Maybe Text
a} :: GetTagKeysResponse)
getTagKeysResponse_tagKeys :: Lens.Lens' GetTagKeysResponse (Prelude.Maybe [Prelude.Text])
getTagKeysResponse_tagKeys :: (Maybe [Text] -> f (Maybe [Text]))
-> GetTagKeysResponse -> f GetTagKeysResponse
getTagKeysResponse_tagKeys = (GetTagKeysResponse -> Maybe [Text])
-> (GetTagKeysResponse -> Maybe [Text] -> GetTagKeysResponse)
-> Lens' GetTagKeysResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagKeysResponse' {Maybe [Text]
tagKeys :: Maybe [Text]
$sel:tagKeys:GetTagKeysResponse' :: GetTagKeysResponse -> Maybe [Text]
tagKeys} -> Maybe [Text]
tagKeys) (\s :: GetTagKeysResponse
s@GetTagKeysResponse' {} Maybe [Text]
a -> GetTagKeysResponse
s {$sel:tagKeys:GetTagKeysResponse' :: Maybe [Text]
tagKeys = Maybe [Text]
a} :: GetTagKeysResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> GetTagKeysResponse -> f GetTagKeysResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetTagKeysResponse
-> f GetTagKeysResponse
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
getTagKeysResponse_httpStatus :: Lens.Lens' GetTagKeysResponse Prelude.Int
getTagKeysResponse_httpStatus :: (Int -> f Int) -> GetTagKeysResponse -> f GetTagKeysResponse
getTagKeysResponse_httpStatus = (GetTagKeysResponse -> Int)
-> (GetTagKeysResponse -> Int -> GetTagKeysResponse)
-> Lens GetTagKeysResponse GetTagKeysResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTagKeysResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTagKeysResponse' :: GetTagKeysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTagKeysResponse
s@GetTagKeysResponse' {} Int
a -> GetTagKeysResponse
s {$sel:httpStatus:GetTagKeysResponse' :: Int
httpStatus = Int
a} :: GetTagKeysResponse)
instance Prelude.NFData GetTagKeysResponse