{-# 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.AppSync.StartSchemaCreation
(
StartSchemaCreation (..),
newStartSchemaCreation,
startSchemaCreation_apiId,
startSchemaCreation_definition,
StartSchemaCreationResponse (..),
newStartSchemaCreationResponse,
startSchemaCreationResponse_status,
startSchemaCreationResponse_httpStatus,
)
where
import Amazonka.AppSync.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartSchemaCreation = StartSchemaCreation'
{
StartSchemaCreation -> Text
apiId :: Prelude.Text,
StartSchemaCreation -> Base64
definition :: Data.Base64
}
deriving (StartSchemaCreation -> StartSchemaCreation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSchemaCreation -> StartSchemaCreation -> Bool
$c/= :: StartSchemaCreation -> StartSchemaCreation -> Bool
== :: StartSchemaCreation -> StartSchemaCreation -> Bool
$c== :: StartSchemaCreation -> StartSchemaCreation -> Bool
Prelude.Eq, ReadPrec [StartSchemaCreation]
ReadPrec StartSchemaCreation
Int -> ReadS StartSchemaCreation
ReadS [StartSchemaCreation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSchemaCreation]
$creadListPrec :: ReadPrec [StartSchemaCreation]
readPrec :: ReadPrec StartSchemaCreation
$creadPrec :: ReadPrec StartSchemaCreation
readList :: ReadS [StartSchemaCreation]
$creadList :: ReadS [StartSchemaCreation]
readsPrec :: Int -> ReadS StartSchemaCreation
$creadsPrec :: Int -> ReadS StartSchemaCreation
Prelude.Read, Int -> StartSchemaCreation -> ShowS
[StartSchemaCreation] -> ShowS
StartSchemaCreation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSchemaCreation] -> ShowS
$cshowList :: [StartSchemaCreation] -> ShowS
show :: StartSchemaCreation -> String
$cshow :: StartSchemaCreation -> String
showsPrec :: Int -> StartSchemaCreation -> ShowS
$cshowsPrec :: Int -> StartSchemaCreation -> ShowS
Prelude.Show, forall x. Rep StartSchemaCreation x -> StartSchemaCreation
forall x. StartSchemaCreation -> Rep StartSchemaCreation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSchemaCreation x -> StartSchemaCreation
$cfrom :: forall x. StartSchemaCreation -> Rep StartSchemaCreation x
Prelude.Generic)
newStartSchemaCreation ::
Prelude.Text ->
Prelude.ByteString ->
StartSchemaCreation
newStartSchemaCreation :: Text -> ByteString -> StartSchemaCreation
newStartSchemaCreation Text
pApiId_ ByteString
pDefinition_ =
StartSchemaCreation'
{ $sel:apiId:StartSchemaCreation' :: Text
apiId = Text
pApiId_,
$sel:definition:StartSchemaCreation' :: Base64
definition = Iso' Base64 ByteString
Data._Base64 forall t b. AReview t b -> b -> t
Lens.# ByteString
pDefinition_
}
startSchemaCreation_apiId :: Lens.Lens' StartSchemaCreation Prelude.Text
startSchemaCreation_apiId :: Lens' StartSchemaCreation Text
startSchemaCreation_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaCreation' {Text
apiId :: Text
$sel:apiId:StartSchemaCreation' :: StartSchemaCreation -> Text
apiId} -> Text
apiId) (\s :: StartSchemaCreation
s@StartSchemaCreation' {} Text
a -> StartSchemaCreation
s {$sel:apiId:StartSchemaCreation' :: Text
apiId = Text
a} :: StartSchemaCreation)
startSchemaCreation_definition :: Lens.Lens' StartSchemaCreation Prelude.ByteString
startSchemaCreation_definition :: Lens' StartSchemaCreation ByteString
startSchemaCreation_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaCreation' {Base64
definition :: Base64
$sel:definition:StartSchemaCreation' :: StartSchemaCreation -> Base64
definition} -> Base64
definition) (\s :: StartSchemaCreation
s@StartSchemaCreation' {} Base64
a -> StartSchemaCreation
s {$sel:definition:StartSchemaCreation' :: Base64
definition = Base64
a} :: StartSchemaCreation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Iso' Base64 ByteString
Data._Base64
instance Core.AWSRequest StartSchemaCreation where
type
AWSResponse StartSchemaCreation =
StartSchemaCreationResponse
request :: (Service -> Service)
-> StartSchemaCreation -> Request StartSchemaCreation
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartSchemaCreation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartSchemaCreation)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe SchemaStatus -> Int -> StartSchemaCreationResponse
StartSchemaCreationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"status")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable StartSchemaCreation where
hashWithSalt :: Int -> StartSchemaCreation -> Int
hashWithSalt Int
_salt StartSchemaCreation' {Text
Base64
definition :: Base64
apiId :: Text
$sel:definition:StartSchemaCreation' :: StartSchemaCreation -> Base64
$sel:apiId:StartSchemaCreation' :: StartSchemaCreation -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Base64
definition
instance Prelude.NFData StartSchemaCreation where
rnf :: StartSchemaCreation -> ()
rnf StartSchemaCreation' {Text
Base64
definition :: Base64
apiId :: Text
$sel:definition:StartSchemaCreation' :: StartSchemaCreation -> Base64
$sel:apiId:StartSchemaCreation' :: StartSchemaCreation -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
apiId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Base64
definition
instance Data.ToHeaders StartSchemaCreation where
toHeaders :: StartSchemaCreation -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON StartSchemaCreation where
toJSON :: StartSchemaCreation -> Value
toJSON StartSchemaCreation' {Text
Base64
definition :: Base64
apiId :: Text
$sel:definition:StartSchemaCreation' :: StartSchemaCreation -> Base64
$sel:apiId:StartSchemaCreation' :: StartSchemaCreation -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"definition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Base64
definition)]
)
instance Data.ToPath StartSchemaCreation where
toPath :: StartSchemaCreation -> ByteString
toPath StartSchemaCreation' {Text
Base64
definition :: Base64
apiId :: Text
$sel:definition:StartSchemaCreation' :: StartSchemaCreation -> Base64
$sel:apiId:StartSchemaCreation' :: StartSchemaCreation -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/schemacreation"]
instance Data.ToQuery StartSchemaCreation where
toQuery :: StartSchemaCreation -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartSchemaCreationResponse = StartSchemaCreationResponse'
{
StartSchemaCreationResponse -> Maybe SchemaStatus
status :: Prelude.Maybe SchemaStatus,
StartSchemaCreationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartSchemaCreationResponse -> StartSchemaCreationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSchemaCreationResponse -> StartSchemaCreationResponse -> Bool
$c/= :: StartSchemaCreationResponse -> StartSchemaCreationResponse -> Bool
== :: StartSchemaCreationResponse -> StartSchemaCreationResponse -> Bool
$c== :: StartSchemaCreationResponse -> StartSchemaCreationResponse -> Bool
Prelude.Eq, ReadPrec [StartSchemaCreationResponse]
ReadPrec StartSchemaCreationResponse
Int -> ReadS StartSchemaCreationResponse
ReadS [StartSchemaCreationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSchemaCreationResponse]
$creadListPrec :: ReadPrec [StartSchemaCreationResponse]
readPrec :: ReadPrec StartSchemaCreationResponse
$creadPrec :: ReadPrec StartSchemaCreationResponse
readList :: ReadS [StartSchemaCreationResponse]
$creadList :: ReadS [StartSchemaCreationResponse]
readsPrec :: Int -> ReadS StartSchemaCreationResponse
$creadsPrec :: Int -> ReadS StartSchemaCreationResponse
Prelude.Read, Int -> StartSchemaCreationResponse -> ShowS
[StartSchemaCreationResponse] -> ShowS
StartSchemaCreationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSchemaCreationResponse] -> ShowS
$cshowList :: [StartSchemaCreationResponse] -> ShowS
show :: StartSchemaCreationResponse -> String
$cshow :: StartSchemaCreationResponse -> String
showsPrec :: Int -> StartSchemaCreationResponse -> ShowS
$cshowsPrec :: Int -> StartSchemaCreationResponse -> ShowS
Prelude.Show, forall x.
Rep StartSchemaCreationResponse x -> StartSchemaCreationResponse
forall x.
StartSchemaCreationResponse -> Rep StartSchemaCreationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSchemaCreationResponse x -> StartSchemaCreationResponse
$cfrom :: forall x.
StartSchemaCreationResponse -> Rep StartSchemaCreationResponse x
Prelude.Generic)
newStartSchemaCreationResponse ::
Prelude.Int ->
StartSchemaCreationResponse
newStartSchemaCreationResponse :: Int -> StartSchemaCreationResponse
newStartSchemaCreationResponse Int
pHttpStatus_ =
StartSchemaCreationResponse'
{ $sel:status:StartSchemaCreationResponse' :: Maybe SchemaStatus
status =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartSchemaCreationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startSchemaCreationResponse_status :: Lens.Lens' StartSchemaCreationResponse (Prelude.Maybe SchemaStatus)
startSchemaCreationResponse_status :: Lens' StartSchemaCreationResponse (Maybe SchemaStatus)
startSchemaCreationResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaCreationResponse' {Maybe SchemaStatus
status :: Maybe SchemaStatus
$sel:status:StartSchemaCreationResponse' :: StartSchemaCreationResponse -> Maybe SchemaStatus
status} -> Maybe SchemaStatus
status) (\s :: StartSchemaCreationResponse
s@StartSchemaCreationResponse' {} Maybe SchemaStatus
a -> StartSchemaCreationResponse
s {$sel:status:StartSchemaCreationResponse' :: Maybe SchemaStatus
status = Maybe SchemaStatus
a} :: StartSchemaCreationResponse)
startSchemaCreationResponse_httpStatus :: Lens.Lens' StartSchemaCreationResponse Prelude.Int
startSchemaCreationResponse_httpStatus :: Lens' StartSchemaCreationResponse Int
startSchemaCreationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaCreationResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartSchemaCreationResponse' :: StartSchemaCreationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartSchemaCreationResponse
s@StartSchemaCreationResponse' {} Int
a -> StartSchemaCreationResponse
s {$sel:httpStatus:StartSchemaCreationResponse' :: Int
httpStatus = Int
a} :: StartSchemaCreationResponse)
instance Prelude.NFData StartSchemaCreationResponse where
rnf :: StartSchemaCreationResponse -> ()
rnf StartSchemaCreationResponse' {Int
Maybe SchemaStatus
httpStatus :: Int
status :: Maybe SchemaStatus
$sel:httpStatus:StartSchemaCreationResponse' :: StartSchemaCreationResponse -> Int
$sel:status:StartSchemaCreationResponse' :: StartSchemaCreationResponse -> Maybe SchemaStatus
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SchemaStatus
status
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus