{-# 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.MarketplaceCatalog.StartChangeSet
(
StartChangeSet (..),
newStartChangeSet,
startChangeSet_changeSetName,
startChangeSet_clientRequestToken,
startChangeSet_catalog,
startChangeSet_changeSet,
StartChangeSetResponse (..),
newStartChangeSetResponse,
startChangeSetResponse_changeSetId,
startChangeSetResponse_changeSetArn,
startChangeSetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MarketplaceCatalog.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartChangeSet = StartChangeSet'
{
StartChangeSet -> Maybe Text
changeSetName :: Prelude.Maybe Prelude.Text,
StartChangeSet -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
StartChangeSet -> Text
catalog :: Prelude.Text,
StartChangeSet -> NonEmpty Change
changeSet :: Prelude.NonEmpty Change
}
deriving (StartChangeSet -> StartChangeSet -> Bool
(StartChangeSet -> StartChangeSet -> Bool)
-> (StartChangeSet -> StartChangeSet -> Bool) -> Eq StartChangeSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartChangeSet -> StartChangeSet -> Bool
$c/= :: StartChangeSet -> StartChangeSet -> Bool
== :: StartChangeSet -> StartChangeSet -> Bool
$c== :: StartChangeSet -> StartChangeSet -> Bool
Prelude.Eq, ReadPrec [StartChangeSet]
ReadPrec StartChangeSet
Int -> ReadS StartChangeSet
ReadS [StartChangeSet]
(Int -> ReadS StartChangeSet)
-> ReadS [StartChangeSet]
-> ReadPrec StartChangeSet
-> ReadPrec [StartChangeSet]
-> Read StartChangeSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartChangeSet]
$creadListPrec :: ReadPrec [StartChangeSet]
readPrec :: ReadPrec StartChangeSet
$creadPrec :: ReadPrec StartChangeSet
readList :: ReadS [StartChangeSet]
$creadList :: ReadS [StartChangeSet]
readsPrec :: Int -> ReadS StartChangeSet
$creadsPrec :: Int -> ReadS StartChangeSet
Prelude.Read, Int -> StartChangeSet -> ShowS
[StartChangeSet] -> ShowS
StartChangeSet -> String
(Int -> StartChangeSet -> ShowS)
-> (StartChangeSet -> String)
-> ([StartChangeSet] -> ShowS)
-> Show StartChangeSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartChangeSet] -> ShowS
$cshowList :: [StartChangeSet] -> ShowS
show :: StartChangeSet -> String
$cshow :: StartChangeSet -> String
showsPrec :: Int -> StartChangeSet -> ShowS
$cshowsPrec :: Int -> StartChangeSet -> ShowS
Prelude.Show, (forall x. StartChangeSet -> Rep StartChangeSet x)
-> (forall x. Rep StartChangeSet x -> StartChangeSet)
-> Generic StartChangeSet
forall x. Rep StartChangeSet x -> StartChangeSet
forall x. StartChangeSet -> Rep StartChangeSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartChangeSet x -> StartChangeSet
$cfrom :: forall x. StartChangeSet -> Rep StartChangeSet x
Prelude.Generic)
newStartChangeSet ::
Prelude.Text ->
Prelude.NonEmpty Change ->
StartChangeSet
newStartChangeSet :: Text -> NonEmpty Change -> StartChangeSet
newStartChangeSet Text
pCatalog_ NonEmpty Change
pChangeSet_ =
StartChangeSet' :: Maybe Text
-> Maybe Text -> Text -> NonEmpty Change -> StartChangeSet
StartChangeSet'
{ $sel:changeSetName:StartChangeSet' :: Maybe Text
changeSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clientRequestToken:StartChangeSet' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:catalog:StartChangeSet' :: Text
catalog = Text
pCatalog_,
$sel:changeSet:StartChangeSet' :: NonEmpty Change
changeSet = Tagged (NonEmpty Change) (Identity (NonEmpty Change))
-> Tagged (NonEmpty Change) (Identity (NonEmpty Change))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Change) (Identity (NonEmpty Change))
-> Tagged (NonEmpty Change) (Identity (NonEmpty Change)))
-> NonEmpty Change -> NonEmpty Change
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Change
pChangeSet_
}
startChangeSet_changeSetName :: Lens.Lens' StartChangeSet (Prelude.Maybe Prelude.Text)
startChangeSet_changeSetName :: (Maybe Text -> f (Maybe Text))
-> StartChangeSet -> f StartChangeSet
startChangeSet_changeSetName = (StartChangeSet -> Maybe Text)
-> (StartChangeSet -> Maybe Text -> StartChangeSet)
-> Lens StartChangeSet StartChangeSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSet' {Maybe Text
changeSetName :: Maybe Text
$sel:changeSetName:StartChangeSet' :: StartChangeSet -> Maybe Text
changeSetName} -> Maybe Text
changeSetName) (\s :: StartChangeSet
s@StartChangeSet' {} Maybe Text
a -> StartChangeSet
s {$sel:changeSetName:StartChangeSet' :: Maybe Text
changeSetName = Maybe Text
a} :: StartChangeSet)
startChangeSet_clientRequestToken :: Lens.Lens' StartChangeSet (Prelude.Maybe Prelude.Text)
startChangeSet_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartChangeSet -> f StartChangeSet
startChangeSet_clientRequestToken = (StartChangeSet -> Maybe Text)
-> (StartChangeSet -> Maybe Text -> StartChangeSet)
-> Lens StartChangeSet StartChangeSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSet' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartChangeSet' :: StartChangeSet -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartChangeSet
s@StartChangeSet' {} Maybe Text
a -> StartChangeSet
s {$sel:clientRequestToken:StartChangeSet' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartChangeSet)
startChangeSet_catalog :: Lens.Lens' StartChangeSet Prelude.Text
startChangeSet_catalog :: (Text -> f Text) -> StartChangeSet -> f StartChangeSet
startChangeSet_catalog = (StartChangeSet -> Text)
-> (StartChangeSet -> Text -> StartChangeSet)
-> Lens StartChangeSet StartChangeSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSet' {Text
catalog :: Text
$sel:catalog:StartChangeSet' :: StartChangeSet -> Text
catalog} -> Text
catalog) (\s :: StartChangeSet
s@StartChangeSet' {} Text
a -> StartChangeSet
s {$sel:catalog:StartChangeSet' :: Text
catalog = Text
a} :: StartChangeSet)
startChangeSet_changeSet :: Lens.Lens' StartChangeSet (Prelude.NonEmpty Change)
startChangeSet_changeSet :: (NonEmpty Change -> f (NonEmpty Change))
-> StartChangeSet -> f StartChangeSet
startChangeSet_changeSet = (StartChangeSet -> NonEmpty Change)
-> (StartChangeSet -> NonEmpty Change -> StartChangeSet)
-> Lens
StartChangeSet StartChangeSet (NonEmpty Change) (NonEmpty Change)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSet' {NonEmpty Change
changeSet :: NonEmpty Change
$sel:changeSet:StartChangeSet' :: StartChangeSet -> NonEmpty Change
changeSet} -> NonEmpty Change
changeSet) (\s :: StartChangeSet
s@StartChangeSet' {} NonEmpty Change
a -> StartChangeSet
s {$sel:changeSet:StartChangeSet' :: NonEmpty Change
changeSet = NonEmpty Change
a} :: StartChangeSet) ((NonEmpty Change -> f (NonEmpty Change))
-> StartChangeSet -> f StartChangeSet)
-> ((NonEmpty Change -> f (NonEmpty Change))
-> NonEmpty Change -> f (NonEmpty Change))
-> (NonEmpty Change -> f (NonEmpty Change))
-> StartChangeSet
-> f StartChangeSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Change -> f (NonEmpty Change))
-> NonEmpty Change -> f (NonEmpty Change)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartChangeSet where
type
AWSResponse StartChangeSet =
StartChangeSetResponse
request :: StartChangeSet -> Request StartChangeSet
request = Service -> StartChangeSet -> Request StartChangeSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartChangeSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartChangeSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartChangeSet))
-> Logger
-> Service
-> Proxy StartChangeSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartChangeSet)))
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 -> StartChangeSetResponse
StartChangeSetResponse'
(Maybe Text -> Maybe Text -> Int -> StartChangeSetResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> StartChangeSetResponse)
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
"ChangeSetId")
Either String (Maybe Text -> Int -> StartChangeSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartChangeSetResponse)
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
"ChangeSetArn")
Either String (Int -> StartChangeSetResponse)
-> Either String Int -> Either String StartChangeSetResponse
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 StartChangeSet
instance Prelude.NFData StartChangeSet
instance Core.ToHeaders StartChangeSet where
toHeaders :: StartChangeSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartChangeSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON StartChangeSet where
toJSON :: StartChangeSet -> Value
toJSON StartChangeSet' {Maybe Text
NonEmpty Change
Text
changeSet :: NonEmpty Change
catalog :: Text
clientRequestToken :: Maybe Text
changeSetName :: Maybe Text
$sel:changeSet:StartChangeSet' :: StartChangeSet -> NonEmpty Change
$sel:catalog:StartChangeSet' :: StartChangeSet -> Text
$sel:clientRequestToken:StartChangeSet' :: StartChangeSet -> Maybe Text
$sel:changeSetName:StartChangeSet' :: StartChangeSet -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ChangeSetName" 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
changeSetName,
(Text
"ClientRequestToken" 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
clientRequestToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Catalog" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
catalog),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeSet" Text -> NonEmpty Change -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Change
changeSet)
]
)
instance Core.ToPath StartChangeSet where
toPath :: StartChangeSet -> ByteString
toPath = ByteString -> StartChangeSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/StartChangeSet"
instance Core.ToQuery StartChangeSet where
toQuery :: StartChangeSet -> QueryString
toQuery = QueryString -> StartChangeSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartChangeSetResponse = StartChangeSetResponse'
{
StartChangeSetResponse -> Maybe Text
changeSetId :: Prelude.Maybe Prelude.Text,
StartChangeSetResponse -> Maybe Text
changeSetArn :: Prelude.Maybe Prelude.Text,
StartChangeSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartChangeSetResponse -> StartChangeSetResponse -> Bool
(StartChangeSetResponse -> StartChangeSetResponse -> Bool)
-> (StartChangeSetResponse -> StartChangeSetResponse -> Bool)
-> Eq StartChangeSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartChangeSetResponse -> StartChangeSetResponse -> Bool
$c/= :: StartChangeSetResponse -> StartChangeSetResponse -> Bool
== :: StartChangeSetResponse -> StartChangeSetResponse -> Bool
$c== :: StartChangeSetResponse -> StartChangeSetResponse -> Bool
Prelude.Eq, ReadPrec [StartChangeSetResponse]
ReadPrec StartChangeSetResponse
Int -> ReadS StartChangeSetResponse
ReadS [StartChangeSetResponse]
(Int -> ReadS StartChangeSetResponse)
-> ReadS [StartChangeSetResponse]
-> ReadPrec StartChangeSetResponse
-> ReadPrec [StartChangeSetResponse]
-> Read StartChangeSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartChangeSetResponse]
$creadListPrec :: ReadPrec [StartChangeSetResponse]
readPrec :: ReadPrec StartChangeSetResponse
$creadPrec :: ReadPrec StartChangeSetResponse
readList :: ReadS [StartChangeSetResponse]
$creadList :: ReadS [StartChangeSetResponse]
readsPrec :: Int -> ReadS StartChangeSetResponse
$creadsPrec :: Int -> ReadS StartChangeSetResponse
Prelude.Read, Int -> StartChangeSetResponse -> ShowS
[StartChangeSetResponse] -> ShowS
StartChangeSetResponse -> String
(Int -> StartChangeSetResponse -> ShowS)
-> (StartChangeSetResponse -> String)
-> ([StartChangeSetResponse] -> ShowS)
-> Show StartChangeSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartChangeSetResponse] -> ShowS
$cshowList :: [StartChangeSetResponse] -> ShowS
show :: StartChangeSetResponse -> String
$cshow :: StartChangeSetResponse -> String
showsPrec :: Int -> StartChangeSetResponse -> ShowS
$cshowsPrec :: Int -> StartChangeSetResponse -> ShowS
Prelude.Show, (forall x. StartChangeSetResponse -> Rep StartChangeSetResponse x)
-> (forall x.
Rep StartChangeSetResponse x -> StartChangeSetResponse)
-> Generic StartChangeSetResponse
forall x. Rep StartChangeSetResponse x -> StartChangeSetResponse
forall x. StartChangeSetResponse -> Rep StartChangeSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartChangeSetResponse x -> StartChangeSetResponse
$cfrom :: forall x. StartChangeSetResponse -> Rep StartChangeSetResponse x
Prelude.Generic)
newStartChangeSetResponse ::
Prelude.Int ->
StartChangeSetResponse
newStartChangeSetResponse :: Int -> StartChangeSetResponse
newStartChangeSetResponse Int
pHttpStatus_ =
StartChangeSetResponse' :: Maybe Text -> Maybe Text -> Int -> StartChangeSetResponse
StartChangeSetResponse'
{ $sel:changeSetId:StartChangeSetResponse' :: Maybe Text
changeSetId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:changeSetArn:StartChangeSetResponse' :: Maybe Text
changeSetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartChangeSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startChangeSetResponse_changeSetId :: Lens.Lens' StartChangeSetResponse (Prelude.Maybe Prelude.Text)
startChangeSetResponse_changeSetId :: (Maybe Text -> f (Maybe Text))
-> StartChangeSetResponse -> f StartChangeSetResponse
startChangeSetResponse_changeSetId = (StartChangeSetResponse -> Maybe Text)
-> (StartChangeSetResponse -> Maybe Text -> StartChangeSetResponse)
-> Lens
StartChangeSetResponse
StartChangeSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSetResponse' {Maybe Text
changeSetId :: Maybe Text
$sel:changeSetId:StartChangeSetResponse' :: StartChangeSetResponse -> Maybe Text
changeSetId} -> Maybe Text
changeSetId) (\s :: StartChangeSetResponse
s@StartChangeSetResponse' {} Maybe Text
a -> StartChangeSetResponse
s {$sel:changeSetId:StartChangeSetResponse' :: Maybe Text
changeSetId = Maybe Text
a} :: StartChangeSetResponse)
startChangeSetResponse_changeSetArn :: Lens.Lens' StartChangeSetResponse (Prelude.Maybe Prelude.Text)
startChangeSetResponse_changeSetArn :: (Maybe Text -> f (Maybe Text))
-> StartChangeSetResponse -> f StartChangeSetResponse
startChangeSetResponse_changeSetArn = (StartChangeSetResponse -> Maybe Text)
-> (StartChangeSetResponse -> Maybe Text -> StartChangeSetResponse)
-> Lens
StartChangeSetResponse
StartChangeSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSetResponse' {Maybe Text
changeSetArn :: Maybe Text
$sel:changeSetArn:StartChangeSetResponse' :: StartChangeSetResponse -> Maybe Text
changeSetArn} -> Maybe Text
changeSetArn) (\s :: StartChangeSetResponse
s@StartChangeSetResponse' {} Maybe Text
a -> StartChangeSetResponse
s {$sel:changeSetArn:StartChangeSetResponse' :: Maybe Text
changeSetArn = Maybe Text
a} :: StartChangeSetResponse)
startChangeSetResponse_httpStatus :: Lens.Lens' StartChangeSetResponse Prelude.Int
startChangeSetResponse_httpStatus :: (Int -> f Int)
-> StartChangeSetResponse -> f StartChangeSetResponse
startChangeSetResponse_httpStatus = (StartChangeSetResponse -> Int)
-> (StartChangeSetResponse -> Int -> StartChangeSetResponse)
-> Lens StartChangeSetResponse StartChangeSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartChangeSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartChangeSetResponse' :: StartChangeSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartChangeSetResponse
s@StartChangeSetResponse' {} Int
a -> StartChangeSetResponse
s {$sel:httpStatus:StartChangeSetResponse' :: Int
httpStatus = Int
a} :: StartChangeSetResponse)
instance Prelude.NFData StartChangeSetResponse