{-# 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.CreateLFTag
(
CreateLFTag (..),
newCreateLFTag,
createLFTag_catalogId,
createLFTag_tagKey,
createLFTag_tagValues,
CreateLFTagResponse (..),
newCreateLFTagResponse,
createLFTagResponse_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 CreateLFTag = CreateLFTag'
{
CreateLFTag -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
CreateLFTag -> Text
tagKey :: Prelude.Text,
CreateLFTag -> NonEmpty Text
tagValues :: Prelude.NonEmpty Prelude.Text
}
deriving (CreateLFTag -> CreateLFTag -> Bool
(CreateLFTag -> CreateLFTag -> Bool)
-> (CreateLFTag -> CreateLFTag -> Bool) -> Eq CreateLFTag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLFTag -> CreateLFTag -> Bool
$c/= :: CreateLFTag -> CreateLFTag -> Bool
== :: CreateLFTag -> CreateLFTag -> Bool
$c== :: CreateLFTag -> CreateLFTag -> Bool
Prelude.Eq, ReadPrec [CreateLFTag]
ReadPrec CreateLFTag
Int -> ReadS CreateLFTag
ReadS [CreateLFTag]
(Int -> ReadS CreateLFTag)
-> ReadS [CreateLFTag]
-> ReadPrec CreateLFTag
-> ReadPrec [CreateLFTag]
-> Read CreateLFTag
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLFTag]
$creadListPrec :: ReadPrec [CreateLFTag]
readPrec :: ReadPrec CreateLFTag
$creadPrec :: ReadPrec CreateLFTag
readList :: ReadS [CreateLFTag]
$creadList :: ReadS [CreateLFTag]
readsPrec :: Int -> ReadS CreateLFTag
$creadsPrec :: Int -> ReadS CreateLFTag
Prelude.Read, Int -> CreateLFTag -> ShowS
[CreateLFTag] -> ShowS
CreateLFTag -> String
(Int -> CreateLFTag -> ShowS)
-> (CreateLFTag -> String)
-> ([CreateLFTag] -> ShowS)
-> Show CreateLFTag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLFTag] -> ShowS
$cshowList :: [CreateLFTag] -> ShowS
show :: CreateLFTag -> String
$cshow :: CreateLFTag -> String
showsPrec :: Int -> CreateLFTag -> ShowS
$cshowsPrec :: Int -> CreateLFTag -> ShowS
Prelude.Show, (forall x. CreateLFTag -> Rep CreateLFTag x)
-> (forall x. Rep CreateLFTag x -> CreateLFTag)
-> Generic CreateLFTag
forall x. Rep CreateLFTag x -> CreateLFTag
forall x. CreateLFTag -> Rep CreateLFTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLFTag x -> CreateLFTag
$cfrom :: forall x. CreateLFTag -> Rep CreateLFTag x
Prelude.Generic)
newCreateLFTag ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
CreateLFTag
newCreateLFTag :: Text -> NonEmpty Text -> CreateLFTag
newCreateLFTag Text
pTagKey_ NonEmpty Text
pTagValues_ =
CreateLFTag' :: Maybe Text -> Text -> NonEmpty Text -> CreateLFTag
CreateLFTag'
{ $sel:catalogId:CreateLFTag' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:CreateLFTag' :: Text
tagKey = Text
pTagKey_,
$sel:tagValues:CreateLFTag' :: NonEmpty Text
tagValues = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagValues_
}
createLFTag_catalogId :: Lens.Lens' CreateLFTag (Prelude.Maybe Prelude.Text)
createLFTag_catalogId :: (Maybe Text -> f (Maybe Text)) -> CreateLFTag -> f CreateLFTag
createLFTag_catalogId = (CreateLFTag -> Maybe Text)
-> (CreateLFTag -> Maybe Text -> CreateLFTag)
-> Lens CreateLFTag CreateLFTag (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLFTag' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:CreateLFTag' :: CreateLFTag -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: CreateLFTag
s@CreateLFTag' {} Maybe Text
a -> CreateLFTag
s {$sel:catalogId:CreateLFTag' :: Maybe Text
catalogId = Maybe Text
a} :: CreateLFTag)
createLFTag_tagKey :: Lens.Lens' CreateLFTag Prelude.Text
createLFTag_tagKey :: (Text -> f Text) -> CreateLFTag -> f CreateLFTag
createLFTag_tagKey = (CreateLFTag -> Text)
-> (CreateLFTag -> Text -> CreateLFTag)
-> Lens CreateLFTag CreateLFTag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLFTag' {Text
tagKey :: Text
$sel:tagKey:CreateLFTag' :: CreateLFTag -> Text
tagKey} -> Text
tagKey) (\s :: CreateLFTag
s@CreateLFTag' {} Text
a -> CreateLFTag
s {$sel:tagKey:CreateLFTag' :: Text
tagKey = Text
a} :: CreateLFTag)
createLFTag_tagValues :: Lens.Lens' CreateLFTag (Prelude.NonEmpty Prelude.Text)
createLFTag_tagValues :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateLFTag -> f CreateLFTag
createLFTag_tagValues = (CreateLFTag -> NonEmpty Text)
-> (CreateLFTag -> NonEmpty Text -> CreateLFTag)
-> Lens CreateLFTag CreateLFTag (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLFTag' {NonEmpty Text
tagValues :: NonEmpty Text
$sel:tagValues:CreateLFTag' :: CreateLFTag -> NonEmpty Text
tagValues} -> NonEmpty Text
tagValues) (\s :: CreateLFTag
s@CreateLFTag' {} NonEmpty Text
a -> CreateLFTag
s {$sel:tagValues:CreateLFTag' :: NonEmpty Text
tagValues = NonEmpty Text
a} :: CreateLFTag) ((NonEmpty Text -> f (NonEmpty Text))
-> CreateLFTag -> f CreateLFTag)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateLFTag
-> f CreateLFTag
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateLFTag where
type AWSResponse CreateLFTag = CreateLFTagResponse
request :: CreateLFTag -> Request CreateLFTag
request = Service -> CreateLFTag -> Request CreateLFTag
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLFTag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLFTag)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateLFTag))
-> Logger
-> Service
-> Proxy CreateLFTag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLFTag)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreateLFTagResponse
CreateLFTagResponse'
(Int -> CreateLFTagResponse)
-> Either String Int -> Either String CreateLFTagResponse
forall (f :: * -> *) a b. Functor 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 CreateLFTag
instance Prelude.NFData CreateLFTag
instance Core.ToHeaders CreateLFTag where
toHeaders :: CreateLFTag -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateLFTag -> 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.CreateLFTag" ::
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 CreateLFTag where
toJSON :: CreateLFTag -> Value
toJSON CreateLFTag' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:CreateLFTag' :: CreateLFTag -> NonEmpty Text
$sel:tagKey:CreateLFTag' :: CreateLFTag -> Text
$sel:catalogId:CreateLFTag' :: CreateLFTag -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagValues" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
tagValues)
]
)
instance Core.ToPath CreateLFTag where
toPath :: CreateLFTag -> ByteString
toPath = ByteString -> CreateLFTag -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLFTag where
toQuery :: CreateLFTag -> QueryString
toQuery = QueryString -> CreateLFTag -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLFTagResponse = CreateLFTagResponse'
{
CreateLFTagResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateLFTagResponse -> CreateLFTagResponse -> Bool
(CreateLFTagResponse -> CreateLFTagResponse -> Bool)
-> (CreateLFTagResponse -> CreateLFTagResponse -> Bool)
-> Eq CreateLFTagResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLFTagResponse -> CreateLFTagResponse -> Bool
$c/= :: CreateLFTagResponse -> CreateLFTagResponse -> Bool
== :: CreateLFTagResponse -> CreateLFTagResponse -> Bool
$c== :: CreateLFTagResponse -> CreateLFTagResponse -> Bool
Prelude.Eq, ReadPrec [CreateLFTagResponse]
ReadPrec CreateLFTagResponse
Int -> ReadS CreateLFTagResponse
ReadS [CreateLFTagResponse]
(Int -> ReadS CreateLFTagResponse)
-> ReadS [CreateLFTagResponse]
-> ReadPrec CreateLFTagResponse
-> ReadPrec [CreateLFTagResponse]
-> Read CreateLFTagResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLFTagResponse]
$creadListPrec :: ReadPrec [CreateLFTagResponse]
readPrec :: ReadPrec CreateLFTagResponse
$creadPrec :: ReadPrec CreateLFTagResponse
readList :: ReadS [CreateLFTagResponse]
$creadList :: ReadS [CreateLFTagResponse]
readsPrec :: Int -> ReadS CreateLFTagResponse
$creadsPrec :: Int -> ReadS CreateLFTagResponse
Prelude.Read, Int -> CreateLFTagResponse -> ShowS
[CreateLFTagResponse] -> ShowS
CreateLFTagResponse -> String
(Int -> CreateLFTagResponse -> ShowS)
-> (CreateLFTagResponse -> String)
-> ([CreateLFTagResponse] -> ShowS)
-> Show CreateLFTagResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLFTagResponse] -> ShowS
$cshowList :: [CreateLFTagResponse] -> ShowS
show :: CreateLFTagResponse -> String
$cshow :: CreateLFTagResponse -> String
showsPrec :: Int -> CreateLFTagResponse -> ShowS
$cshowsPrec :: Int -> CreateLFTagResponse -> ShowS
Prelude.Show, (forall x. CreateLFTagResponse -> Rep CreateLFTagResponse x)
-> (forall x. Rep CreateLFTagResponse x -> CreateLFTagResponse)
-> Generic CreateLFTagResponse
forall x. Rep CreateLFTagResponse x -> CreateLFTagResponse
forall x. CreateLFTagResponse -> Rep CreateLFTagResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLFTagResponse x -> CreateLFTagResponse
$cfrom :: forall x. CreateLFTagResponse -> Rep CreateLFTagResponse x
Prelude.Generic)
newCreateLFTagResponse ::
Prelude.Int ->
CreateLFTagResponse
newCreateLFTagResponse :: Int -> CreateLFTagResponse
newCreateLFTagResponse Int
pHttpStatus_ =
CreateLFTagResponse' :: Int -> CreateLFTagResponse
CreateLFTagResponse' {$sel:httpStatus:CreateLFTagResponse' :: Int
httpStatus = Int
pHttpStatus_}
createLFTagResponse_httpStatus :: Lens.Lens' CreateLFTagResponse Prelude.Int
createLFTagResponse_httpStatus :: (Int -> f Int) -> CreateLFTagResponse -> f CreateLFTagResponse
createLFTagResponse_httpStatus = (CreateLFTagResponse -> Int)
-> (CreateLFTagResponse -> Int -> CreateLFTagResponse)
-> Lens CreateLFTagResponse CreateLFTagResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLFTagResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLFTagResponse' :: CreateLFTagResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLFTagResponse
s@CreateLFTagResponse' {} Int
a -> CreateLFTagResponse
s {$sel:httpStatus:CreateLFTagResponse' :: Int
httpStatus = Int
a} :: CreateLFTagResponse)
instance Prelude.NFData CreateLFTagResponse