{-# 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.CloudDirectory.PutSchemaFromJson
(
PutSchemaFromJson (..),
newPutSchemaFromJson,
putSchemaFromJson_schemaArn,
putSchemaFromJson_document,
PutSchemaFromJsonResponse (..),
newPutSchemaFromJsonResponse,
putSchemaFromJsonResponse_arn,
putSchemaFromJsonResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
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 qualified Amazonka.Response as Response
data PutSchemaFromJson = PutSchemaFromJson'
{
PutSchemaFromJson -> Text
schemaArn :: Prelude.Text,
PutSchemaFromJson -> Text
document :: Prelude.Text
}
deriving (PutSchemaFromJson -> PutSchemaFromJson -> Bool
(PutSchemaFromJson -> PutSchemaFromJson -> Bool)
-> (PutSchemaFromJson -> PutSchemaFromJson -> Bool)
-> Eq PutSchemaFromJson
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSchemaFromJson -> PutSchemaFromJson -> Bool
$c/= :: PutSchemaFromJson -> PutSchemaFromJson -> Bool
== :: PutSchemaFromJson -> PutSchemaFromJson -> Bool
$c== :: PutSchemaFromJson -> PutSchemaFromJson -> Bool
Prelude.Eq, ReadPrec [PutSchemaFromJson]
ReadPrec PutSchemaFromJson
Int -> ReadS PutSchemaFromJson
ReadS [PutSchemaFromJson]
(Int -> ReadS PutSchemaFromJson)
-> ReadS [PutSchemaFromJson]
-> ReadPrec PutSchemaFromJson
-> ReadPrec [PutSchemaFromJson]
-> Read PutSchemaFromJson
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutSchemaFromJson]
$creadListPrec :: ReadPrec [PutSchemaFromJson]
readPrec :: ReadPrec PutSchemaFromJson
$creadPrec :: ReadPrec PutSchemaFromJson
readList :: ReadS [PutSchemaFromJson]
$creadList :: ReadS [PutSchemaFromJson]
readsPrec :: Int -> ReadS PutSchemaFromJson
$creadsPrec :: Int -> ReadS PutSchemaFromJson
Prelude.Read, Int -> PutSchemaFromJson -> ShowS
[PutSchemaFromJson] -> ShowS
PutSchemaFromJson -> String
(Int -> PutSchemaFromJson -> ShowS)
-> (PutSchemaFromJson -> String)
-> ([PutSchemaFromJson] -> ShowS)
-> Show PutSchemaFromJson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSchemaFromJson] -> ShowS
$cshowList :: [PutSchemaFromJson] -> ShowS
show :: PutSchemaFromJson -> String
$cshow :: PutSchemaFromJson -> String
showsPrec :: Int -> PutSchemaFromJson -> ShowS
$cshowsPrec :: Int -> PutSchemaFromJson -> ShowS
Prelude.Show, (forall x. PutSchemaFromJson -> Rep PutSchemaFromJson x)
-> (forall x. Rep PutSchemaFromJson x -> PutSchemaFromJson)
-> Generic PutSchemaFromJson
forall x. Rep PutSchemaFromJson x -> PutSchemaFromJson
forall x. PutSchemaFromJson -> Rep PutSchemaFromJson x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutSchemaFromJson x -> PutSchemaFromJson
$cfrom :: forall x. PutSchemaFromJson -> Rep PutSchemaFromJson x
Prelude.Generic)
newPutSchemaFromJson ::
Prelude.Text ->
Prelude.Text ->
PutSchemaFromJson
newPutSchemaFromJson :: Text -> Text -> PutSchemaFromJson
newPutSchemaFromJson Text
pSchemaArn_ Text
pDocument_ =
PutSchemaFromJson' :: Text -> Text -> PutSchemaFromJson
PutSchemaFromJson'
{ $sel:schemaArn:PutSchemaFromJson' :: Text
schemaArn = Text
pSchemaArn_,
$sel:document:PutSchemaFromJson' :: Text
document = Text
pDocument_
}
putSchemaFromJson_schemaArn :: Lens.Lens' PutSchemaFromJson Prelude.Text
putSchemaFromJson_schemaArn :: (Text -> f Text) -> PutSchemaFromJson -> f PutSchemaFromJson
putSchemaFromJson_schemaArn = (PutSchemaFromJson -> Text)
-> (PutSchemaFromJson -> Text -> PutSchemaFromJson)
-> Lens PutSchemaFromJson PutSchemaFromJson Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSchemaFromJson' {Text
schemaArn :: Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
schemaArn} -> Text
schemaArn) (\s :: PutSchemaFromJson
s@PutSchemaFromJson' {} Text
a -> PutSchemaFromJson
s {$sel:schemaArn:PutSchemaFromJson' :: Text
schemaArn = Text
a} :: PutSchemaFromJson)
putSchemaFromJson_document :: Lens.Lens' PutSchemaFromJson Prelude.Text
putSchemaFromJson_document :: (Text -> f Text) -> PutSchemaFromJson -> f PutSchemaFromJson
putSchemaFromJson_document = (PutSchemaFromJson -> Text)
-> (PutSchemaFromJson -> Text -> PutSchemaFromJson)
-> Lens PutSchemaFromJson PutSchemaFromJson Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSchemaFromJson' {Text
document :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
document} -> Text
document) (\s :: PutSchemaFromJson
s@PutSchemaFromJson' {} Text
a -> PutSchemaFromJson
s {$sel:document:PutSchemaFromJson' :: Text
document = Text
a} :: PutSchemaFromJson)
instance Core.AWSRequest PutSchemaFromJson where
type
AWSResponse PutSchemaFromJson =
PutSchemaFromJsonResponse
request :: PutSchemaFromJson -> Request PutSchemaFromJson
request = Service -> PutSchemaFromJson -> Request PutSchemaFromJson
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutSchemaFromJson
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSchemaFromJson)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutSchemaFromJson))
-> Logger
-> Service
-> Proxy PutSchemaFromJson
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSchemaFromJson)))
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 -> PutSchemaFromJsonResponse
PutSchemaFromJsonResponse'
(Maybe Text -> Int -> PutSchemaFromJsonResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutSchemaFromJsonResponse)
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
"Arn")
Either String (Int -> PutSchemaFromJsonResponse)
-> Either String Int -> Either String PutSchemaFromJsonResponse
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 PutSchemaFromJson
instance Prelude.NFData PutSchemaFromJson
instance Core.ToHeaders PutSchemaFromJson where
toHeaders :: PutSchemaFromJson -> ResponseHeaders
toHeaders PutSchemaFromJson' {Text
document :: Text
schemaArn :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
schemaArn]
instance Core.ToJSON PutSchemaFromJson where
toJSON :: PutSchemaFromJson -> Value
toJSON PutSchemaFromJson' {Text
document :: Text
schemaArn :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Document" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
document)]
)
instance Core.ToPath PutSchemaFromJson where
toPath :: PutSchemaFromJson -> ByteString
toPath =
ByteString -> PutSchemaFromJson -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/json"
instance Core.ToQuery PutSchemaFromJson where
toQuery :: PutSchemaFromJson -> QueryString
toQuery = QueryString -> PutSchemaFromJson -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutSchemaFromJsonResponse = PutSchemaFromJsonResponse'
{
PutSchemaFromJsonResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
PutSchemaFromJsonResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool
(PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool)
-> (PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool)
-> Eq PutSchemaFromJsonResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool
$c/= :: PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool
== :: PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool
$c== :: PutSchemaFromJsonResponse -> PutSchemaFromJsonResponse -> Bool
Prelude.Eq, ReadPrec [PutSchemaFromJsonResponse]
ReadPrec PutSchemaFromJsonResponse
Int -> ReadS PutSchemaFromJsonResponse
ReadS [PutSchemaFromJsonResponse]
(Int -> ReadS PutSchemaFromJsonResponse)
-> ReadS [PutSchemaFromJsonResponse]
-> ReadPrec PutSchemaFromJsonResponse
-> ReadPrec [PutSchemaFromJsonResponse]
-> Read PutSchemaFromJsonResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutSchemaFromJsonResponse]
$creadListPrec :: ReadPrec [PutSchemaFromJsonResponse]
readPrec :: ReadPrec PutSchemaFromJsonResponse
$creadPrec :: ReadPrec PutSchemaFromJsonResponse
readList :: ReadS [PutSchemaFromJsonResponse]
$creadList :: ReadS [PutSchemaFromJsonResponse]
readsPrec :: Int -> ReadS PutSchemaFromJsonResponse
$creadsPrec :: Int -> ReadS PutSchemaFromJsonResponse
Prelude.Read, Int -> PutSchemaFromJsonResponse -> ShowS
[PutSchemaFromJsonResponse] -> ShowS
PutSchemaFromJsonResponse -> String
(Int -> PutSchemaFromJsonResponse -> ShowS)
-> (PutSchemaFromJsonResponse -> String)
-> ([PutSchemaFromJsonResponse] -> ShowS)
-> Show PutSchemaFromJsonResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutSchemaFromJsonResponse] -> ShowS
$cshowList :: [PutSchemaFromJsonResponse] -> ShowS
show :: PutSchemaFromJsonResponse -> String
$cshow :: PutSchemaFromJsonResponse -> String
showsPrec :: Int -> PutSchemaFromJsonResponse -> ShowS
$cshowsPrec :: Int -> PutSchemaFromJsonResponse -> ShowS
Prelude.Show, (forall x.
PutSchemaFromJsonResponse -> Rep PutSchemaFromJsonResponse x)
-> (forall x.
Rep PutSchemaFromJsonResponse x -> PutSchemaFromJsonResponse)
-> Generic PutSchemaFromJsonResponse
forall x.
Rep PutSchemaFromJsonResponse x -> PutSchemaFromJsonResponse
forall x.
PutSchemaFromJsonResponse -> Rep PutSchemaFromJsonResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutSchemaFromJsonResponse x -> PutSchemaFromJsonResponse
$cfrom :: forall x.
PutSchemaFromJsonResponse -> Rep PutSchemaFromJsonResponse x
Prelude.Generic)
newPutSchemaFromJsonResponse ::
Prelude.Int ->
PutSchemaFromJsonResponse
newPutSchemaFromJsonResponse :: Int -> PutSchemaFromJsonResponse
newPutSchemaFromJsonResponse Int
pHttpStatus_ =
PutSchemaFromJsonResponse' :: Maybe Text -> Int -> PutSchemaFromJsonResponse
PutSchemaFromJsonResponse'
{ $sel:arn:PutSchemaFromJsonResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutSchemaFromJsonResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putSchemaFromJsonResponse_arn :: Lens.Lens' PutSchemaFromJsonResponse (Prelude.Maybe Prelude.Text)
putSchemaFromJsonResponse_arn :: (Maybe Text -> f (Maybe Text))
-> PutSchemaFromJsonResponse -> f PutSchemaFromJsonResponse
putSchemaFromJsonResponse_arn = (PutSchemaFromJsonResponse -> Maybe Text)
-> (PutSchemaFromJsonResponse
-> Maybe Text -> PutSchemaFromJsonResponse)
-> Lens
PutSchemaFromJsonResponse
PutSchemaFromJsonResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSchemaFromJsonResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:PutSchemaFromJsonResponse' :: PutSchemaFromJsonResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PutSchemaFromJsonResponse
s@PutSchemaFromJsonResponse' {} Maybe Text
a -> PutSchemaFromJsonResponse
s {$sel:arn:PutSchemaFromJsonResponse' :: Maybe Text
arn = Maybe Text
a} :: PutSchemaFromJsonResponse)
putSchemaFromJsonResponse_httpStatus :: Lens.Lens' PutSchemaFromJsonResponse Prelude.Int
putSchemaFromJsonResponse_httpStatus :: (Int -> f Int)
-> PutSchemaFromJsonResponse -> f PutSchemaFromJsonResponse
putSchemaFromJsonResponse_httpStatus = (PutSchemaFromJsonResponse -> Int)
-> (PutSchemaFromJsonResponse -> Int -> PutSchemaFromJsonResponse)
-> Lens PutSchemaFromJsonResponse PutSchemaFromJsonResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutSchemaFromJsonResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutSchemaFromJsonResponse' :: PutSchemaFromJsonResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutSchemaFromJsonResponse
s@PutSchemaFromJsonResponse' {} Int
a -> PutSchemaFromJsonResponse
s {$sel:httpStatus:PutSchemaFromJsonResponse' :: Int
httpStatus = Int
a} :: PutSchemaFromJsonResponse)
instance Prelude.NFData PutSchemaFromJsonResponse