{-# 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.ConnectCampaigns.GetCampaignState
(
GetCampaignState (..),
newGetCampaignState,
getCampaignState_id,
GetCampaignStateResponse (..),
newGetCampaignStateResponse,
getCampaignStateResponse_state,
getCampaignStateResponse_httpStatus,
)
where
import Amazonka.ConnectCampaigns.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCampaignState = GetCampaignState'
{ GetCampaignState -> Text
id :: Prelude.Text
}
deriving (GetCampaignState -> GetCampaignState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignState -> GetCampaignState -> Bool
$c/= :: GetCampaignState -> GetCampaignState -> Bool
== :: GetCampaignState -> GetCampaignState -> Bool
$c== :: GetCampaignState -> GetCampaignState -> Bool
Prelude.Eq, ReadPrec [GetCampaignState]
ReadPrec GetCampaignState
Int -> ReadS GetCampaignState
ReadS [GetCampaignState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignState]
$creadListPrec :: ReadPrec [GetCampaignState]
readPrec :: ReadPrec GetCampaignState
$creadPrec :: ReadPrec GetCampaignState
readList :: ReadS [GetCampaignState]
$creadList :: ReadS [GetCampaignState]
readsPrec :: Int -> ReadS GetCampaignState
$creadsPrec :: Int -> ReadS GetCampaignState
Prelude.Read, Int -> GetCampaignState -> ShowS
[GetCampaignState] -> ShowS
GetCampaignState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignState] -> ShowS
$cshowList :: [GetCampaignState] -> ShowS
show :: GetCampaignState -> String
$cshow :: GetCampaignState -> String
showsPrec :: Int -> GetCampaignState -> ShowS
$cshowsPrec :: Int -> GetCampaignState -> ShowS
Prelude.Show, forall x. Rep GetCampaignState x -> GetCampaignState
forall x. GetCampaignState -> Rep GetCampaignState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCampaignState x -> GetCampaignState
$cfrom :: forall x. GetCampaignState -> Rep GetCampaignState x
Prelude.Generic)
newGetCampaignState ::
Prelude.Text ->
GetCampaignState
newGetCampaignState :: Text -> GetCampaignState
newGetCampaignState Text
pId_ =
GetCampaignState' {$sel:id:GetCampaignState' :: Text
id = Text
pId_}
getCampaignState_id :: Lens.Lens' GetCampaignState Prelude.Text
getCampaignState_id :: Lens' GetCampaignState Text
getCampaignState_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignState' {Text
id :: Text
$sel:id:GetCampaignState' :: GetCampaignState -> Text
id} -> Text
id) (\s :: GetCampaignState
s@GetCampaignState' {} Text
a -> GetCampaignState
s {$sel:id:GetCampaignState' :: Text
id = Text
a} :: GetCampaignState)
instance Core.AWSRequest GetCampaignState where
type
AWSResponse GetCampaignState =
GetCampaignStateResponse
request :: (Service -> Service)
-> GetCampaignState -> Request GetCampaignState
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetCampaignState
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCampaignState)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe CampaignState -> Int -> GetCampaignStateResponse
GetCampaignStateResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"state")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetCampaignState where
hashWithSalt :: Int -> GetCampaignState -> Int
hashWithSalt Int
_salt GetCampaignState' {Text
id :: Text
$sel:id:GetCampaignState' :: GetCampaignState -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetCampaignState where
rnf :: GetCampaignState -> ()
rnf GetCampaignState' {Text
id :: Text
$sel:id:GetCampaignState' :: GetCampaignState -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetCampaignState where
toHeaders :: GetCampaignState -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetCampaignState where
toPath :: GetCampaignState -> ByteString
toPath GetCampaignState' {Text
id :: Text
$sel:id:GetCampaignState' :: GetCampaignState -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/campaigns/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id, ByteString
"/state"]
instance Data.ToQuery GetCampaignState where
toQuery :: GetCampaignState -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetCampaignStateResponse = GetCampaignStateResponse'
{ GetCampaignStateResponse -> Maybe CampaignState
state :: Prelude.Maybe CampaignState,
GetCampaignStateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCampaignStateResponse -> GetCampaignStateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignStateResponse -> GetCampaignStateResponse -> Bool
$c/= :: GetCampaignStateResponse -> GetCampaignStateResponse -> Bool
== :: GetCampaignStateResponse -> GetCampaignStateResponse -> Bool
$c== :: GetCampaignStateResponse -> GetCampaignStateResponse -> Bool
Prelude.Eq, ReadPrec [GetCampaignStateResponse]
ReadPrec GetCampaignStateResponse
Int -> ReadS GetCampaignStateResponse
ReadS [GetCampaignStateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignStateResponse]
$creadListPrec :: ReadPrec [GetCampaignStateResponse]
readPrec :: ReadPrec GetCampaignStateResponse
$creadPrec :: ReadPrec GetCampaignStateResponse
readList :: ReadS [GetCampaignStateResponse]
$creadList :: ReadS [GetCampaignStateResponse]
readsPrec :: Int -> ReadS GetCampaignStateResponse
$creadsPrec :: Int -> ReadS GetCampaignStateResponse
Prelude.Read, Int -> GetCampaignStateResponse -> ShowS
[GetCampaignStateResponse] -> ShowS
GetCampaignStateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignStateResponse] -> ShowS
$cshowList :: [GetCampaignStateResponse] -> ShowS
show :: GetCampaignStateResponse -> String
$cshow :: GetCampaignStateResponse -> String
showsPrec :: Int -> GetCampaignStateResponse -> ShowS
$cshowsPrec :: Int -> GetCampaignStateResponse -> ShowS
Prelude.Show, forall x.
Rep GetCampaignStateResponse x -> GetCampaignStateResponse
forall x.
GetCampaignStateResponse -> Rep GetCampaignStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCampaignStateResponse x -> GetCampaignStateResponse
$cfrom :: forall x.
GetCampaignStateResponse -> Rep GetCampaignStateResponse x
Prelude.Generic)
newGetCampaignStateResponse ::
Prelude.Int ->
GetCampaignStateResponse
newGetCampaignStateResponse :: Int -> GetCampaignStateResponse
newGetCampaignStateResponse Int
pHttpStatus_ =
GetCampaignStateResponse'
{ $sel:state:GetCampaignStateResponse' :: Maybe CampaignState
state = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCampaignStateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCampaignStateResponse_state :: Lens.Lens' GetCampaignStateResponse (Prelude.Maybe CampaignState)
getCampaignStateResponse_state :: Lens' GetCampaignStateResponse (Maybe CampaignState)
getCampaignStateResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignStateResponse' {Maybe CampaignState
state :: Maybe CampaignState
$sel:state:GetCampaignStateResponse' :: GetCampaignStateResponse -> Maybe CampaignState
state} -> Maybe CampaignState
state) (\s :: GetCampaignStateResponse
s@GetCampaignStateResponse' {} Maybe CampaignState
a -> GetCampaignStateResponse
s {$sel:state:GetCampaignStateResponse' :: Maybe CampaignState
state = Maybe CampaignState
a} :: GetCampaignStateResponse)
getCampaignStateResponse_httpStatus :: Lens.Lens' GetCampaignStateResponse Prelude.Int
getCampaignStateResponse_httpStatus :: Lens' GetCampaignStateResponse Int
getCampaignStateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCampaignStateResponse' :: GetCampaignStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCampaignStateResponse
s@GetCampaignStateResponse' {} Int
a -> GetCampaignStateResponse
s {$sel:httpStatus:GetCampaignStateResponse' :: Int
httpStatus = Int
a} :: GetCampaignStateResponse)
instance Prelude.NFData GetCampaignStateResponse where
rnf :: GetCampaignStateResponse -> ()
rnf GetCampaignStateResponse' {Int
Maybe CampaignState
httpStatus :: Int
state :: Maybe CampaignState
$sel:httpStatus:GetCampaignStateResponse' :: GetCampaignStateResponse -> Int
$sel:state:GetCampaignStateResponse' :: GetCampaignStateResponse -> Maybe CampaignState
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CampaignState
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus