{-# 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.ApplySchema
(
ApplySchema (..),
newApplySchema,
applySchema_publishedSchemaArn,
applySchema_directoryArn,
ApplySchemaResponse (..),
newApplySchemaResponse,
applySchemaResponse_directoryArn,
applySchemaResponse_appliedSchemaArn,
applySchemaResponse_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 ApplySchema = ApplySchema'
{
ApplySchema -> Text
publishedSchemaArn :: Prelude.Text,
ApplySchema -> Text
directoryArn :: Prelude.Text
}
deriving (ApplySchema -> ApplySchema -> Bool
(ApplySchema -> ApplySchema -> Bool)
-> (ApplySchema -> ApplySchema -> Bool) -> Eq ApplySchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplySchema -> ApplySchema -> Bool
$c/= :: ApplySchema -> ApplySchema -> Bool
== :: ApplySchema -> ApplySchema -> Bool
$c== :: ApplySchema -> ApplySchema -> Bool
Prelude.Eq, ReadPrec [ApplySchema]
ReadPrec ApplySchema
Int -> ReadS ApplySchema
ReadS [ApplySchema]
(Int -> ReadS ApplySchema)
-> ReadS [ApplySchema]
-> ReadPrec ApplySchema
-> ReadPrec [ApplySchema]
-> Read ApplySchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplySchema]
$creadListPrec :: ReadPrec [ApplySchema]
readPrec :: ReadPrec ApplySchema
$creadPrec :: ReadPrec ApplySchema
readList :: ReadS [ApplySchema]
$creadList :: ReadS [ApplySchema]
readsPrec :: Int -> ReadS ApplySchema
$creadsPrec :: Int -> ReadS ApplySchema
Prelude.Read, Int -> ApplySchema -> ShowS
[ApplySchema] -> ShowS
ApplySchema -> String
(Int -> ApplySchema -> ShowS)
-> (ApplySchema -> String)
-> ([ApplySchema] -> ShowS)
-> Show ApplySchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplySchema] -> ShowS
$cshowList :: [ApplySchema] -> ShowS
show :: ApplySchema -> String
$cshow :: ApplySchema -> String
showsPrec :: Int -> ApplySchema -> ShowS
$cshowsPrec :: Int -> ApplySchema -> ShowS
Prelude.Show, (forall x. ApplySchema -> Rep ApplySchema x)
-> (forall x. Rep ApplySchema x -> ApplySchema)
-> Generic ApplySchema
forall x. Rep ApplySchema x -> ApplySchema
forall x. ApplySchema -> Rep ApplySchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplySchema x -> ApplySchema
$cfrom :: forall x. ApplySchema -> Rep ApplySchema x
Prelude.Generic)
newApplySchema ::
Prelude.Text ->
Prelude.Text ->
ApplySchema
newApplySchema :: Text -> Text -> ApplySchema
newApplySchema Text
pPublishedSchemaArn_ Text
pDirectoryArn_ =
ApplySchema' :: Text -> Text -> ApplySchema
ApplySchema'
{ $sel:publishedSchemaArn:ApplySchema' :: Text
publishedSchemaArn =
Text
pPublishedSchemaArn_,
$sel:directoryArn:ApplySchema' :: Text
directoryArn = Text
pDirectoryArn_
}
applySchema_publishedSchemaArn :: Lens.Lens' ApplySchema Prelude.Text
applySchema_publishedSchemaArn :: (Text -> f Text) -> ApplySchema -> f ApplySchema
applySchema_publishedSchemaArn = (ApplySchema -> Text)
-> (ApplySchema -> Text -> ApplySchema)
-> Lens ApplySchema ApplySchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplySchema' {Text
publishedSchemaArn :: Text
$sel:publishedSchemaArn:ApplySchema' :: ApplySchema -> Text
publishedSchemaArn} -> Text
publishedSchemaArn) (\s :: ApplySchema
s@ApplySchema' {} Text
a -> ApplySchema
s {$sel:publishedSchemaArn:ApplySchema' :: Text
publishedSchemaArn = Text
a} :: ApplySchema)
applySchema_directoryArn :: Lens.Lens' ApplySchema Prelude.Text
applySchema_directoryArn :: (Text -> f Text) -> ApplySchema -> f ApplySchema
applySchema_directoryArn = (ApplySchema -> Text)
-> (ApplySchema -> Text -> ApplySchema)
-> Lens ApplySchema ApplySchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplySchema' {Text
directoryArn :: Text
$sel:directoryArn:ApplySchema' :: ApplySchema -> Text
directoryArn} -> Text
directoryArn) (\s :: ApplySchema
s@ApplySchema' {} Text
a -> ApplySchema
s {$sel:directoryArn:ApplySchema' :: Text
directoryArn = Text
a} :: ApplySchema)
instance Core.AWSRequest ApplySchema where
type AWSResponse ApplySchema = ApplySchemaResponse
request :: ApplySchema -> Request ApplySchema
request = Service -> ApplySchema -> Request ApplySchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ApplySchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ApplySchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ApplySchema))
-> Logger
-> Service
-> Proxy ApplySchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ApplySchema)))
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 -> Maybe Text -> Int -> ApplySchemaResponse
ApplySchemaResponse'
(Maybe Text -> Maybe Text -> Int -> ApplySchemaResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ApplySchemaResponse)
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
"DirectoryArn")
Either String (Maybe Text -> Int -> ApplySchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ApplySchemaResponse)
forall (f :: * -> *) a b. Applicative f => 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
"AppliedSchemaArn")
Either String (Int -> ApplySchemaResponse)
-> Either String Int -> Either String ApplySchemaResponse
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 ApplySchema
instance Prelude.NFData ApplySchema
instance Core.ToHeaders ApplySchema where
toHeaders :: ApplySchema -> ResponseHeaders
toHeaders ApplySchema' {Text
directoryArn :: Text
publishedSchemaArn :: Text
$sel:directoryArn:ApplySchema' :: ApplySchema -> Text
$sel:publishedSchemaArn:ApplySchema' :: ApplySchema -> 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
directoryArn]
instance Core.ToJSON ApplySchema where
toJSON :: ApplySchema -> Value
toJSON ApplySchema' {Text
directoryArn :: Text
publishedSchemaArn :: Text
$sel:directoryArn:ApplySchema' :: ApplySchema -> Text
$sel:publishedSchemaArn:ApplySchema' :: ApplySchema -> 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
"PublishedSchemaArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
publishedSchemaArn)
]
)
instance Core.ToPath ApplySchema where
toPath :: ApplySchema -> ByteString
toPath =
ByteString -> ApplySchema -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/apply"
instance Core.ToQuery ApplySchema where
toQuery :: ApplySchema -> QueryString
toQuery = QueryString -> ApplySchema -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ApplySchemaResponse = ApplySchemaResponse'
{
ApplySchemaResponse -> Maybe Text
directoryArn :: Prelude.Maybe Prelude.Text,
ApplySchemaResponse -> Maybe Text
appliedSchemaArn :: Prelude.Maybe Prelude.Text,
ApplySchemaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ApplySchemaResponse -> ApplySchemaResponse -> Bool
(ApplySchemaResponse -> ApplySchemaResponse -> Bool)
-> (ApplySchemaResponse -> ApplySchemaResponse -> Bool)
-> Eq ApplySchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplySchemaResponse -> ApplySchemaResponse -> Bool
$c/= :: ApplySchemaResponse -> ApplySchemaResponse -> Bool
== :: ApplySchemaResponse -> ApplySchemaResponse -> Bool
$c== :: ApplySchemaResponse -> ApplySchemaResponse -> Bool
Prelude.Eq, ReadPrec [ApplySchemaResponse]
ReadPrec ApplySchemaResponse
Int -> ReadS ApplySchemaResponse
ReadS [ApplySchemaResponse]
(Int -> ReadS ApplySchemaResponse)
-> ReadS [ApplySchemaResponse]
-> ReadPrec ApplySchemaResponse
-> ReadPrec [ApplySchemaResponse]
-> Read ApplySchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplySchemaResponse]
$creadListPrec :: ReadPrec [ApplySchemaResponse]
readPrec :: ReadPrec ApplySchemaResponse
$creadPrec :: ReadPrec ApplySchemaResponse
readList :: ReadS [ApplySchemaResponse]
$creadList :: ReadS [ApplySchemaResponse]
readsPrec :: Int -> ReadS ApplySchemaResponse
$creadsPrec :: Int -> ReadS ApplySchemaResponse
Prelude.Read, Int -> ApplySchemaResponse -> ShowS
[ApplySchemaResponse] -> ShowS
ApplySchemaResponse -> String
(Int -> ApplySchemaResponse -> ShowS)
-> (ApplySchemaResponse -> String)
-> ([ApplySchemaResponse] -> ShowS)
-> Show ApplySchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplySchemaResponse] -> ShowS
$cshowList :: [ApplySchemaResponse] -> ShowS
show :: ApplySchemaResponse -> String
$cshow :: ApplySchemaResponse -> String
showsPrec :: Int -> ApplySchemaResponse -> ShowS
$cshowsPrec :: Int -> ApplySchemaResponse -> ShowS
Prelude.Show, (forall x. ApplySchemaResponse -> Rep ApplySchemaResponse x)
-> (forall x. Rep ApplySchemaResponse x -> ApplySchemaResponse)
-> Generic ApplySchemaResponse
forall x. Rep ApplySchemaResponse x -> ApplySchemaResponse
forall x. ApplySchemaResponse -> Rep ApplySchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplySchemaResponse x -> ApplySchemaResponse
$cfrom :: forall x. ApplySchemaResponse -> Rep ApplySchemaResponse x
Prelude.Generic)
newApplySchemaResponse ::
Prelude.Int ->
ApplySchemaResponse
newApplySchemaResponse :: Int -> ApplySchemaResponse
newApplySchemaResponse Int
pHttpStatus_ =
ApplySchemaResponse' :: Maybe Text -> Maybe Text -> Int -> ApplySchemaResponse
ApplySchemaResponse'
{ $sel:directoryArn:ApplySchemaResponse' :: Maybe Text
directoryArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:appliedSchemaArn:ApplySchemaResponse' :: Maybe Text
appliedSchemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ApplySchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
applySchemaResponse_directoryArn :: Lens.Lens' ApplySchemaResponse (Prelude.Maybe Prelude.Text)
applySchemaResponse_directoryArn :: (Maybe Text -> f (Maybe Text))
-> ApplySchemaResponse -> f ApplySchemaResponse
applySchemaResponse_directoryArn = (ApplySchemaResponse -> Maybe Text)
-> (ApplySchemaResponse -> Maybe Text -> ApplySchemaResponse)
-> Lens
ApplySchemaResponse ApplySchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplySchemaResponse' {Maybe Text
directoryArn :: Maybe Text
$sel:directoryArn:ApplySchemaResponse' :: ApplySchemaResponse -> Maybe Text
directoryArn} -> Maybe Text
directoryArn) (\s :: ApplySchemaResponse
s@ApplySchemaResponse' {} Maybe Text
a -> ApplySchemaResponse
s {$sel:directoryArn:ApplySchemaResponse' :: Maybe Text
directoryArn = Maybe Text
a} :: ApplySchemaResponse)
applySchemaResponse_appliedSchemaArn :: Lens.Lens' ApplySchemaResponse (Prelude.Maybe Prelude.Text)
applySchemaResponse_appliedSchemaArn :: (Maybe Text -> f (Maybe Text))
-> ApplySchemaResponse -> f ApplySchemaResponse
applySchemaResponse_appliedSchemaArn = (ApplySchemaResponse -> Maybe Text)
-> (ApplySchemaResponse -> Maybe Text -> ApplySchemaResponse)
-> Lens
ApplySchemaResponse ApplySchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplySchemaResponse' {Maybe Text
appliedSchemaArn :: Maybe Text
$sel:appliedSchemaArn:ApplySchemaResponse' :: ApplySchemaResponse -> Maybe Text
appliedSchemaArn} -> Maybe Text
appliedSchemaArn) (\s :: ApplySchemaResponse
s@ApplySchemaResponse' {} Maybe Text
a -> ApplySchemaResponse
s {$sel:appliedSchemaArn:ApplySchemaResponse' :: Maybe Text
appliedSchemaArn = Maybe Text
a} :: ApplySchemaResponse)
applySchemaResponse_httpStatus :: Lens.Lens' ApplySchemaResponse Prelude.Int
applySchemaResponse_httpStatus :: (Int -> f Int) -> ApplySchemaResponse -> f ApplySchemaResponse
applySchemaResponse_httpStatus = (ApplySchemaResponse -> Int)
-> (ApplySchemaResponse -> Int -> ApplySchemaResponse)
-> Lens ApplySchemaResponse ApplySchemaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplySchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:ApplySchemaResponse' :: ApplySchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ApplySchemaResponse
s@ApplySchemaResponse' {} Int
a -> ApplySchemaResponse
s {$sel:httpStatus:ApplySchemaResponse' :: Int
httpStatus = Int
a} :: ApplySchemaResponse)
instance Prelude.NFData ApplySchemaResponse