{-# 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.UpdateSchema
(
UpdateSchema (..),
newUpdateSchema,
updateSchema_schemaArn,
updateSchema_name,
UpdateSchemaResponse (..),
newUpdateSchemaResponse,
updateSchemaResponse_schemaArn,
updateSchemaResponse_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 UpdateSchema = UpdateSchema'
{
UpdateSchema -> Text
schemaArn :: Prelude.Text,
UpdateSchema -> Text
name :: Prelude.Text
}
deriving (UpdateSchema -> UpdateSchema -> Bool
(UpdateSchema -> UpdateSchema -> Bool)
-> (UpdateSchema -> UpdateSchema -> Bool) -> Eq UpdateSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSchema -> UpdateSchema -> Bool
$c/= :: UpdateSchema -> UpdateSchema -> Bool
== :: UpdateSchema -> UpdateSchema -> Bool
$c== :: UpdateSchema -> UpdateSchema -> Bool
Prelude.Eq, ReadPrec [UpdateSchema]
ReadPrec UpdateSchema
Int -> ReadS UpdateSchema
ReadS [UpdateSchema]
(Int -> ReadS UpdateSchema)
-> ReadS [UpdateSchema]
-> ReadPrec UpdateSchema
-> ReadPrec [UpdateSchema]
-> Read UpdateSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSchema]
$creadListPrec :: ReadPrec [UpdateSchema]
readPrec :: ReadPrec UpdateSchema
$creadPrec :: ReadPrec UpdateSchema
readList :: ReadS [UpdateSchema]
$creadList :: ReadS [UpdateSchema]
readsPrec :: Int -> ReadS UpdateSchema
$creadsPrec :: Int -> ReadS UpdateSchema
Prelude.Read, Int -> UpdateSchema -> ShowS
[UpdateSchema] -> ShowS
UpdateSchema -> String
(Int -> UpdateSchema -> ShowS)
-> (UpdateSchema -> String)
-> ([UpdateSchema] -> ShowS)
-> Show UpdateSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSchema] -> ShowS
$cshowList :: [UpdateSchema] -> ShowS
show :: UpdateSchema -> String
$cshow :: UpdateSchema -> String
showsPrec :: Int -> UpdateSchema -> ShowS
$cshowsPrec :: Int -> UpdateSchema -> ShowS
Prelude.Show, (forall x. UpdateSchema -> Rep UpdateSchema x)
-> (forall x. Rep UpdateSchema x -> UpdateSchema)
-> Generic UpdateSchema
forall x. Rep UpdateSchema x -> UpdateSchema
forall x. UpdateSchema -> Rep UpdateSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSchema x -> UpdateSchema
$cfrom :: forall x. UpdateSchema -> Rep UpdateSchema x
Prelude.Generic)
newUpdateSchema ::
Prelude.Text ->
Prelude.Text ->
UpdateSchema
newUpdateSchema :: Text -> Text -> UpdateSchema
newUpdateSchema Text
pSchemaArn_ Text
pName_ =
UpdateSchema' :: Text -> Text -> UpdateSchema
UpdateSchema'
{ $sel:schemaArn:UpdateSchema' :: Text
schemaArn = Text
pSchemaArn_,
$sel:name:UpdateSchema' :: Text
name = Text
pName_
}
updateSchema_schemaArn :: Lens.Lens' UpdateSchema Prelude.Text
updateSchema_schemaArn :: (Text -> f Text) -> UpdateSchema -> f UpdateSchema
updateSchema_schemaArn = (UpdateSchema -> Text)
-> (UpdateSchema -> Text -> UpdateSchema)
-> Lens UpdateSchema UpdateSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchema' {Text
schemaArn :: Text
$sel:schemaArn:UpdateSchema' :: UpdateSchema -> Text
schemaArn} -> Text
schemaArn) (\s :: UpdateSchema
s@UpdateSchema' {} Text
a -> UpdateSchema
s {$sel:schemaArn:UpdateSchema' :: Text
schemaArn = Text
a} :: UpdateSchema)
updateSchema_name :: Lens.Lens' UpdateSchema Prelude.Text
updateSchema_name :: (Text -> f Text) -> UpdateSchema -> f UpdateSchema
updateSchema_name = (UpdateSchema -> Text)
-> (UpdateSchema -> Text -> UpdateSchema)
-> Lens UpdateSchema UpdateSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchema' {Text
name :: Text
$sel:name:UpdateSchema' :: UpdateSchema -> Text
name} -> Text
name) (\s :: UpdateSchema
s@UpdateSchema' {} Text
a -> UpdateSchema
s {$sel:name:UpdateSchema' :: Text
name = Text
a} :: UpdateSchema)
instance Core.AWSRequest UpdateSchema where
type AWSResponse UpdateSchema = UpdateSchemaResponse
request :: UpdateSchema -> Request UpdateSchema
request = Service -> UpdateSchema -> Request UpdateSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSchema))
-> Logger
-> Service
-> Proxy UpdateSchema
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSchema)))
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 -> UpdateSchemaResponse
UpdateSchemaResponse'
(Maybe Text -> Int -> UpdateSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateSchemaResponse)
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
"SchemaArn")
Either String (Int -> UpdateSchemaResponse)
-> Either String Int -> Either String UpdateSchemaResponse
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 UpdateSchema
instance Prelude.NFData UpdateSchema
instance Core.ToHeaders UpdateSchema where
toHeaders :: UpdateSchema -> ResponseHeaders
toHeaders UpdateSchema' {Text
name :: Text
schemaArn :: Text
$sel:name:UpdateSchema' :: UpdateSchema -> Text
$sel:schemaArn:UpdateSchema' :: UpdateSchema -> 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 UpdateSchema where
toJSON :: UpdateSchema -> Value
toJSON UpdateSchema' {Text
name :: Text
schemaArn :: Text
$sel:name:UpdateSchema' :: UpdateSchema -> Text
$sel:schemaArn:UpdateSchema' :: UpdateSchema -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
)
instance Core.ToPath UpdateSchema where
toPath :: UpdateSchema -> ByteString
toPath =
ByteString -> UpdateSchema -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/update"
instance Core.ToQuery UpdateSchema where
toQuery :: UpdateSchema -> QueryString
toQuery = QueryString -> UpdateSchema -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSchemaResponse = UpdateSchemaResponse'
{
UpdateSchemaResponse -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
UpdateSchemaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSchemaResponse -> UpdateSchemaResponse -> Bool
(UpdateSchemaResponse -> UpdateSchemaResponse -> Bool)
-> (UpdateSchemaResponse -> UpdateSchemaResponse -> Bool)
-> Eq UpdateSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSchemaResponse -> UpdateSchemaResponse -> Bool
$c/= :: UpdateSchemaResponse -> UpdateSchemaResponse -> Bool
== :: UpdateSchemaResponse -> UpdateSchemaResponse -> Bool
$c== :: UpdateSchemaResponse -> UpdateSchemaResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSchemaResponse]
ReadPrec UpdateSchemaResponse
Int -> ReadS UpdateSchemaResponse
ReadS [UpdateSchemaResponse]
(Int -> ReadS UpdateSchemaResponse)
-> ReadS [UpdateSchemaResponse]
-> ReadPrec UpdateSchemaResponse
-> ReadPrec [UpdateSchemaResponse]
-> Read UpdateSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSchemaResponse]
$creadListPrec :: ReadPrec [UpdateSchemaResponse]
readPrec :: ReadPrec UpdateSchemaResponse
$creadPrec :: ReadPrec UpdateSchemaResponse
readList :: ReadS [UpdateSchemaResponse]
$creadList :: ReadS [UpdateSchemaResponse]
readsPrec :: Int -> ReadS UpdateSchemaResponse
$creadsPrec :: Int -> ReadS UpdateSchemaResponse
Prelude.Read, Int -> UpdateSchemaResponse -> ShowS
[UpdateSchemaResponse] -> ShowS
UpdateSchemaResponse -> String
(Int -> UpdateSchemaResponse -> ShowS)
-> (UpdateSchemaResponse -> String)
-> ([UpdateSchemaResponse] -> ShowS)
-> Show UpdateSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSchemaResponse] -> ShowS
$cshowList :: [UpdateSchemaResponse] -> ShowS
show :: UpdateSchemaResponse -> String
$cshow :: UpdateSchemaResponse -> String
showsPrec :: Int -> UpdateSchemaResponse -> ShowS
$cshowsPrec :: Int -> UpdateSchemaResponse -> ShowS
Prelude.Show, (forall x. UpdateSchemaResponse -> Rep UpdateSchemaResponse x)
-> (forall x. Rep UpdateSchemaResponse x -> UpdateSchemaResponse)
-> Generic UpdateSchemaResponse
forall x. Rep UpdateSchemaResponse x -> UpdateSchemaResponse
forall x. UpdateSchemaResponse -> Rep UpdateSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSchemaResponse x -> UpdateSchemaResponse
$cfrom :: forall x. UpdateSchemaResponse -> Rep UpdateSchemaResponse x
Prelude.Generic)
newUpdateSchemaResponse ::
Prelude.Int ->
UpdateSchemaResponse
newUpdateSchemaResponse :: Int -> UpdateSchemaResponse
newUpdateSchemaResponse Int
pHttpStatus_ =
UpdateSchemaResponse' :: Maybe Text -> Int -> UpdateSchemaResponse
UpdateSchemaResponse'
{ $sel:schemaArn:UpdateSchemaResponse' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSchemaResponse_schemaArn :: Lens.Lens' UpdateSchemaResponse (Prelude.Maybe Prelude.Text)
updateSchemaResponse_schemaArn :: (Maybe Text -> f (Maybe Text))
-> UpdateSchemaResponse -> f UpdateSchemaResponse
updateSchemaResponse_schemaArn = (UpdateSchemaResponse -> Maybe Text)
-> (UpdateSchemaResponse -> Maybe Text -> UpdateSchemaResponse)
-> Lens
UpdateSchemaResponse UpdateSchemaResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchemaResponse' {Maybe Text
schemaArn :: Maybe Text
$sel:schemaArn:UpdateSchemaResponse' :: UpdateSchemaResponse -> Maybe Text
schemaArn} -> Maybe Text
schemaArn) (\s :: UpdateSchemaResponse
s@UpdateSchemaResponse' {} Maybe Text
a -> UpdateSchemaResponse
s {$sel:schemaArn:UpdateSchemaResponse' :: Maybe Text
schemaArn = Maybe Text
a} :: UpdateSchemaResponse)
updateSchemaResponse_httpStatus :: Lens.Lens' UpdateSchemaResponse Prelude.Int
updateSchemaResponse_httpStatus :: (Int -> f Int) -> UpdateSchemaResponse -> f UpdateSchemaResponse
updateSchemaResponse_httpStatus = (UpdateSchemaResponse -> Int)
-> (UpdateSchemaResponse -> Int -> UpdateSchemaResponse)
-> Lens UpdateSchemaResponse UpdateSchemaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSchemaResponse' :: UpdateSchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSchemaResponse
s@UpdateSchemaResponse' {} Int
a -> UpdateSchemaResponse
s {$sel:httpStatus:UpdateSchemaResponse' :: Int
httpStatus = Int
a} :: UpdateSchemaResponse)
instance Prelude.NFData UpdateSchemaResponse