{-# 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.UpgradePublishedSchema
(
UpgradePublishedSchema (..),
newUpgradePublishedSchema,
upgradePublishedSchema_dryRun,
upgradePublishedSchema_developmentSchemaArn,
upgradePublishedSchema_publishedSchemaArn,
upgradePublishedSchema_minorVersion,
UpgradePublishedSchemaResponse (..),
newUpgradePublishedSchemaResponse,
upgradePublishedSchemaResponse_upgradedSchemaArn,
upgradePublishedSchemaResponse_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 UpgradePublishedSchema = UpgradePublishedSchema'
{
UpgradePublishedSchema -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
UpgradePublishedSchema -> Text
developmentSchemaArn :: Prelude.Text,
UpgradePublishedSchema -> Text
publishedSchemaArn :: Prelude.Text,
UpgradePublishedSchema -> Text
minorVersion :: Prelude.Text
}
deriving (UpgradePublishedSchema -> UpgradePublishedSchema -> Bool
(UpgradePublishedSchema -> UpgradePublishedSchema -> Bool)
-> (UpgradePublishedSchema -> UpgradePublishedSchema -> Bool)
-> Eq UpgradePublishedSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradePublishedSchema -> UpgradePublishedSchema -> Bool
$c/= :: UpgradePublishedSchema -> UpgradePublishedSchema -> Bool
== :: UpgradePublishedSchema -> UpgradePublishedSchema -> Bool
$c== :: UpgradePublishedSchema -> UpgradePublishedSchema -> Bool
Prelude.Eq, ReadPrec [UpgradePublishedSchema]
ReadPrec UpgradePublishedSchema
Int -> ReadS UpgradePublishedSchema
ReadS [UpgradePublishedSchema]
(Int -> ReadS UpgradePublishedSchema)
-> ReadS [UpgradePublishedSchema]
-> ReadPrec UpgradePublishedSchema
-> ReadPrec [UpgradePublishedSchema]
-> Read UpgradePublishedSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradePublishedSchema]
$creadListPrec :: ReadPrec [UpgradePublishedSchema]
readPrec :: ReadPrec UpgradePublishedSchema
$creadPrec :: ReadPrec UpgradePublishedSchema
readList :: ReadS [UpgradePublishedSchema]
$creadList :: ReadS [UpgradePublishedSchema]
readsPrec :: Int -> ReadS UpgradePublishedSchema
$creadsPrec :: Int -> ReadS UpgradePublishedSchema
Prelude.Read, Int -> UpgradePublishedSchema -> ShowS
[UpgradePublishedSchema] -> ShowS
UpgradePublishedSchema -> String
(Int -> UpgradePublishedSchema -> ShowS)
-> (UpgradePublishedSchema -> String)
-> ([UpgradePublishedSchema] -> ShowS)
-> Show UpgradePublishedSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradePublishedSchema] -> ShowS
$cshowList :: [UpgradePublishedSchema] -> ShowS
show :: UpgradePublishedSchema -> String
$cshow :: UpgradePublishedSchema -> String
showsPrec :: Int -> UpgradePublishedSchema -> ShowS
$cshowsPrec :: Int -> UpgradePublishedSchema -> ShowS
Prelude.Show, (forall x. UpgradePublishedSchema -> Rep UpgradePublishedSchema x)
-> (forall x.
Rep UpgradePublishedSchema x -> UpgradePublishedSchema)
-> Generic UpgradePublishedSchema
forall x. Rep UpgradePublishedSchema x -> UpgradePublishedSchema
forall x. UpgradePublishedSchema -> Rep UpgradePublishedSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpgradePublishedSchema x -> UpgradePublishedSchema
$cfrom :: forall x. UpgradePublishedSchema -> Rep UpgradePublishedSchema x
Prelude.Generic)
newUpgradePublishedSchema ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpgradePublishedSchema
newUpgradePublishedSchema :: Text -> Text -> Text -> UpgradePublishedSchema
newUpgradePublishedSchema
Text
pDevelopmentSchemaArn_
Text
pPublishedSchemaArn_
Text
pMinorVersion_ =
UpgradePublishedSchema' :: Maybe Bool -> Text -> Text -> Text -> UpgradePublishedSchema
UpgradePublishedSchema'
{ $sel:dryRun:UpgradePublishedSchema' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:developmentSchemaArn:UpgradePublishedSchema' :: Text
developmentSchemaArn = Text
pDevelopmentSchemaArn_,
$sel:publishedSchemaArn:UpgradePublishedSchema' :: Text
publishedSchemaArn = Text
pPublishedSchemaArn_,
$sel:minorVersion:UpgradePublishedSchema' :: Text
minorVersion = Text
pMinorVersion_
}
upgradePublishedSchema_dryRun :: Lens.Lens' UpgradePublishedSchema (Prelude.Maybe Prelude.Bool)
upgradePublishedSchema_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> UpgradePublishedSchema -> f UpgradePublishedSchema
upgradePublishedSchema_dryRun = (UpgradePublishedSchema -> Maybe Bool)
-> (UpgradePublishedSchema -> Maybe Bool -> UpgradePublishedSchema)
-> Lens
UpgradePublishedSchema
UpgradePublishedSchema
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchema' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:UpgradePublishedSchema' :: UpgradePublishedSchema -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: UpgradePublishedSchema
s@UpgradePublishedSchema' {} Maybe Bool
a -> UpgradePublishedSchema
s {$sel:dryRun:UpgradePublishedSchema' :: Maybe Bool
dryRun = Maybe Bool
a} :: UpgradePublishedSchema)
upgradePublishedSchema_developmentSchemaArn :: Lens.Lens' UpgradePublishedSchema Prelude.Text
upgradePublishedSchema_developmentSchemaArn :: (Text -> f Text)
-> UpgradePublishedSchema -> f UpgradePublishedSchema
upgradePublishedSchema_developmentSchemaArn = (UpgradePublishedSchema -> Text)
-> (UpgradePublishedSchema -> Text -> UpgradePublishedSchema)
-> Lens UpgradePublishedSchema UpgradePublishedSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchema' {Text
developmentSchemaArn :: Text
$sel:developmentSchemaArn:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
developmentSchemaArn} -> Text
developmentSchemaArn) (\s :: UpgradePublishedSchema
s@UpgradePublishedSchema' {} Text
a -> UpgradePublishedSchema
s {$sel:developmentSchemaArn:UpgradePublishedSchema' :: Text
developmentSchemaArn = Text
a} :: UpgradePublishedSchema)
upgradePublishedSchema_publishedSchemaArn :: Lens.Lens' UpgradePublishedSchema Prelude.Text
upgradePublishedSchema_publishedSchemaArn :: (Text -> f Text)
-> UpgradePublishedSchema -> f UpgradePublishedSchema
upgradePublishedSchema_publishedSchemaArn = (UpgradePublishedSchema -> Text)
-> (UpgradePublishedSchema -> Text -> UpgradePublishedSchema)
-> Lens UpgradePublishedSchema UpgradePublishedSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchema' {Text
publishedSchemaArn :: Text
$sel:publishedSchemaArn:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
publishedSchemaArn} -> Text
publishedSchemaArn) (\s :: UpgradePublishedSchema
s@UpgradePublishedSchema' {} Text
a -> UpgradePublishedSchema
s {$sel:publishedSchemaArn:UpgradePublishedSchema' :: Text
publishedSchemaArn = Text
a} :: UpgradePublishedSchema)
upgradePublishedSchema_minorVersion :: Lens.Lens' UpgradePublishedSchema Prelude.Text
upgradePublishedSchema_minorVersion :: (Text -> f Text)
-> UpgradePublishedSchema -> f UpgradePublishedSchema
upgradePublishedSchema_minorVersion = (UpgradePublishedSchema -> Text)
-> (UpgradePublishedSchema -> Text -> UpgradePublishedSchema)
-> Lens UpgradePublishedSchema UpgradePublishedSchema Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchema' {Text
minorVersion :: Text
$sel:minorVersion:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
minorVersion} -> Text
minorVersion) (\s :: UpgradePublishedSchema
s@UpgradePublishedSchema' {} Text
a -> UpgradePublishedSchema
s {$sel:minorVersion:UpgradePublishedSchema' :: Text
minorVersion = Text
a} :: UpgradePublishedSchema)
instance Core.AWSRequest UpgradePublishedSchema where
type
AWSResponse UpgradePublishedSchema =
UpgradePublishedSchemaResponse
request :: UpgradePublishedSchema -> Request UpgradePublishedSchema
request = Service -> UpgradePublishedSchema -> Request UpgradePublishedSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpgradePublishedSchema
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpgradePublishedSchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpgradePublishedSchema))
-> Logger
-> Service
-> Proxy UpgradePublishedSchema
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpgradePublishedSchema)))
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 -> UpgradePublishedSchemaResponse
UpgradePublishedSchemaResponse'
(Maybe Text -> Int -> UpgradePublishedSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpgradePublishedSchemaResponse)
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
"UpgradedSchemaArn")
Either String (Int -> UpgradePublishedSchemaResponse)
-> Either String Int
-> Either String UpgradePublishedSchemaResponse
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 UpgradePublishedSchema
instance Prelude.NFData UpgradePublishedSchema
instance Core.ToHeaders UpgradePublishedSchema where
toHeaders :: UpgradePublishedSchema -> ResponseHeaders
toHeaders = ResponseHeaders -> UpgradePublishedSchema -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpgradePublishedSchema where
toJSON :: UpgradePublishedSchema -> Value
toJSON UpgradePublishedSchema' {Maybe Bool
Text
minorVersion :: Text
publishedSchemaArn :: Text
developmentSchemaArn :: Text
dryRun :: Maybe Bool
$sel:minorVersion:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
$sel:publishedSchemaArn:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
$sel:developmentSchemaArn:UpgradePublishedSchema' :: UpgradePublishedSchema -> Text
$sel:dryRun:UpgradePublishedSchema' :: UpgradePublishedSchema -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"DevelopmentSchemaArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
developmentSchemaArn
),
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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MinorVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
minorVersion)
]
)
instance Core.ToPath UpgradePublishedSchema where
toPath :: UpgradePublishedSchema -> ByteString
toPath =
ByteString -> UpgradePublishedSchema -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/schema/upgradepublished"
instance Core.ToQuery UpgradePublishedSchema where
toQuery :: UpgradePublishedSchema -> QueryString
toQuery = QueryString -> UpgradePublishedSchema -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpgradePublishedSchemaResponse = UpgradePublishedSchemaResponse'
{
UpgradePublishedSchemaResponse -> Maybe Text
upgradedSchemaArn :: Prelude.Maybe Prelude.Text,
UpgradePublishedSchemaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool
(UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool)
-> (UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool)
-> Eq UpgradePublishedSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool
$c/= :: UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool
== :: UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool
$c== :: UpgradePublishedSchemaResponse
-> UpgradePublishedSchemaResponse -> Bool
Prelude.Eq, ReadPrec [UpgradePublishedSchemaResponse]
ReadPrec UpgradePublishedSchemaResponse
Int -> ReadS UpgradePublishedSchemaResponse
ReadS [UpgradePublishedSchemaResponse]
(Int -> ReadS UpgradePublishedSchemaResponse)
-> ReadS [UpgradePublishedSchemaResponse]
-> ReadPrec UpgradePublishedSchemaResponse
-> ReadPrec [UpgradePublishedSchemaResponse]
-> Read UpgradePublishedSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradePublishedSchemaResponse]
$creadListPrec :: ReadPrec [UpgradePublishedSchemaResponse]
readPrec :: ReadPrec UpgradePublishedSchemaResponse
$creadPrec :: ReadPrec UpgradePublishedSchemaResponse
readList :: ReadS [UpgradePublishedSchemaResponse]
$creadList :: ReadS [UpgradePublishedSchemaResponse]
readsPrec :: Int -> ReadS UpgradePublishedSchemaResponse
$creadsPrec :: Int -> ReadS UpgradePublishedSchemaResponse
Prelude.Read, Int -> UpgradePublishedSchemaResponse -> ShowS
[UpgradePublishedSchemaResponse] -> ShowS
UpgradePublishedSchemaResponse -> String
(Int -> UpgradePublishedSchemaResponse -> ShowS)
-> (UpgradePublishedSchemaResponse -> String)
-> ([UpgradePublishedSchemaResponse] -> ShowS)
-> Show UpgradePublishedSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradePublishedSchemaResponse] -> ShowS
$cshowList :: [UpgradePublishedSchemaResponse] -> ShowS
show :: UpgradePublishedSchemaResponse -> String
$cshow :: UpgradePublishedSchemaResponse -> String
showsPrec :: Int -> UpgradePublishedSchemaResponse -> ShowS
$cshowsPrec :: Int -> UpgradePublishedSchemaResponse -> ShowS
Prelude.Show, (forall x.
UpgradePublishedSchemaResponse
-> Rep UpgradePublishedSchemaResponse x)
-> (forall x.
Rep UpgradePublishedSchemaResponse x
-> UpgradePublishedSchemaResponse)
-> Generic UpgradePublishedSchemaResponse
forall x.
Rep UpgradePublishedSchemaResponse x
-> UpgradePublishedSchemaResponse
forall x.
UpgradePublishedSchemaResponse
-> Rep UpgradePublishedSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpgradePublishedSchemaResponse x
-> UpgradePublishedSchemaResponse
$cfrom :: forall x.
UpgradePublishedSchemaResponse
-> Rep UpgradePublishedSchemaResponse x
Prelude.Generic)
newUpgradePublishedSchemaResponse ::
Prelude.Int ->
UpgradePublishedSchemaResponse
newUpgradePublishedSchemaResponse :: Int -> UpgradePublishedSchemaResponse
newUpgradePublishedSchemaResponse Int
pHttpStatus_ =
UpgradePublishedSchemaResponse' :: Maybe Text -> Int -> UpgradePublishedSchemaResponse
UpgradePublishedSchemaResponse'
{ $sel:upgradedSchemaArn:UpgradePublishedSchemaResponse' :: Maybe Text
upgradedSchemaArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpgradePublishedSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
upgradePublishedSchemaResponse_upgradedSchemaArn :: Lens.Lens' UpgradePublishedSchemaResponse (Prelude.Maybe Prelude.Text)
upgradePublishedSchemaResponse_upgradedSchemaArn :: (Maybe Text -> f (Maybe Text))
-> UpgradePublishedSchemaResponse
-> f UpgradePublishedSchemaResponse
upgradePublishedSchemaResponse_upgradedSchemaArn = (UpgradePublishedSchemaResponse -> Maybe Text)
-> (UpgradePublishedSchemaResponse
-> Maybe Text -> UpgradePublishedSchemaResponse)
-> Lens
UpgradePublishedSchemaResponse
UpgradePublishedSchemaResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchemaResponse' {Maybe Text
upgradedSchemaArn :: Maybe Text
$sel:upgradedSchemaArn:UpgradePublishedSchemaResponse' :: UpgradePublishedSchemaResponse -> Maybe Text
upgradedSchemaArn} -> Maybe Text
upgradedSchemaArn) (\s :: UpgradePublishedSchemaResponse
s@UpgradePublishedSchemaResponse' {} Maybe Text
a -> UpgradePublishedSchemaResponse
s {$sel:upgradedSchemaArn:UpgradePublishedSchemaResponse' :: Maybe Text
upgradedSchemaArn = Maybe Text
a} :: UpgradePublishedSchemaResponse)
upgradePublishedSchemaResponse_httpStatus :: Lens.Lens' UpgradePublishedSchemaResponse Prelude.Int
upgradePublishedSchemaResponse_httpStatus :: (Int -> f Int)
-> UpgradePublishedSchemaResponse
-> f UpgradePublishedSchemaResponse
upgradePublishedSchemaResponse_httpStatus = (UpgradePublishedSchemaResponse -> Int)
-> (UpgradePublishedSchemaResponse
-> Int -> UpgradePublishedSchemaResponse)
-> Lens
UpgradePublishedSchemaResponse
UpgradePublishedSchemaResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradePublishedSchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpgradePublishedSchemaResponse' :: UpgradePublishedSchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpgradePublishedSchemaResponse
s@UpgradePublishedSchemaResponse' {} Int
a -> UpgradePublishedSchemaResponse
s {$sel:httpStatus:UpgradePublishedSchemaResponse' :: Int
httpStatus = Int
a} :: UpgradePublishedSchemaResponse)
instance
Prelude.NFData
UpgradePublishedSchemaResponse