{-# 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.PublishSchema
(
PublishSchema (..),
newPublishSchema,
publishSchema_minorVersion,
publishSchema_name,
publishSchema_developmentSchemaArn,
publishSchema_version,
PublishSchemaResponse (..),
newPublishSchemaResponse,
publishSchemaResponse_publishedSchemaArn,
publishSchemaResponse_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 PublishSchema = PublishSchema'
{
PublishSchema -> Maybe Text
minorVersion :: Prelude.Maybe Prelude.Text,
PublishSchema -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
PublishSchema -> Text
developmentSchemaArn :: Prelude.Text,
PublishSchema -> Text
version :: Prelude.Text
}
deriving (PublishSchema -> PublishSchema -> Bool
(PublishSchema -> PublishSchema -> Bool)
-> (PublishSchema -> PublishSchema -> Bool) -> Eq PublishSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishSchema -> PublishSchema -> Bool
$c/= :: PublishSchema -> PublishSchema -> Bool
== :: PublishSchema -> PublishSchema -> Bool
$c== :: PublishSchema -> PublishSchema -> Bool
Prelude.Eq, ReadPrec [PublishSchema]
ReadPrec PublishSchema
Int -> ReadS PublishSchema
ReadS [PublishSchema]
(Int -> ReadS PublishSchema)
-> ReadS [PublishSchema]
-> ReadPrec PublishSchema
-> ReadPrec [PublishSchema]
-> Read PublishSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublishSchema]
$creadListPrec :: ReadPrec [PublishSchema]
readPrec :: ReadPrec PublishSchema
$creadPrec :: ReadPrec PublishSchema
readList :: ReadS [PublishSchema]
$creadList :: ReadS [PublishSchema]
readsPrec :: Int -> ReadS PublishSchema
$creadsPrec :: Int -> ReadS PublishSchema
Prelude.Read, Int -> PublishSchema -> ShowS
[PublishSchema] -> ShowS
PublishSchema -> String
(Int -> PublishSchema -> ShowS)
-> (PublishSchema -> String)
-> ([PublishSchema] -> ShowS)
-> Show PublishSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishSchema] -> ShowS
$cshowList :: [PublishSchema] -> ShowS
show :: PublishSchema -> String
$cshow :: PublishSchema -> String
showsPrec :: Int -> PublishSchema -> ShowS
$cshowsPrec :: Int -> PublishSchema -> ShowS
Prelude.Show, (forall x. PublishSchema -> Rep PublishSchema x)
-> (forall x. Rep PublishSchema x -> PublishSchema)
-> Generic PublishSchema
forall x. Rep PublishSchema x -> PublishSchema
forall x. PublishSchema -> Rep PublishSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublishSchema x -> PublishSchema
$cfrom :: forall x. PublishSchema -> Rep PublishSchema x
Prelude.Generic)
newPublishSchema ::
Prelude.Text ->
Prelude.Text ->
PublishSchema
newPublishSchema :: Text -> Text -> PublishSchema
newPublishSchema Text
pDevelopmentSchemaArn_ Text
pVersion_ =
PublishSchema' :: Maybe Text -> Maybe Text -> Text -> Text -> PublishSchema
PublishSchema'
{ $sel:minorVersion:PublishSchema' :: Maybe Text
minorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:PublishSchema' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:developmentSchemaArn:PublishSchema' :: Text
developmentSchemaArn = Text
pDevelopmentSchemaArn_,
$sel:version:PublishSchema' :: Text
version = Text
pVersion_
}
publishSchema_minorVersion :: Lens.Lens' PublishSchema (Prelude.Maybe Prelude.Text)
publishSchema_minorVersion :: (Maybe Text -> f (Maybe Text)) -> PublishSchema -> f PublishSchema
publishSchema_minorVersion = (PublishSchema -> Maybe Text)
-> (PublishSchema -> Maybe Text -> PublishSchema)
-> Lens PublishSchema PublishSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchema' {Maybe Text
minorVersion :: Maybe Text
$sel:minorVersion:PublishSchema' :: PublishSchema -> Maybe Text
minorVersion} -> Maybe Text
minorVersion) (\s :: PublishSchema
s@PublishSchema' {} Maybe Text
a -> PublishSchema
s {$sel:minorVersion:PublishSchema' :: Maybe Text
minorVersion = Maybe Text
a} :: PublishSchema)
publishSchema_name :: Lens.Lens' PublishSchema (Prelude.Maybe Prelude.Text)
publishSchema_name :: (Maybe Text -> f (Maybe Text)) -> PublishSchema -> f PublishSchema
publishSchema_name = (PublishSchema -> Maybe Text)
-> (PublishSchema -> Maybe Text -> PublishSchema)
-> Lens PublishSchema PublishSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchema' {Maybe Text
name :: Maybe Text
$sel:name:PublishSchema' :: PublishSchema -> Maybe Text
name} -> Maybe Text
name) (\s :: PublishSchema
s@PublishSchema' {} Maybe Text
a -> PublishSchema
s {$sel:name:PublishSchema' :: Maybe Text
name = Maybe Text
a} :: PublishSchema)
publishSchema_developmentSchemaArn :: Lens.Lens' PublishSchema Prelude.Text
publishSchema_developmentSchemaArn :: (Text -> f Text) -> PublishSchema -> f PublishSchema
publishSchema_developmentSchemaArn = (PublishSchema -> Text)
-> (PublishSchema -> Text -> PublishSchema)
-> Lens PublishSchema PublishSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchema' {Text
developmentSchemaArn :: Text
$sel:developmentSchemaArn:PublishSchema' :: PublishSchema -> Text
developmentSchemaArn} -> Text
developmentSchemaArn) (\s :: PublishSchema
s@PublishSchema' {} Text
a -> PublishSchema
s {$sel:developmentSchemaArn:PublishSchema' :: Text
developmentSchemaArn = Text
a} :: PublishSchema)
publishSchema_version :: Lens.Lens' PublishSchema Prelude.Text
publishSchema_version :: (Text -> f Text) -> PublishSchema -> f PublishSchema
publishSchema_version = (PublishSchema -> Text)
-> (PublishSchema -> Text -> PublishSchema)
-> Lens PublishSchema PublishSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchema' {Text
version :: Text
$sel:version:PublishSchema' :: PublishSchema -> Text
version} -> Text
version) (\s :: PublishSchema
s@PublishSchema' {} Text
a -> PublishSchema
s {$sel:version:PublishSchema' :: Text
version = Text
a} :: PublishSchema)
instance Core.AWSRequest PublishSchema where
type
AWSResponse PublishSchema =
PublishSchemaResponse
request :: PublishSchema -> Request PublishSchema
request = Service -> PublishSchema -> Request PublishSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PublishSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PublishSchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PublishSchema))
-> Logger
-> Service
-> Proxy PublishSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PublishSchema)))
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 -> PublishSchemaResponse
PublishSchemaResponse'
(Maybe Text -> Int -> PublishSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PublishSchemaResponse)
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
"PublishedSchemaArn")
Either String (Int -> PublishSchemaResponse)
-> Either String Int -> Either String PublishSchemaResponse
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 PublishSchema
instance Prelude.NFData PublishSchema
instance Core.ToHeaders PublishSchema where
toHeaders :: PublishSchema -> ResponseHeaders
toHeaders PublishSchema' {Maybe Text
Text
version :: Text
developmentSchemaArn :: Text
name :: Maybe Text
minorVersion :: Maybe Text
$sel:version:PublishSchema' :: PublishSchema -> Text
$sel:developmentSchemaArn:PublishSchema' :: PublishSchema -> Text
$sel:name:PublishSchema' :: PublishSchema -> Maybe Text
$sel:minorVersion:PublishSchema' :: PublishSchema -> Maybe 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
developmentSchemaArn]
instance Core.ToJSON PublishSchema where
toJSON :: PublishSchema -> Value
toJSON PublishSchema' {Maybe Text
Text
version :: Text
developmentSchemaArn :: Text
name :: Maybe Text
minorVersion :: Maybe Text
$sel:version:PublishSchema' :: PublishSchema -> Text
$sel:developmentSchemaArn:PublishSchema' :: PublishSchema -> Text
$sel:name:PublishSchema' :: PublishSchema -> Maybe Text
$sel:minorVersion:PublishSchema' :: PublishSchema -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MinorVersion" 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
minorVersion,
(Text
"Name" 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
name,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
]
)
instance Core.ToPath PublishSchema where
toPath :: PublishSchema -> ByteString
toPath =
ByteString -> PublishSchema -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/publish"
instance Core.ToQuery PublishSchema where
toQuery :: PublishSchema -> QueryString
toQuery = QueryString -> PublishSchema -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PublishSchemaResponse = PublishSchemaResponse'
{
PublishSchemaResponse -> Maybe Text
publishedSchemaArn :: Prelude.Maybe Prelude.Text,
PublishSchemaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PublishSchemaResponse -> PublishSchemaResponse -> Bool
(PublishSchemaResponse -> PublishSchemaResponse -> Bool)
-> (PublishSchemaResponse -> PublishSchemaResponse -> Bool)
-> Eq PublishSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishSchemaResponse -> PublishSchemaResponse -> Bool
$c/= :: PublishSchemaResponse -> PublishSchemaResponse -> Bool
== :: PublishSchemaResponse -> PublishSchemaResponse -> Bool
$c== :: PublishSchemaResponse -> PublishSchemaResponse -> Bool
Prelude.Eq, ReadPrec [PublishSchemaResponse]
ReadPrec PublishSchemaResponse
Int -> ReadS PublishSchemaResponse
ReadS [PublishSchemaResponse]
(Int -> ReadS PublishSchemaResponse)
-> ReadS [PublishSchemaResponse]
-> ReadPrec PublishSchemaResponse
-> ReadPrec [PublishSchemaResponse]
-> Read PublishSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublishSchemaResponse]
$creadListPrec :: ReadPrec [PublishSchemaResponse]
readPrec :: ReadPrec PublishSchemaResponse
$creadPrec :: ReadPrec PublishSchemaResponse
readList :: ReadS [PublishSchemaResponse]
$creadList :: ReadS [PublishSchemaResponse]
readsPrec :: Int -> ReadS PublishSchemaResponse
$creadsPrec :: Int -> ReadS PublishSchemaResponse
Prelude.Read, Int -> PublishSchemaResponse -> ShowS
[PublishSchemaResponse] -> ShowS
PublishSchemaResponse -> String
(Int -> PublishSchemaResponse -> ShowS)
-> (PublishSchemaResponse -> String)
-> ([PublishSchemaResponse] -> ShowS)
-> Show PublishSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishSchemaResponse] -> ShowS
$cshowList :: [PublishSchemaResponse] -> ShowS
show :: PublishSchemaResponse -> String
$cshow :: PublishSchemaResponse -> String
showsPrec :: Int -> PublishSchemaResponse -> ShowS
$cshowsPrec :: Int -> PublishSchemaResponse -> ShowS
Prelude.Show, (forall x. PublishSchemaResponse -> Rep PublishSchemaResponse x)
-> (forall x. Rep PublishSchemaResponse x -> PublishSchemaResponse)
-> Generic PublishSchemaResponse
forall x. Rep PublishSchemaResponse x -> PublishSchemaResponse
forall x. PublishSchemaResponse -> Rep PublishSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublishSchemaResponse x -> PublishSchemaResponse
$cfrom :: forall x. PublishSchemaResponse -> Rep PublishSchemaResponse x
Prelude.Generic)
newPublishSchemaResponse ::
Prelude.Int ->
PublishSchemaResponse
newPublishSchemaResponse :: Int -> PublishSchemaResponse
newPublishSchemaResponse Int
pHttpStatus_ =
PublishSchemaResponse' :: Maybe Text -> Int -> PublishSchemaResponse
PublishSchemaResponse'
{ $sel:publishedSchemaArn:PublishSchemaResponse' :: Maybe Text
publishedSchemaArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PublishSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
publishSchemaResponse_publishedSchemaArn :: Lens.Lens' PublishSchemaResponse (Prelude.Maybe Prelude.Text)
publishSchemaResponse_publishedSchemaArn :: (Maybe Text -> f (Maybe Text))
-> PublishSchemaResponse -> f PublishSchemaResponse
publishSchemaResponse_publishedSchemaArn = (PublishSchemaResponse -> Maybe Text)
-> (PublishSchemaResponse -> Maybe Text -> PublishSchemaResponse)
-> Lens
PublishSchemaResponse
PublishSchemaResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchemaResponse' {Maybe Text
publishedSchemaArn :: Maybe Text
$sel:publishedSchemaArn:PublishSchemaResponse' :: PublishSchemaResponse -> Maybe Text
publishedSchemaArn} -> Maybe Text
publishedSchemaArn) (\s :: PublishSchemaResponse
s@PublishSchemaResponse' {} Maybe Text
a -> PublishSchemaResponse
s {$sel:publishedSchemaArn:PublishSchemaResponse' :: Maybe Text
publishedSchemaArn = Maybe Text
a} :: PublishSchemaResponse)
publishSchemaResponse_httpStatus :: Lens.Lens' PublishSchemaResponse Prelude.Int
publishSchemaResponse_httpStatus :: (Int -> f Int) -> PublishSchemaResponse -> f PublishSchemaResponse
publishSchemaResponse_httpStatus = (PublishSchemaResponse -> Int)
-> (PublishSchemaResponse -> Int -> PublishSchemaResponse)
-> Lens PublishSchemaResponse PublishSchemaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishSchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:PublishSchemaResponse' :: PublishSchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PublishSchemaResponse
s@PublishSchemaResponse' {} Int
a -> PublishSchemaResponse
s {$sel:httpStatus:PublishSchemaResponse' :: Int
httpStatus = Int
a} :: PublishSchemaResponse)
instance Prelude.NFData PublishSchemaResponse