{-# 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.LakeFormation.GetLFTag
(
GetLFTag (..),
newGetLFTag,
getLFTag_catalogId,
getLFTag_tagKey,
GetLFTagResponse (..),
newGetLFTagResponse,
getLFTagResponse_tagValues,
getLFTagResponse_catalogId,
getLFTagResponse_tagKey,
getLFTagResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.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
data GetLFTag = GetLFTag'
{
GetLFTag -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetLFTag -> Text
tagKey :: Prelude.Text
}
deriving (GetLFTag -> GetLFTag -> Bool
(GetLFTag -> GetLFTag -> Bool)
-> (GetLFTag -> GetLFTag -> Bool) -> Eq GetLFTag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLFTag -> GetLFTag -> Bool
$c/= :: GetLFTag -> GetLFTag -> Bool
== :: GetLFTag -> GetLFTag -> Bool
$c== :: GetLFTag -> GetLFTag -> Bool
Prelude.Eq, ReadPrec [GetLFTag]
ReadPrec GetLFTag
Int -> ReadS GetLFTag
ReadS [GetLFTag]
(Int -> ReadS GetLFTag)
-> ReadS [GetLFTag]
-> ReadPrec GetLFTag
-> ReadPrec [GetLFTag]
-> Read GetLFTag
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLFTag]
$creadListPrec :: ReadPrec [GetLFTag]
readPrec :: ReadPrec GetLFTag
$creadPrec :: ReadPrec GetLFTag
readList :: ReadS [GetLFTag]
$creadList :: ReadS [GetLFTag]
readsPrec :: Int -> ReadS GetLFTag
$creadsPrec :: Int -> ReadS GetLFTag
Prelude.Read, Int -> GetLFTag -> ShowS
[GetLFTag] -> ShowS
GetLFTag -> String
(Int -> GetLFTag -> ShowS)
-> (GetLFTag -> String) -> ([GetLFTag] -> ShowS) -> Show GetLFTag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLFTag] -> ShowS
$cshowList :: [GetLFTag] -> ShowS
show :: GetLFTag -> String
$cshow :: GetLFTag -> String
showsPrec :: Int -> GetLFTag -> ShowS
$cshowsPrec :: Int -> GetLFTag -> ShowS
Prelude.Show, (forall x. GetLFTag -> Rep GetLFTag x)
-> (forall x. Rep GetLFTag x -> GetLFTag) -> Generic GetLFTag
forall x. Rep GetLFTag x -> GetLFTag
forall x. GetLFTag -> Rep GetLFTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLFTag x -> GetLFTag
$cfrom :: forall x. GetLFTag -> Rep GetLFTag x
Prelude.Generic)
newGetLFTag ::
Prelude.Text ->
GetLFTag
newGetLFTag :: Text -> GetLFTag
newGetLFTag Text
pTagKey_ =
GetLFTag' :: Maybe Text -> Text -> GetLFTag
GetLFTag'
{ $sel:catalogId:GetLFTag' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:GetLFTag' :: Text
tagKey = Text
pTagKey_
}
getLFTag_catalogId :: Lens.Lens' GetLFTag (Prelude.Maybe Prelude.Text)
getLFTag_catalogId :: (Maybe Text -> f (Maybe Text)) -> GetLFTag -> f GetLFTag
getLFTag_catalogId = (GetLFTag -> Maybe Text)
-> (GetLFTag -> Maybe Text -> GetLFTag)
-> Lens GetLFTag GetLFTag (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTag' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetLFTag' :: GetLFTag -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetLFTag
s@GetLFTag' {} Maybe Text
a -> GetLFTag
s {$sel:catalogId:GetLFTag' :: Maybe Text
catalogId = Maybe Text
a} :: GetLFTag)
getLFTag_tagKey :: Lens.Lens' GetLFTag Prelude.Text
getLFTag_tagKey :: (Text -> f Text) -> GetLFTag -> f GetLFTag
getLFTag_tagKey = (GetLFTag -> Text)
-> (GetLFTag -> Text -> GetLFTag)
-> Lens GetLFTag GetLFTag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTag' {Text
tagKey :: Text
$sel:tagKey:GetLFTag' :: GetLFTag -> Text
tagKey} -> Text
tagKey) (\s :: GetLFTag
s@GetLFTag' {} Text
a -> GetLFTag
s {$sel:tagKey:GetLFTag' :: Text
tagKey = Text
a} :: GetLFTag)
instance Core.AWSRequest GetLFTag where
type AWSResponse GetLFTag = GetLFTagResponse
request :: GetLFTag -> Request GetLFTag
request = Service -> GetLFTag -> Request GetLFTag
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetLFTag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLFTag)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetLFTag))
-> Logger
-> Service
-> Proxy GetLFTag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLFTag)))
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 (NonEmpty Text)
-> Maybe Text -> Maybe Text -> Int -> GetLFTagResponse
GetLFTagResponse'
(Maybe (NonEmpty Text)
-> Maybe Text -> Maybe Text -> Int -> GetLFTagResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetLFTagResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TagValues")
Either String (Maybe Text -> Maybe Text -> Int -> GetLFTagResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetLFTagResponse)
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
"CatalogId")
Either String (Maybe Text -> Int -> GetLFTagResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetLFTagResponse)
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
"TagKey")
Either String (Int -> GetLFTagResponse)
-> Either String Int -> Either String GetLFTagResponse
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 GetLFTag
instance Prelude.NFData GetLFTag
instance Core.ToHeaders GetLFTag where
toHeaders :: GetLFTag -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetLFTag -> 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
"AWSLakeFormation.GetLFTag" :: 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 GetLFTag where
toJSON :: GetLFTag -> Value
toJSON GetLFTag' {Maybe Text
Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagKey:GetLFTag' :: GetLFTag -> Text
$sel:catalogId:GetLFTag' :: GetLFTag -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CatalogId" 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
catalogId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tagKey)
]
)
instance Core.ToPath GetLFTag where
toPath :: GetLFTag -> ByteString
toPath = ByteString -> GetLFTag -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetLFTag where
toQuery :: GetLFTag -> QueryString
toQuery = QueryString -> GetLFTag -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetLFTagResponse = GetLFTagResponse'
{
GetLFTagResponse -> Maybe (NonEmpty Text)
tagValues :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
GetLFTagResponse -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
GetLFTagResponse -> Maybe Text
tagKey :: Prelude.Maybe Prelude.Text,
GetLFTagResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetLFTagResponse -> GetLFTagResponse -> Bool
(GetLFTagResponse -> GetLFTagResponse -> Bool)
-> (GetLFTagResponse -> GetLFTagResponse -> Bool)
-> Eq GetLFTagResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLFTagResponse -> GetLFTagResponse -> Bool
$c/= :: GetLFTagResponse -> GetLFTagResponse -> Bool
== :: GetLFTagResponse -> GetLFTagResponse -> Bool
$c== :: GetLFTagResponse -> GetLFTagResponse -> Bool
Prelude.Eq, ReadPrec [GetLFTagResponse]
ReadPrec GetLFTagResponse
Int -> ReadS GetLFTagResponse
ReadS [GetLFTagResponse]
(Int -> ReadS GetLFTagResponse)
-> ReadS [GetLFTagResponse]
-> ReadPrec GetLFTagResponse
-> ReadPrec [GetLFTagResponse]
-> Read GetLFTagResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLFTagResponse]
$creadListPrec :: ReadPrec [GetLFTagResponse]
readPrec :: ReadPrec GetLFTagResponse
$creadPrec :: ReadPrec GetLFTagResponse
readList :: ReadS [GetLFTagResponse]
$creadList :: ReadS [GetLFTagResponse]
readsPrec :: Int -> ReadS GetLFTagResponse
$creadsPrec :: Int -> ReadS GetLFTagResponse
Prelude.Read, Int -> GetLFTagResponse -> ShowS
[GetLFTagResponse] -> ShowS
GetLFTagResponse -> String
(Int -> GetLFTagResponse -> ShowS)
-> (GetLFTagResponse -> String)
-> ([GetLFTagResponse] -> ShowS)
-> Show GetLFTagResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLFTagResponse] -> ShowS
$cshowList :: [GetLFTagResponse] -> ShowS
show :: GetLFTagResponse -> String
$cshow :: GetLFTagResponse -> String
showsPrec :: Int -> GetLFTagResponse -> ShowS
$cshowsPrec :: Int -> GetLFTagResponse -> ShowS
Prelude.Show, (forall x. GetLFTagResponse -> Rep GetLFTagResponse x)
-> (forall x. Rep GetLFTagResponse x -> GetLFTagResponse)
-> Generic GetLFTagResponse
forall x. Rep GetLFTagResponse x -> GetLFTagResponse
forall x. GetLFTagResponse -> Rep GetLFTagResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLFTagResponse x -> GetLFTagResponse
$cfrom :: forall x. GetLFTagResponse -> Rep GetLFTagResponse x
Prelude.Generic)
newGetLFTagResponse ::
Prelude.Int ->
GetLFTagResponse
newGetLFTagResponse :: Int -> GetLFTagResponse
newGetLFTagResponse Int
pHttpStatus_ =
GetLFTagResponse' :: Maybe (NonEmpty Text)
-> Maybe Text -> Maybe Text -> Int -> GetLFTagResponse
GetLFTagResponse'
{ $sel:tagValues:GetLFTagResponse' :: Maybe (NonEmpty Text)
tagValues = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:catalogId:GetLFTagResponse' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:GetLFTagResponse' :: Maybe Text
tagKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetLFTagResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getLFTagResponse_tagValues :: Lens.Lens' GetLFTagResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
getLFTagResponse_tagValues :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetLFTagResponse -> f GetLFTagResponse
getLFTagResponse_tagValues = (GetLFTagResponse -> Maybe (NonEmpty Text))
-> (GetLFTagResponse -> Maybe (NonEmpty Text) -> GetLFTagResponse)
-> Lens
GetLFTagResponse
GetLFTagResponse
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTagResponse' {Maybe (NonEmpty Text)
tagValues :: Maybe (NonEmpty Text)
$sel:tagValues:GetLFTagResponse' :: GetLFTagResponse -> Maybe (NonEmpty Text)
tagValues} -> Maybe (NonEmpty Text)
tagValues) (\s :: GetLFTagResponse
s@GetLFTagResponse' {} Maybe (NonEmpty Text)
a -> GetLFTagResponse
s {$sel:tagValues:GetLFTagResponse' :: Maybe (NonEmpty Text)
tagValues = Maybe (NonEmpty Text)
a} :: GetLFTagResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetLFTagResponse -> f GetLFTagResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetLFTagResponse
-> f GetLFTagResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty 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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getLFTagResponse_catalogId :: Lens.Lens' GetLFTagResponse (Prelude.Maybe Prelude.Text)
getLFTagResponse_catalogId :: (Maybe Text -> f (Maybe Text))
-> GetLFTagResponse -> f GetLFTagResponse
getLFTagResponse_catalogId = (GetLFTagResponse -> Maybe Text)
-> (GetLFTagResponse -> Maybe Text -> GetLFTagResponse)
-> Lens GetLFTagResponse GetLFTagResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTagResponse' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:GetLFTagResponse' :: GetLFTagResponse -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: GetLFTagResponse
s@GetLFTagResponse' {} Maybe Text
a -> GetLFTagResponse
s {$sel:catalogId:GetLFTagResponse' :: Maybe Text
catalogId = Maybe Text
a} :: GetLFTagResponse)
getLFTagResponse_tagKey :: Lens.Lens' GetLFTagResponse (Prelude.Maybe Prelude.Text)
getLFTagResponse_tagKey :: (Maybe Text -> f (Maybe Text))
-> GetLFTagResponse -> f GetLFTagResponse
getLFTagResponse_tagKey = (GetLFTagResponse -> Maybe Text)
-> (GetLFTagResponse -> Maybe Text -> GetLFTagResponse)
-> Lens GetLFTagResponse GetLFTagResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTagResponse' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:GetLFTagResponse' :: GetLFTagResponse -> Maybe Text
tagKey} -> Maybe Text
tagKey) (\s :: GetLFTagResponse
s@GetLFTagResponse' {} Maybe Text
a -> GetLFTagResponse
s {$sel:tagKey:GetLFTagResponse' :: Maybe Text
tagKey = Maybe Text
a} :: GetLFTagResponse)
getLFTagResponse_httpStatus :: Lens.Lens' GetLFTagResponse Prelude.Int
getLFTagResponse_httpStatus :: (Int -> f Int) -> GetLFTagResponse -> f GetLFTagResponse
getLFTagResponse_httpStatus = (GetLFTagResponse -> Int)
-> (GetLFTagResponse -> Int -> GetLFTagResponse)
-> Lens GetLFTagResponse GetLFTagResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLFTagResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLFTagResponse' :: GetLFTagResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLFTagResponse
s@GetLFTagResponse' {} Int
a -> GetLFTagResponse
s {$sel:httpStatus:GetLFTagResponse' :: Int
httpStatus = Int
a} :: GetLFTagResponse)
instance Prelude.NFData GetLFTagResponse