{-# 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.Glue.CreateBlueprint
(
CreateBlueprint (..),
newCreateBlueprint,
createBlueprint_description,
createBlueprint_tags,
createBlueprint_name,
createBlueprint_blueprintLocation,
CreateBlueprintResponse (..),
newCreateBlueprintResponse,
createBlueprintResponse_name,
createBlueprintResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.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 CreateBlueprint = CreateBlueprint'
{
CreateBlueprint -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateBlueprint -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateBlueprint -> Text
name :: Prelude.Text,
CreateBlueprint -> Text
blueprintLocation :: Prelude.Text
}
deriving (CreateBlueprint -> CreateBlueprint -> Bool
(CreateBlueprint -> CreateBlueprint -> Bool)
-> (CreateBlueprint -> CreateBlueprint -> Bool)
-> Eq CreateBlueprint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBlueprint -> CreateBlueprint -> Bool
$c/= :: CreateBlueprint -> CreateBlueprint -> Bool
== :: CreateBlueprint -> CreateBlueprint -> Bool
$c== :: CreateBlueprint -> CreateBlueprint -> Bool
Prelude.Eq, ReadPrec [CreateBlueprint]
ReadPrec CreateBlueprint
Int -> ReadS CreateBlueprint
ReadS [CreateBlueprint]
(Int -> ReadS CreateBlueprint)
-> ReadS [CreateBlueprint]
-> ReadPrec CreateBlueprint
-> ReadPrec [CreateBlueprint]
-> Read CreateBlueprint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBlueprint]
$creadListPrec :: ReadPrec [CreateBlueprint]
readPrec :: ReadPrec CreateBlueprint
$creadPrec :: ReadPrec CreateBlueprint
readList :: ReadS [CreateBlueprint]
$creadList :: ReadS [CreateBlueprint]
readsPrec :: Int -> ReadS CreateBlueprint
$creadsPrec :: Int -> ReadS CreateBlueprint
Prelude.Read, Int -> CreateBlueprint -> ShowS
[CreateBlueprint] -> ShowS
CreateBlueprint -> String
(Int -> CreateBlueprint -> ShowS)
-> (CreateBlueprint -> String)
-> ([CreateBlueprint] -> ShowS)
-> Show CreateBlueprint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBlueprint] -> ShowS
$cshowList :: [CreateBlueprint] -> ShowS
show :: CreateBlueprint -> String
$cshow :: CreateBlueprint -> String
showsPrec :: Int -> CreateBlueprint -> ShowS
$cshowsPrec :: Int -> CreateBlueprint -> ShowS
Prelude.Show, (forall x. CreateBlueprint -> Rep CreateBlueprint x)
-> (forall x. Rep CreateBlueprint x -> CreateBlueprint)
-> Generic CreateBlueprint
forall x. Rep CreateBlueprint x -> CreateBlueprint
forall x. CreateBlueprint -> Rep CreateBlueprint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBlueprint x -> CreateBlueprint
$cfrom :: forall x. CreateBlueprint -> Rep CreateBlueprint x
Prelude.Generic)
newCreateBlueprint ::
Prelude.Text ->
Prelude.Text ->
CreateBlueprint
newCreateBlueprint :: Text -> Text -> CreateBlueprint
newCreateBlueprint Text
pName_ Text
pBlueprintLocation_ =
CreateBlueprint' :: Maybe Text
-> Maybe (HashMap Text Text) -> Text -> Text -> CreateBlueprint
CreateBlueprint'
{ $sel:description:CreateBlueprint' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateBlueprint' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateBlueprint' :: Text
name = Text
pName_,
$sel:blueprintLocation:CreateBlueprint' :: Text
blueprintLocation = Text
pBlueprintLocation_
}
createBlueprint_description :: Lens.Lens' CreateBlueprint (Prelude.Maybe Prelude.Text)
createBlueprint_description :: (Maybe Text -> f (Maybe Text))
-> CreateBlueprint -> f CreateBlueprint
createBlueprint_description = (CreateBlueprint -> Maybe Text)
-> (CreateBlueprint -> Maybe Text -> CreateBlueprint)
-> Lens CreateBlueprint CreateBlueprint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprint' {Maybe Text
description :: Maybe Text
$sel:description:CreateBlueprint' :: CreateBlueprint -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateBlueprint
s@CreateBlueprint' {} Maybe Text
a -> CreateBlueprint
s {$sel:description:CreateBlueprint' :: Maybe Text
description = Maybe Text
a} :: CreateBlueprint)
createBlueprint_tags :: Lens.Lens' CreateBlueprint (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createBlueprint_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBlueprint -> f CreateBlueprint
createBlueprint_tags = (CreateBlueprint -> Maybe (HashMap Text Text))
-> (CreateBlueprint
-> Maybe (HashMap Text Text) -> CreateBlueprint)
-> Lens
CreateBlueprint
CreateBlueprint
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprint' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateBlueprint' :: CreateBlueprint -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateBlueprint
s@CreateBlueprint' {} Maybe (HashMap Text Text)
a -> CreateBlueprint
s {$sel:tags:CreateBlueprint' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateBlueprint) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBlueprint -> f CreateBlueprint)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBlueprint
-> f CreateBlueprint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text 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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createBlueprint_name :: Lens.Lens' CreateBlueprint Prelude.Text
createBlueprint_name :: (Text -> f Text) -> CreateBlueprint -> f CreateBlueprint
createBlueprint_name = (CreateBlueprint -> Text)
-> (CreateBlueprint -> Text -> CreateBlueprint)
-> Lens CreateBlueprint CreateBlueprint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprint' {Text
name :: Text
$sel:name:CreateBlueprint' :: CreateBlueprint -> Text
name} -> Text
name) (\s :: CreateBlueprint
s@CreateBlueprint' {} Text
a -> CreateBlueprint
s {$sel:name:CreateBlueprint' :: Text
name = Text
a} :: CreateBlueprint)
createBlueprint_blueprintLocation :: Lens.Lens' CreateBlueprint Prelude.Text
createBlueprint_blueprintLocation :: (Text -> f Text) -> CreateBlueprint -> f CreateBlueprint
createBlueprint_blueprintLocation = (CreateBlueprint -> Text)
-> (CreateBlueprint -> Text -> CreateBlueprint)
-> Lens CreateBlueprint CreateBlueprint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprint' {Text
blueprintLocation :: Text
$sel:blueprintLocation:CreateBlueprint' :: CreateBlueprint -> Text
blueprintLocation} -> Text
blueprintLocation) (\s :: CreateBlueprint
s@CreateBlueprint' {} Text
a -> CreateBlueprint
s {$sel:blueprintLocation:CreateBlueprint' :: Text
blueprintLocation = Text
a} :: CreateBlueprint)
instance Core.AWSRequest CreateBlueprint where
type
AWSResponse CreateBlueprint =
CreateBlueprintResponse
request :: CreateBlueprint -> Request CreateBlueprint
request = Service -> CreateBlueprint -> Request CreateBlueprint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateBlueprint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBlueprint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateBlueprint))
-> Logger
-> Service
-> Proxy CreateBlueprint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBlueprint)))
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 -> CreateBlueprintResponse
CreateBlueprintResponse'
(Maybe Text -> Int -> CreateBlueprintResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateBlueprintResponse)
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
"Name")
Either String (Int -> CreateBlueprintResponse)
-> Either String Int -> Either String CreateBlueprintResponse
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 CreateBlueprint
instance Prelude.NFData CreateBlueprint
instance Core.ToHeaders CreateBlueprint where
toHeaders :: CreateBlueprint -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateBlueprint -> 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
"AWSGlue.CreateBlueprint" :: 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 CreateBlueprint where
toJSON :: CreateBlueprint -> Value
toJSON CreateBlueprint' {Maybe Text
Maybe (HashMap Text Text)
Text
blueprintLocation :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:blueprintLocation:CreateBlueprint' :: CreateBlueprint -> Text
$sel:name:CreateBlueprint' :: CreateBlueprint -> Text
$sel:tags:CreateBlueprint' :: CreateBlueprint -> Maybe (HashMap Text Text)
$sel:description:CreateBlueprint' :: CreateBlueprint -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Description" 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
description,
(Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"BlueprintLocation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
blueprintLocation)
]
)
instance Core.ToPath CreateBlueprint where
toPath :: CreateBlueprint -> ByteString
toPath = ByteString -> CreateBlueprint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateBlueprint where
toQuery :: CreateBlueprint -> QueryString
toQuery = QueryString -> CreateBlueprint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateBlueprintResponse = CreateBlueprintResponse'
{
CreateBlueprintResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
CreateBlueprintResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateBlueprintResponse -> CreateBlueprintResponse -> Bool
(CreateBlueprintResponse -> CreateBlueprintResponse -> Bool)
-> (CreateBlueprintResponse -> CreateBlueprintResponse -> Bool)
-> Eq CreateBlueprintResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBlueprintResponse -> CreateBlueprintResponse -> Bool
$c/= :: CreateBlueprintResponse -> CreateBlueprintResponse -> Bool
== :: CreateBlueprintResponse -> CreateBlueprintResponse -> Bool
$c== :: CreateBlueprintResponse -> CreateBlueprintResponse -> Bool
Prelude.Eq, ReadPrec [CreateBlueprintResponse]
ReadPrec CreateBlueprintResponse
Int -> ReadS CreateBlueprintResponse
ReadS [CreateBlueprintResponse]
(Int -> ReadS CreateBlueprintResponse)
-> ReadS [CreateBlueprintResponse]
-> ReadPrec CreateBlueprintResponse
-> ReadPrec [CreateBlueprintResponse]
-> Read CreateBlueprintResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBlueprintResponse]
$creadListPrec :: ReadPrec [CreateBlueprintResponse]
readPrec :: ReadPrec CreateBlueprintResponse
$creadPrec :: ReadPrec CreateBlueprintResponse
readList :: ReadS [CreateBlueprintResponse]
$creadList :: ReadS [CreateBlueprintResponse]
readsPrec :: Int -> ReadS CreateBlueprintResponse
$creadsPrec :: Int -> ReadS CreateBlueprintResponse
Prelude.Read, Int -> CreateBlueprintResponse -> ShowS
[CreateBlueprintResponse] -> ShowS
CreateBlueprintResponse -> String
(Int -> CreateBlueprintResponse -> ShowS)
-> (CreateBlueprintResponse -> String)
-> ([CreateBlueprintResponse] -> ShowS)
-> Show CreateBlueprintResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBlueprintResponse] -> ShowS
$cshowList :: [CreateBlueprintResponse] -> ShowS
show :: CreateBlueprintResponse -> String
$cshow :: CreateBlueprintResponse -> String
showsPrec :: Int -> CreateBlueprintResponse -> ShowS
$cshowsPrec :: Int -> CreateBlueprintResponse -> ShowS
Prelude.Show, (forall x.
CreateBlueprintResponse -> Rep CreateBlueprintResponse x)
-> (forall x.
Rep CreateBlueprintResponse x -> CreateBlueprintResponse)
-> Generic CreateBlueprintResponse
forall x. Rep CreateBlueprintResponse x -> CreateBlueprintResponse
forall x. CreateBlueprintResponse -> Rep CreateBlueprintResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBlueprintResponse x -> CreateBlueprintResponse
$cfrom :: forall x. CreateBlueprintResponse -> Rep CreateBlueprintResponse x
Prelude.Generic)
newCreateBlueprintResponse ::
Prelude.Int ->
CreateBlueprintResponse
newCreateBlueprintResponse :: Int -> CreateBlueprintResponse
newCreateBlueprintResponse Int
pHttpStatus_ =
CreateBlueprintResponse' :: Maybe Text -> Int -> CreateBlueprintResponse
CreateBlueprintResponse'
{ $sel:name:CreateBlueprintResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateBlueprintResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createBlueprintResponse_name :: Lens.Lens' CreateBlueprintResponse (Prelude.Maybe Prelude.Text)
createBlueprintResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateBlueprintResponse -> f CreateBlueprintResponse
createBlueprintResponse_name = (CreateBlueprintResponse -> Maybe Text)
-> (CreateBlueprintResponse
-> Maybe Text -> CreateBlueprintResponse)
-> Lens
CreateBlueprintResponse
CreateBlueprintResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprintResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateBlueprintResponse' :: CreateBlueprintResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateBlueprintResponse
s@CreateBlueprintResponse' {} Maybe Text
a -> CreateBlueprintResponse
s {$sel:name:CreateBlueprintResponse' :: Maybe Text
name = Maybe Text
a} :: CreateBlueprintResponse)
createBlueprintResponse_httpStatus :: Lens.Lens' CreateBlueprintResponse Prelude.Int
createBlueprintResponse_httpStatus :: (Int -> f Int)
-> CreateBlueprintResponse -> f CreateBlueprintResponse
createBlueprintResponse_httpStatus = (CreateBlueprintResponse -> Int)
-> (CreateBlueprintResponse -> Int -> CreateBlueprintResponse)
-> Lens CreateBlueprintResponse CreateBlueprintResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBlueprintResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBlueprintResponse' :: CreateBlueprintResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBlueprintResponse
s@CreateBlueprintResponse' {} Int
a -> CreateBlueprintResponse
s {$sel:httpStatus:CreateBlueprintResponse' :: Int
httpStatus = Int
a} :: CreateBlueprintResponse)
instance Prelude.NFData CreateBlueprintResponse