{-# 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.StepFunctions.CreateActivity
(
CreateActivity (..),
newCreateActivity,
createActivity_tags,
createActivity_name,
CreateActivityResponse (..),
newCreateActivityResponse,
createActivityResponse_httpStatus,
createActivityResponse_activityArn,
createActivityResponse_creationDate,
)
where
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
import Amazonka.StepFunctions.Types
data CreateActivity = CreateActivity'
{
CreateActivity -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateActivity -> Text
name :: Prelude.Text
}
deriving (CreateActivity -> CreateActivity -> Bool
(CreateActivity -> CreateActivity -> Bool)
-> (CreateActivity -> CreateActivity -> Bool) -> Eq CreateActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActivity -> CreateActivity -> Bool
$c/= :: CreateActivity -> CreateActivity -> Bool
== :: CreateActivity -> CreateActivity -> Bool
$c== :: CreateActivity -> CreateActivity -> Bool
Prelude.Eq, ReadPrec [CreateActivity]
ReadPrec CreateActivity
Int -> ReadS CreateActivity
ReadS [CreateActivity]
(Int -> ReadS CreateActivity)
-> ReadS [CreateActivity]
-> ReadPrec CreateActivity
-> ReadPrec [CreateActivity]
-> Read CreateActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActivity]
$creadListPrec :: ReadPrec [CreateActivity]
readPrec :: ReadPrec CreateActivity
$creadPrec :: ReadPrec CreateActivity
readList :: ReadS [CreateActivity]
$creadList :: ReadS [CreateActivity]
readsPrec :: Int -> ReadS CreateActivity
$creadsPrec :: Int -> ReadS CreateActivity
Prelude.Read, Int -> CreateActivity -> ShowS
[CreateActivity] -> ShowS
CreateActivity -> String
(Int -> CreateActivity -> ShowS)
-> (CreateActivity -> String)
-> ([CreateActivity] -> ShowS)
-> Show CreateActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActivity] -> ShowS
$cshowList :: [CreateActivity] -> ShowS
show :: CreateActivity -> String
$cshow :: CreateActivity -> String
showsPrec :: Int -> CreateActivity -> ShowS
$cshowsPrec :: Int -> CreateActivity -> ShowS
Prelude.Show, (forall x. CreateActivity -> Rep CreateActivity x)
-> (forall x. Rep CreateActivity x -> CreateActivity)
-> Generic CreateActivity
forall x. Rep CreateActivity x -> CreateActivity
forall x. CreateActivity -> Rep CreateActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateActivity x -> CreateActivity
$cfrom :: forall x. CreateActivity -> Rep CreateActivity x
Prelude.Generic)
newCreateActivity ::
Prelude.Text ->
CreateActivity
newCreateActivity :: Text -> CreateActivity
newCreateActivity Text
pName_ =
CreateActivity' :: Maybe [Tag] -> Text -> CreateActivity
CreateActivity'
{ $sel:tags:CreateActivity' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateActivity' :: Text
name = Text
pName_
}
createActivity_tags :: Lens.Lens' CreateActivity (Prelude.Maybe [Tag])
createActivity_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateActivity -> f CreateActivity
createActivity_tags = (CreateActivity -> Maybe [Tag])
-> (CreateActivity -> Maybe [Tag] -> CreateActivity)
-> Lens CreateActivity CreateActivity (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivity' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateActivity' :: CreateActivity -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateActivity
s@CreateActivity' {} Maybe [Tag]
a -> CreateActivity
s {$sel:tags:CreateActivity' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateActivity) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateActivity -> f CreateActivity)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateActivity
-> f CreateActivity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createActivity_name :: Lens.Lens' CreateActivity Prelude.Text
createActivity_name :: (Text -> f Text) -> CreateActivity -> f CreateActivity
createActivity_name = (CreateActivity -> Text)
-> (CreateActivity -> Text -> CreateActivity)
-> Lens CreateActivity CreateActivity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivity' {Text
name :: Text
$sel:name:CreateActivity' :: CreateActivity -> Text
name} -> Text
name) (\s :: CreateActivity
s@CreateActivity' {} Text
a -> CreateActivity
s {$sel:name:CreateActivity' :: Text
name = Text
a} :: CreateActivity)
instance Core.AWSRequest CreateActivity where
type
AWSResponse CreateActivity =
CreateActivityResponse
request :: CreateActivity -> Request CreateActivity
request = Service -> CreateActivity -> Request CreateActivity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateActivity)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateActivity))
-> Logger
-> Service
-> Proxy CreateActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateActivity)))
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 ->
Int -> Text -> POSIX -> CreateActivityResponse
CreateActivityResponse'
(Int -> Text -> POSIX -> CreateActivityResponse)
-> Either String Int
-> Either String (Text -> POSIX -> CreateActivityResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> POSIX -> CreateActivityResponse)
-> Either String Text
-> Either String (POSIX -> CreateActivityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"activityArn")
Either String (POSIX -> CreateActivityResponse)
-> Either String POSIX -> Either String CreateActivityResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String POSIX
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"creationDate")
)
instance Prelude.Hashable CreateActivity
instance Prelude.NFData CreateActivity
instance Core.ToHeaders CreateActivity where
toHeaders :: CreateActivity -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateActivity -> 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
"AWSStepFunctions.CreateActivity" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateActivity where
toJSON :: CreateActivity -> Value
toJSON CreateActivity' {Maybe [Tag]
Text
name :: Text
tags :: Maybe [Tag]
$sel:name:CreateActivity' :: CreateActivity -> Text
$sel:tags:CreateActivity' :: CreateActivity -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
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 CreateActivity where
toPath :: CreateActivity -> ByteString
toPath = ByteString -> CreateActivity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateActivity where
toQuery :: CreateActivity -> QueryString
toQuery = QueryString -> CreateActivity -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateActivityResponse = CreateActivityResponse'
{
CreateActivityResponse -> Int
httpStatus :: Prelude.Int,
CreateActivityResponse -> Text
activityArn :: Prelude.Text,
CreateActivityResponse -> POSIX
creationDate :: Core.POSIX
}
deriving (CreateActivityResponse -> CreateActivityResponse -> Bool
(CreateActivityResponse -> CreateActivityResponse -> Bool)
-> (CreateActivityResponse -> CreateActivityResponse -> Bool)
-> Eq CreateActivityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateActivityResponse -> CreateActivityResponse -> Bool
$c/= :: CreateActivityResponse -> CreateActivityResponse -> Bool
== :: CreateActivityResponse -> CreateActivityResponse -> Bool
$c== :: CreateActivityResponse -> CreateActivityResponse -> Bool
Prelude.Eq, ReadPrec [CreateActivityResponse]
ReadPrec CreateActivityResponse
Int -> ReadS CreateActivityResponse
ReadS [CreateActivityResponse]
(Int -> ReadS CreateActivityResponse)
-> ReadS [CreateActivityResponse]
-> ReadPrec CreateActivityResponse
-> ReadPrec [CreateActivityResponse]
-> Read CreateActivityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateActivityResponse]
$creadListPrec :: ReadPrec [CreateActivityResponse]
readPrec :: ReadPrec CreateActivityResponse
$creadPrec :: ReadPrec CreateActivityResponse
readList :: ReadS [CreateActivityResponse]
$creadList :: ReadS [CreateActivityResponse]
readsPrec :: Int -> ReadS CreateActivityResponse
$creadsPrec :: Int -> ReadS CreateActivityResponse
Prelude.Read, Int -> CreateActivityResponse -> ShowS
[CreateActivityResponse] -> ShowS
CreateActivityResponse -> String
(Int -> CreateActivityResponse -> ShowS)
-> (CreateActivityResponse -> String)
-> ([CreateActivityResponse] -> ShowS)
-> Show CreateActivityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateActivityResponse] -> ShowS
$cshowList :: [CreateActivityResponse] -> ShowS
show :: CreateActivityResponse -> String
$cshow :: CreateActivityResponse -> String
showsPrec :: Int -> CreateActivityResponse -> ShowS
$cshowsPrec :: Int -> CreateActivityResponse -> ShowS
Prelude.Show, (forall x. CreateActivityResponse -> Rep CreateActivityResponse x)
-> (forall x.
Rep CreateActivityResponse x -> CreateActivityResponse)
-> Generic CreateActivityResponse
forall x. Rep CreateActivityResponse x -> CreateActivityResponse
forall x. CreateActivityResponse -> Rep CreateActivityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateActivityResponse x -> CreateActivityResponse
$cfrom :: forall x. CreateActivityResponse -> Rep CreateActivityResponse x
Prelude.Generic)
newCreateActivityResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.UTCTime ->
CreateActivityResponse
newCreateActivityResponse :: Int -> Text -> UTCTime -> CreateActivityResponse
newCreateActivityResponse
Int
pHttpStatus_
Text
pActivityArn_
UTCTime
pCreationDate_ =
CreateActivityResponse' :: Int -> Text -> POSIX -> CreateActivityResponse
CreateActivityResponse'
{ $sel:httpStatus:CreateActivityResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:activityArn:CreateActivityResponse' :: Text
activityArn = Text
pActivityArn_,
$sel:creationDate:CreateActivityResponse' :: POSIX
creationDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_
}
createActivityResponse_httpStatus :: Lens.Lens' CreateActivityResponse Prelude.Int
createActivityResponse_httpStatus :: (Int -> f Int)
-> CreateActivityResponse -> f CreateActivityResponse
createActivityResponse_httpStatus = (CreateActivityResponse -> Int)
-> (CreateActivityResponse -> Int -> CreateActivityResponse)
-> Lens CreateActivityResponse CreateActivityResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivityResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateActivityResponse' :: CreateActivityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateActivityResponse
s@CreateActivityResponse' {} Int
a -> CreateActivityResponse
s {$sel:httpStatus:CreateActivityResponse' :: Int
httpStatus = Int
a} :: CreateActivityResponse)
createActivityResponse_activityArn :: Lens.Lens' CreateActivityResponse Prelude.Text
createActivityResponse_activityArn :: (Text -> f Text)
-> CreateActivityResponse -> f CreateActivityResponse
createActivityResponse_activityArn = (CreateActivityResponse -> Text)
-> (CreateActivityResponse -> Text -> CreateActivityResponse)
-> Lens CreateActivityResponse CreateActivityResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivityResponse' {Text
activityArn :: Text
$sel:activityArn:CreateActivityResponse' :: CreateActivityResponse -> Text
activityArn} -> Text
activityArn) (\s :: CreateActivityResponse
s@CreateActivityResponse' {} Text
a -> CreateActivityResponse
s {$sel:activityArn:CreateActivityResponse' :: Text
activityArn = Text
a} :: CreateActivityResponse)
createActivityResponse_creationDate :: Lens.Lens' CreateActivityResponse Prelude.UTCTime
createActivityResponse_creationDate :: (UTCTime -> f UTCTime)
-> CreateActivityResponse -> f CreateActivityResponse
createActivityResponse_creationDate = (CreateActivityResponse -> POSIX)
-> (CreateActivityResponse -> POSIX -> CreateActivityResponse)
-> Lens CreateActivityResponse CreateActivityResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateActivityResponse' {POSIX
creationDate :: POSIX
$sel:creationDate:CreateActivityResponse' :: CreateActivityResponse -> POSIX
creationDate} -> POSIX
creationDate) (\s :: CreateActivityResponse
s@CreateActivityResponse' {} POSIX
a -> CreateActivityResponse
s {$sel:creationDate:CreateActivityResponse' :: POSIX
creationDate = POSIX
a} :: CreateActivityResponse) ((POSIX -> f POSIX)
-> CreateActivityResponse -> f CreateActivityResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> CreateActivityResponse
-> f CreateActivityResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.NFData CreateActivityResponse