{-# 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.Personalize.UpdateCampaign
(
UpdateCampaign (..),
newUpdateCampaign,
updateCampaign_campaignConfig,
updateCampaign_minProvisionedTPS,
updateCampaign_solutionVersionArn,
updateCampaign_campaignArn,
UpdateCampaignResponse (..),
newUpdateCampaignResponse,
updateCampaignResponse_campaignArn,
updateCampaignResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateCampaign = UpdateCampaign'
{
UpdateCampaign -> Maybe CampaignConfig
campaignConfig :: Prelude.Maybe CampaignConfig,
UpdateCampaign -> Maybe Natural
minProvisionedTPS :: Prelude.Maybe Prelude.Natural,
UpdateCampaign -> Maybe Text
solutionVersionArn :: Prelude.Maybe Prelude.Text,
UpdateCampaign -> Text
campaignArn :: Prelude.Text
}
deriving (UpdateCampaign -> UpdateCampaign -> Bool
(UpdateCampaign -> UpdateCampaign -> Bool)
-> (UpdateCampaign -> UpdateCampaign -> Bool) -> Eq UpdateCampaign
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCampaign -> UpdateCampaign -> Bool
$c/= :: UpdateCampaign -> UpdateCampaign -> Bool
== :: UpdateCampaign -> UpdateCampaign -> Bool
$c== :: UpdateCampaign -> UpdateCampaign -> Bool
Prelude.Eq, ReadPrec [UpdateCampaign]
ReadPrec UpdateCampaign
Int -> ReadS UpdateCampaign
ReadS [UpdateCampaign]
(Int -> ReadS UpdateCampaign)
-> ReadS [UpdateCampaign]
-> ReadPrec UpdateCampaign
-> ReadPrec [UpdateCampaign]
-> Read UpdateCampaign
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCampaign]
$creadListPrec :: ReadPrec [UpdateCampaign]
readPrec :: ReadPrec UpdateCampaign
$creadPrec :: ReadPrec UpdateCampaign
readList :: ReadS [UpdateCampaign]
$creadList :: ReadS [UpdateCampaign]
readsPrec :: Int -> ReadS UpdateCampaign
$creadsPrec :: Int -> ReadS UpdateCampaign
Prelude.Read, Int -> UpdateCampaign -> ShowS
[UpdateCampaign] -> ShowS
UpdateCampaign -> String
(Int -> UpdateCampaign -> ShowS)
-> (UpdateCampaign -> String)
-> ([UpdateCampaign] -> ShowS)
-> Show UpdateCampaign
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCampaign] -> ShowS
$cshowList :: [UpdateCampaign] -> ShowS
show :: UpdateCampaign -> String
$cshow :: UpdateCampaign -> String
showsPrec :: Int -> UpdateCampaign -> ShowS
$cshowsPrec :: Int -> UpdateCampaign -> ShowS
Prelude.Show, (forall x. UpdateCampaign -> Rep UpdateCampaign x)
-> (forall x. Rep UpdateCampaign x -> UpdateCampaign)
-> Generic UpdateCampaign
forall x. Rep UpdateCampaign x -> UpdateCampaign
forall x. UpdateCampaign -> Rep UpdateCampaign x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCampaign x -> UpdateCampaign
$cfrom :: forall x. UpdateCampaign -> Rep UpdateCampaign x
Prelude.Generic)
newUpdateCampaign ::
Prelude.Text ->
UpdateCampaign
newUpdateCampaign :: Text -> UpdateCampaign
newUpdateCampaign Text
pCampaignArn_ =
UpdateCampaign' :: Maybe CampaignConfig
-> Maybe Natural -> Maybe Text -> Text -> UpdateCampaign
UpdateCampaign'
{ $sel:campaignConfig:UpdateCampaign' :: Maybe CampaignConfig
campaignConfig = Maybe CampaignConfig
forall a. Maybe a
Prelude.Nothing,
$sel:minProvisionedTPS:UpdateCampaign' :: Maybe Natural
minProvisionedTPS = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:solutionVersionArn:UpdateCampaign' :: Maybe Text
solutionVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:campaignArn:UpdateCampaign' :: Text
campaignArn = Text
pCampaignArn_
}
updateCampaign_campaignConfig :: Lens.Lens' UpdateCampaign (Prelude.Maybe CampaignConfig)
updateCampaign_campaignConfig :: (Maybe CampaignConfig -> f (Maybe CampaignConfig))
-> UpdateCampaign -> f UpdateCampaign
updateCampaign_campaignConfig = (UpdateCampaign -> Maybe CampaignConfig)
-> (UpdateCampaign -> Maybe CampaignConfig -> UpdateCampaign)
-> Lens
UpdateCampaign
UpdateCampaign
(Maybe CampaignConfig)
(Maybe CampaignConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaign' {Maybe CampaignConfig
campaignConfig :: Maybe CampaignConfig
$sel:campaignConfig:UpdateCampaign' :: UpdateCampaign -> Maybe CampaignConfig
campaignConfig} -> Maybe CampaignConfig
campaignConfig) (\s :: UpdateCampaign
s@UpdateCampaign' {} Maybe CampaignConfig
a -> UpdateCampaign
s {$sel:campaignConfig:UpdateCampaign' :: Maybe CampaignConfig
campaignConfig = Maybe CampaignConfig
a} :: UpdateCampaign)
updateCampaign_minProvisionedTPS :: Lens.Lens' UpdateCampaign (Prelude.Maybe Prelude.Natural)
updateCampaign_minProvisionedTPS :: (Maybe Natural -> f (Maybe Natural))
-> UpdateCampaign -> f UpdateCampaign
updateCampaign_minProvisionedTPS = (UpdateCampaign -> Maybe Natural)
-> (UpdateCampaign -> Maybe Natural -> UpdateCampaign)
-> Lens
UpdateCampaign UpdateCampaign (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaign' {Maybe Natural
minProvisionedTPS :: Maybe Natural
$sel:minProvisionedTPS:UpdateCampaign' :: UpdateCampaign -> Maybe Natural
minProvisionedTPS} -> Maybe Natural
minProvisionedTPS) (\s :: UpdateCampaign
s@UpdateCampaign' {} Maybe Natural
a -> UpdateCampaign
s {$sel:minProvisionedTPS:UpdateCampaign' :: Maybe Natural
minProvisionedTPS = Maybe Natural
a} :: UpdateCampaign)
updateCampaign_solutionVersionArn :: Lens.Lens' UpdateCampaign (Prelude.Maybe Prelude.Text)
updateCampaign_solutionVersionArn :: (Maybe Text -> f (Maybe Text))
-> UpdateCampaign -> f UpdateCampaign
updateCampaign_solutionVersionArn = (UpdateCampaign -> Maybe Text)
-> (UpdateCampaign -> Maybe Text -> UpdateCampaign)
-> Lens UpdateCampaign UpdateCampaign (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaign' {Maybe Text
solutionVersionArn :: Maybe Text
$sel:solutionVersionArn:UpdateCampaign' :: UpdateCampaign -> Maybe Text
solutionVersionArn} -> Maybe Text
solutionVersionArn) (\s :: UpdateCampaign
s@UpdateCampaign' {} Maybe Text
a -> UpdateCampaign
s {$sel:solutionVersionArn:UpdateCampaign' :: Maybe Text
solutionVersionArn = Maybe Text
a} :: UpdateCampaign)
updateCampaign_campaignArn :: Lens.Lens' UpdateCampaign Prelude.Text
updateCampaign_campaignArn :: (Text -> f Text) -> UpdateCampaign -> f UpdateCampaign
updateCampaign_campaignArn = (UpdateCampaign -> Text)
-> (UpdateCampaign -> Text -> UpdateCampaign)
-> Lens UpdateCampaign UpdateCampaign Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaign' {Text
campaignArn :: Text
$sel:campaignArn:UpdateCampaign' :: UpdateCampaign -> Text
campaignArn} -> Text
campaignArn) (\s :: UpdateCampaign
s@UpdateCampaign' {} Text
a -> UpdateCampaign
s {$sel:campaignArn:UpdateCampaign' :: Text
campaignArn = Text
a} :: UpdateCampaign)
instance Core.AWSRequest UpdateCampaign where
type
AWSResponse UpdateCampaign =
UpdateCampaignResponse
request :: UpdateCampaign -> Request UpdateCampaign
request = Service -> UpdateCampaign -> Request UpdateCampaign
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCampaign)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateCampaign))
-> Logger
-> Service
-> Proxy UpdateCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCampaign)))
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 -> UpdateCampaignResponse
UpdateCampaignResponse'
(Maybe Text -> Int -> UpdateCampaignResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateCampaignResponse)
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
"campaignArn")
Either String (Int -> UpdateCampaignResponse)
-> Either String Int -> Either String UpdateCampaignResponse
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 UpdateCampaign
instance Prelude.NFData UpdateCampaign
instance Core.ToHeaders UpdateCampaign where
toHeaders :: UpdateCampaign -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateCampaign -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonPersonalize.UpdateCampaign" ::
Prelude.ByteString
),
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 UpdateCampaign where
toJSON :: UpdateCampaign -> Value
toJSON UpdateCampaign' {Maybe Natural
Maybe Text
Maybe CampaignConfig
Text
campaignArn :: Text
solutionVersionArn :: Maybe Text
minProvisionedTPS :: Maybe Natural
campaignConfig :: Maybe CampaignConfig
$sel:campaignArn:UpdateCampaign' :: UpdateCampaign -> Text
$sel:solutionVersionArn:UpdateCampaign' :: UpdateCampaign -> Maybe Text
$sel:minProvisionedTPS:UpdateCampaign' :: UpdateCampaign -> Maybe Natural
$sel:campaignConfig:UpdateCampaign' :: UpdateCampaign -> Maybe CampaignConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"campaignConfig" Text -> CampaignConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CampaignConfig -> Pair) -> Maybe CampaignConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CampaignConfig
campaignConfig,
(Text
"minProvisionedTPS" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minProvisionedTPS,
(Text
"solutionVersionArn" 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
solutionVersionArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"campaignArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
campaignArn)
]
)
instance Core.ToPath UpdateCampaign where
toPath :: UpdateCampaign -> ByteString
toPath = ByteString -> UpdateCampaign -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateCampaign where
toQuery :: UpdateCampaign -> QueryString
toQuery = QueryString -> UpdateCampaign -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateCampaignResponse = UpdateCampaignResponse'
{
UpdateCampaignResponse -> Maybe Text
campaignArn :: Prelude.Maybe Prelude.Text,
UpdateCampaignResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateCampaignResponse -> UpdateCampaignResponse -> Bool
(UpdateCampaignResponse -> UpdateCampaignResponse -> Bool)
-> (UpdateCampaignResponse -> UpdateCampaignResponse -> Bool)
-> Eq UpdateCampaignResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCampaignResponse -> UpdateCampaignResponse -> Bool
$c/= :: UpdateCampaignResponse -> UpdateCampaignResponse -> Bool
== :: UpdateCampaignResponse -> UpdateCampaignResponse -> Bool
$c== :: UpdateCampaignResponse -> UpdateCampaignResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCampaignResponse]
ReadPrec UpdateCampaignResponse
Int -> ReadS UpdateCampaignResponse
ReadS [UpdateCampaignResponse]
(Int -> ReadS UpdateCampaignResponse)
-> ReadS [UpdateCampaignResponse]
-> ReadPrec UpdateCampaignResponse
-> ReadPrec [UpdateCampaignResponse]
-> Read UpdateCampaignResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCampaignResponse]
$creadListPrec :: ReadPrec [UpdateCampaignResponse]
readPrec :: ReadPrec UpdateCampaignResponse
$creadPrec :: ReadPrec UpdateCampaignResponse
readList :: ReadS [UpdateCampaignResponse]
$creadList :: ReadS [UpdateCampaignResponse]
readsPrec :: Int -> ReadS UpdateCampaignResponse
$creadsPrec :: Int -> ReadS UpdateCampaignResponse
Prelude.Read, Int -> UpdateCampaignResponse -> ShowS
[UpdateCampaignResponse] -> ShowS
UpdateCampaignResponse -> String
(Int -> UpdateCampaignResponse -> ShowS)
-> (UpdateCampaignResponse -> String)
-> ([UpdateCampaignResponse] -> ShowS)
-> Show UpdateCampaignResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCampaignResponse] -> ShowS
$cshowList :: [UpdateCampaignResponse] -> ShowS
show :: UpdateCampaignResponse -> String
$cshow :: UpdateCampaignResponse -> String
showsPrec :: Int -> UpdateCampaignResponse -> ShowS
$cshowsPrec :: Int -> UpdateCampaignResponse -> ShowS
Prelude.Show, (forall x. UpdateCampaignResponse -> Rep UpdateCampaignResponse x)
-> (forall x.
Rep UpdateCampaignResponse x -> UpdateCampaignResponse)
-> Generic UpdateCampaignResponse
forall x. Rep UpdateCampaignResponse x -> UpdateCampaignResponse
forall x. UpdateCampaignResponse -> Rep UpdateCampaignResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCampaignResponse x -> UpdateCampaignResponse
$cfrom :: forall x. UpdateCampaignResponse -> Rep UpdateCampaignResponse x
Prelude.Generic)
newUpdateCampaignResponse ::
Prelude.Int ->
UpdateCampaignResponse
newUpdateCampaignResponse :: Int -> UpdateCampaignResponse
newUpdateCampaignResponse Int
pHttpStatus_ =
UpdateCampaignResponse' :: Maybe Text -> Int -> UpdateCampaignResponse
UpdateCampaignResponse'
{ $sel:campaignArn:UpdateCampaignResponse' :: Maybe Text
campaignArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateCampaignResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateCampaignResponse_campaignArn :: Lens.Lens' UpdateCampaignResponse (Prelude.Maybe Prelude.Text)
updateCampaignResponse_campaignArn :: (Maybe Text -> f (Maybe Text))
-> UpdateCampaignResponse -> f UpdateCampaignResponse
updateCampaignResponse_campaignArn = (UpdateCampaignResponse -> Maybe Text)
-> (UpdateCampaignResponse -> Maybe Text -> UpdateCampaignResponse)
-> Lens
UpdateCampaignResponse
UpdateCampaignResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaignResponse' {Maybe Text
campaignArn :: Maybe Text
$sel:campaignArn:UpdateCampaignResponse' :: UpdateCampaignResponse -> Maybe Text
campaignArn} -> Maybe Text
campaignArn) (\s :: UpdateCampaignResponse
s@UpdateCampaignResponse' {} Maybe Text
a -> UpdateCampaignResponse
s {$sel:campaignArn:UpdateCampaignResponse' :: Maybe Text
campaignArn = Maybe Text
a} :: UpdateCampaignResponse)
updateCampaignResponse_httpStatus :: Lens.Lens' UpdateCampaignResponse Prelude.Int
updateCampaignResponse_httpStatus :: (Int -> f Int)
-> UpdateCampaignResponse -> f UpdateCampaignResponse
updateCampaignResponse_httpStatus = (UpdateCampaignResponse -> Int)
-> (UpdateCampaignResponse -> Int -> UpdateCampaignResponse)
-> Lens UpdateCampaignResponse UpdateCampaignResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaignResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateCampaignResponse' :: UpdateCampaignResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateCampaignResponse
s@UpdateCampaignResponse' {} Int
a -> UpdateCampaignResponse
s {$sel:httpStatus:UpdateCampaignResponse' :: Int
httpStatus = Int
a} :: UpdateCampaignResponse)
instance Prelude.NFData UpdateCampaignResponse