{-# 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.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 PutSchemaFromJson = PutSchemaFromJson'
{
PutSchemaFromJson -> Text
schemaArn :: Prelude.Text,
PutSchemaFromJson -> Text
document :: Prelude.Text
}
deriving (PutSchemaFromJson -> PutSchemaFromJson -> Bool
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]
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
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. 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'
{ $sel:schemaArn:PutSchemaFromJson' :: Text
schemaArn = Text
pSchemaArn_,
$sel:document:PutSchemaFromJson' :: Text
document = Text
pDocument_
}
putSchemaFromJson_schemaArn :: Lens.Lens' PutSchemaFromJson Prelude.Text
putSchemaFromJson_schemaArn :: Lens' PutSchemaFromJson Text
putSchemaFromJson_schemaArn = 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 :: Lens' PutSchemaFromJson Text
putSchemaFromJson_document = 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 :: (Service -> Service)
-> PutSchemaFromJson -> Request PutSchemaFromJson
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutSchemaFromJson
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutSchemaFromJson)))
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 Text -> Int -> PutSchemaFromJsonResponse
PutSchemaFromJsonResponse'
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
"Arn")
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 PutSchemaFromJson where
hashWithSalt :: Int -> PutSchemaFromJson -> Int
hashWithSalt Int
_salt PutSchemaFromJson' {Text
document :: Text
schemaArn :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
schemaArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
document
instance Prelude.NFData PutSchemaFromJson where
rnf :: PutSchemaFromJson -> ()
rnf PutSchemaFromJson' {Text
document :: Text
schemaArn :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
schemaArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
document
instance Data.ToHeaders PutSchemaFromJson where
toHeaders :: PutSchemaFromJson -> ResponseHeaders
toHeaders PutSchemaFromJson' {Text
document :: Text
schemaArn :: Text
$sel:document:PutSchemaFromJson' :: PutSchemaFromJson -> Text
$sel:schemaArn:PutSchemaFromJson' :: PutSchemaFromJson -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
schemaArn]
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Document" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
document)]
)
instance Data.ToPath PutSchemaFromJson where
toPath :: PutSchemaFromJson -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/json"
instance Data.ToQuery PutSchemaFromJson where
toQuery :: PutSchemaFromJson -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:arn:PutSchemaFromJsonResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutSchemaFromJsonResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putSchemaFromJsonResponse_arn :: Lens.Lens' PutSchemaFromJsonResponse (Prelude.Maybe Prelude.Text)
putSchemaFromJsonResponse_arn :: Lens' PutSchemaFromJsonResponse (Maybe Text)
putSchemaFromJsonResponse_arn = 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 :: Lens' PutSchemaFromJsonResponse Int
putSchemaFromJsonResponse_httpStatus = 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 where
rnf :: PutSchemaFromJsonResponse -> ()
rnf PutSchemaFromJsonResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:PutSchemaFromJsonResponse' :: PutSchemaFromJsonResponse -> Int
$sel:arn:PutSchemaFromJsonResponse' :: PutSchemaFromJsonResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus