{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.StepFunctions.DescribeActivity
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes an activity.
--
-- This operation is eventually consistent. The results are best effort and
-- may not reflect very recent updates and changes.
module Amazonka.StepFunctions.DescribeActivity
  ( -- * Creating a Request
    DescribeActivity (..),
    newDescribeActivity,

    -- * Request Lenses
    describeActivity_activityArn,

    -- * Destructuring the Response
    DescribeActivityResponse (..),
    newDescribeActivityResponse,

    -- * Response Lenses
    describeActivityResponse_httpStatus,
    describeActivityResponse_activityArn,
    describeActivityResponse_name,
    describeActivityResponse_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

-- | /See:/ 'newDescribeActivity' smart constructor.
data DescribeActivity = DescribeActivity'
  { -- | The Amazon Resource Name (ARN) of the activity to describe.
    DescribeActivity -> Text
activityArn :: Prelude.Text
  }
  deriving (DescribeActivity -> DescribeActivity -> Bool
(DescribeActivity -> DescribeActivity -> Bool)
-> (DescribeActivity -> DescribeActivity -> Bool)
-> Eq DescribeActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeActivity -> DescribeActivity -> Bool
$c/= :: DescribeActivity -> DescribeActivity -> Bool
== :: DescribeActivity -> DescribeActivity -> Bool
$c== :: DescribeActivity -> DescribeActivity -> Bool
Prelude.Eq, ReadPrec [DescribeActivity]
ReadPrec DescribeActivity
Int -> ReadS DescribeActivity
ReadS [DescribeActivity]
(Int -> ReadS DescribeActivity)
-> ReadS [DescribeActivity]
-> ReadPrec DescribeActivity
-> ReadPrec [DescribeActivity]
-> Read DescribeActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeActivity]
$creadListPrec :: ReadPrec [DescribeActivity]
readPrec :: ReadPrec DescribeActivity
$creadPrec :: ReadPrec DescribeActivity
readList :: ReadS [DescribeActivity]
$creadList :: ReadS [DescribeActivity]
readsPrec :: Int -> ReadS DescribeActivity
$creadsPrec :: Int -> ReadS DescribeActivity
Prelude.Read, Int -> DescribeActivity -> ShowS
[DescribeActivity] -> ShowS
DescribeActivity -> String
(Int -> DescribeActivity -> ShowS)
-> (DescribeActivity -> String)
-> ([DescribeActivity] -> ShowS)
-> Show DescribeActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeActivity] -> ShowS
$cshowList :: [DescribeActivity] -> ShowS
show :: DescribeActivity -> String
$cshow :: DescribeActivity -> String
showsPrec :: Int -> DescribeActivity -> ShowS
$cshowsPrec :: Int -> DescribeActivity -> ShowS
Prelude.Show, (forall x. DescribeActivity -> Rep DescribeActivity x)
-> (forall x. Rep DescribeActivity x -> DescribeActivity)
-> Generic DescribeActivity
forall x. Rep DescribeActivity x -> DescribeActivity
forall x. DescribeActivity -> Rep DescribeActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeActivity x -> DescribeActivity
$cfrom :: forall x. DescribeActivity -> Rep DescribeActivity x
Prelude.Generic)

-- |
-- Create a value of 'DescribeActivity' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'activityArn', 'describeActivity_activityArn' - The Amazon Resource Name (ARN) of the activity to describe.
newDescribeActivity ::
  -- | 'activityArn'
  Prelude.Text ->
  DescribeActivity
newDescribeActivity :: Text -> DescribeActivity
newDescribeActivity Text
pActivityArn_ =
  DescribeActivity' :: Text -> DescribeActivity
DescribeActivity' {$sel:activityArn:DescribeActivity' :: Text
activityArn = Text
pActivityArn_}

-- | The Amazon Resource Name (ARN) of the activity to describe.
describeActivity_activityArn :: Lens.Lens' DescribeActivity Prelude.Text
describeActivity_activityArn :: (Text -> f Text) -> DescribeActivity -> f DescribeActivity
describeActivity_activityArn = (DescribeActivity -> Text)
-> (DescribeActivity -> Text -> DescribeActivity)
-> Lens DescribeActivity DescribeActivity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivity' {Text
activityArn :: Text
$sel:activityArn:DescribeActivity' :: DescribeActivity -> Text
activityArn} -> Text
activityArn) (\s :: DescribeActivity
s@DescribeActivity' {} Text
a -> DescribeActivity
s {$sel:activityArn:DescribeActivity' :: Text
activityArn = Text
a} :: DescribeActivity)

instance Core.AWSRequest DescribeActivity where
  type
    AWSResponse DescribeActivity =
      DescribeActivityResponse
  request :: DescribeActivity -> Request DescribeActivity
request = Service -> DescribeActivity -> Request DescribeActivity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeActivity)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeActivity))
-> Logger
-> Service
-> Proxy DescribeActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeActivity)))
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 -> Text -> POSIX -> DescribeActivityResponse
DescribeActivityResponse'
            (Int -> Text -> Text -> POSIX -> DescribeActivityResponse)
-> Either String Int
-> Either
     String (Text -> Text -> POSIX -> DescribeActivityResponse)
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 -> Text -> POSIX -> DescribeActivityResponse)
-> Either String Text
-> Either String (Text -> POSIX -> DescribeActivityResponse)
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 (Text -> POSIX -> DescribeActivityResponse)
-> Either String Text
-> Either String (POSIX -> DescribeActivityResponse)
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
"name")
            Either String (POSIX -> DescribeActivityResponse)
-> Either String POSIX -> Either String DescribeActivityResponse
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 DescribeActivity

instance Prelude.NFData DescribeActivity

instance Core.ToHeaders DescribeActivity where
  toHeaders :: DescribeActivity -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeActivity -> 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.DescribeActivity" ::
                          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 DescribeActivity where
  toJSON :: DescribeActivity -> Value
toJSON DescribeActivity' {Text
activityArn :: Text
$sel:activityArn:DescribeActivity' :: DescribeActivity -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"activityArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
activityArn)]
      )

instance Core.ToPath DescribeActivity where
  toPath :: DescribeActivity -> ByteString
toPath = ByteString -> DescribeActivity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeActivity where
  toQuery :: DescribeActivity -> QueryString
toQuery = QueryString -> DescribeActivity -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeActivityResponse' smart constructor.
data DescribeActivityResponse = DescribeActivityResponse'
  { -- | The response's http status code.
    DescribeActivityResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) that identifies the activity.
    DescribeActivityResponse -> Text
activityArn :: Prelude.Text,
    -- | The name of the activity.
    --
    -- A name must /not/ contain:
    --
    -- -   white space
    --
    -- -   brackets @\< > { } [ ]@
    --
    -- -   wildcard characters @? *@
    --
    -- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
    --
    -- -   control characters (@U+0000-001F@, @U+007F-009F@)
    --
    -- To enable logging with CloudWatch Logs, the name should only contain
    -- 0-9, A-Z, a-z, - and _.
    DescribeActivityResponse -> Text
name :: Prelude.Text,
    -- | The date the activity is created.
    DescribeActivityResponse -> POSIX
creationDate :: Core.POSIX
  }
  deriving (DescribeActivityResponse -> DescribeActivityResponse -> Bool
(DescribeActivityResponse -> DescribeActivityResponse -> Bool)
-> (DescribeActivityResponse -> DescribeActivityResponse -> Bool)
-> Eq DescribeActivityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeActivityResponse -> DescribeActivityResponse -> Bool
$c/= :: DescribeActivityResponse -> DescribeActivityResponse -> Bool
== :: DescribeActivityResponse -> DescribeActivityResponse -> Bool
$c== :: DescribeActivityResponse -> DescribeActivityResponse -> Bool
Prelude.Eq, ReadPrec [DescribeActivityResponse]
ReadPrec DescribeActivityResponse
Int -> ReadS DescribeActivityResponse
ReadS [DescribeActivityResponse]
(Int -> ReadS DescribeActivityResponse)
-> ReadS [DescribeActivityResponse]
-> ReadPrec DescribeActivityResponse
-> ReadPrec [DescribeActivityResponse]
-> Read DescribeActivityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeActivityResponse]
$creadListPrec :: ReadPrec [DescribeActivityResponse]
readPrec :: ReadPrec DescribeActivityResponse
$creadPrec :: ReadPrec DescribeActivityResponse
readList :: ReadS [DescribeActivityResponse]
$creadList :: ReadS [DescribeActivityResponse]
readsPrec :: Int -> ReadS DescribeActivityResponse
$creadsPrec :: Int -> ReadS DescribeActivityResponse
Prelude.Read, Int -> DescribeActivityResponse -> ShowS
[DescribeActivityResponse] -> ShowS
DescribeActivityResponse -> String
(Int -> DescribeActivityResponse -> ShowS)
-> (DescribeActivityResponse -> String)
-> ([DescribeActivityResponse] -> ShowS)
-> Show DescribeActivityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeActivityResponse] -> ShowS
$cshowList :: [DescribeActivityResponse] -> ShowS
show :: DescribeActivityResponse -> String
$cshow :: DescribeActivityResponse -> String
showsPrec :: Int -> DescribeActivityResponse -> ShowS
$cshowsPrec :: Int -> DescribeActivityResponse -> ShowS
Prelude.Show, (forall x.
 DescribeActivityResponse -> Rep DescribeActivityResponse x)
-> (forall x.
    Rep DescribeActivityResponse x -> DescribeActivityResponse)
-> Generic DescribeActivityResponse
forall x.
Rep DescribeActivityResponse x -> DescribeActivityResponse
forall x.
DescribeActivityResponse -> Rep DescribeActivityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeActivityResponse x -> DescribeActivityResponse
$cfrom :: forall x.
DescribeActivityResponse -> Rep DescribeActivityResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeActivityResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'describeActivityResponse_httpStatus' - The response's http status code.
--
-- 'activityArn', 'describeActivityResponse_activityArn' - The Amazon Resource Name (ARN) that identifies the activity.
--
-- 'name', 'describeActivityResponse_name' - The name of the activity.
--
-- A name must /not/ contain:
--
-- -   white space
--
-- -   brackets @\< > { } [ ]@
--
-- -   wildcard characters @? *@
--
-- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
--
-- -   control characters (@U+0000-001F@, @U+007F-009F@)
--
-- To enable logging with CloudWatch Logs, the name should only contain
-- 0-9, A-Z, a-z, - and _.
--
-- 'creationDate', 'describeActivityResponse_creationDate' - The date the activity is created.
newDescribeActivityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'activityArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  DescribeActivityResponse
newDescribeActivityResponse :: Int -> Text -> Text -> UTCTime -> DescribeActivityResponse
newDescribeActivityResponse
  Int
pHttpStatus_
  Text
pActivityArn_
  Text
pName_
  UTCTime
pCreationDate_ =
    DescribeActivityResponse' :: Int -> Text -> Text -> POSIX -> DescribeActivityResponse
DescribeActivityResponse'
      { $sel:httpStatus:DescribeActivityResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:activityArn:DescribeActivityResponse' :: Text
activityArn = Text
pActivityArn_,
        $sel:name:DescribeActivityResponse' :: Text
name = Text
pName_,
        $sel:creationDate:DescribeActivityResponse' :: 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_
      }

-- | The response's http status code.
describeActivityResponse_httpStatus :: Lens.Lens' DescribeActivityResponse Prelude.Int
describeActivityResponse_httpStatus :: (Int -> f Int)
-> DescribeActivityResponse -> f DescribeActivityResponse
describeActivityResponse_httpStatus = (DescribeActivityResponse -> Int)
-> (DescribeActivityResponse -> Int -> DescribeActivityResponse)
-> Lens DescribeActivityResponse DescribeActivityResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivityResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeActivityResponse' :: DescribeActivityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeActivityResponse
s@DescribeActivityResponse' {} Int
a -> DescribeActivityResponse
s {$sel:httpStatus:DescribeActivityResponse' :: Int
httpStatus = Int
a} :: DescribeActivityResponse)

-- | The Amazon Resource Name (ARN) that identifies the activity.
describeActivityResponse_activityArn :: Lens.Lens' DescribeActivityResponse Prelude.Text
describeActivityResponse_activityArn :: (Text -> f Text)
-> DescribeActivityResponse -> f DescribeActivityResponse
describeActivityResponse_activityArn = (DescribeActivityResponse -> Text)
-> (DescribeActivityResponse -> Text -> DescribeActivityResponse)
-> Lens DescribeActivityResponse DescribeActivityResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivityResponse' {Text
activityArn :: Text
$sel:activityArn:DescribeActivityResponse' :: DescribeActivityResponse -> Text
activityArn} -> Text
activityArn) (\s :: DescribeActivityResponse
s@DescribeActivityResponse' {} Text
a -> DescribeActivityResponse
s {$sel:activityArn:DescribeActivityResponse' :: Text
activityArn = Text
a} :: DescribeActivityResponse)

-- | The name of the activity.
--
-- A name must /not/ contain:
--
-- -   white space
--
-- -   brackets @\< > { } [ ]@
--
-- -   wildcard characters @? *@
--
-- -   special characters @\" # % \\ ^ | ~ \` $ & , ; : \/@
--
-- -   control characters (@U+0000-001F@, @U+007F-009F@)
--
-- To enable logging with CloudWatch Logs, the name should only contain
-- 0-9, A-Z, a-z, - and _.
describeActivityResponse_name :: Lens.Lens' DescribeActivityResponse Prelude.Text
describeActivityResponse_name :: (Text -> f Text)
-> DescribeActivityResponse -> f DescribeActivityResponse
describeActivityResponse_name = (DescribeActivityResponse -> Text)
-> (DescribeActivityResponse -> Text -> DescribeActivityResponse)
-> Lens DescribeActivityResponse DescribeActivityResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivityResponse' {Text
name :: Text
$sel:name:DescribeActivityResponse' :: DescribeActivityResponse -> Text
name} -> Text
name) (\s :: DescribeActivityResponse
s@DescribeActivityResponse' {} Text
a -> DescribeActivityResponse
s {$sel:name:DescribeActivityResponse' :: Text
name = Text
a} :: DescribeActivityResponse)

-- | The date the activity is created.
describeActivityResponse_creationDate :: Lens.Lens' DescribeActivityResponse Prelude.UTCTime
describeActivityResponse_creationDate :: (UTCTime -> f UTCTime)
-> DescribeActivityResponse -> f DescribeActivityResponse
describeActivityResponse_creationDate = (DescribeActivityResponse -> POSIX)
-> (DescribeActivityResponse -> POSIX -> DescribeActivityResponse)
-> Lens
     DescribeActivityResponse DescribeActivityResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivityResponse' {POSIX
creationDate :: POSIX
$sel:creationDate:DescribeActivityResponse' :: DescribeActivityResponse -> POSIX
creationDate} -> POSIX
creationDate) (\s :: DescribeActivityResponse
s@DescribeActivityResponse' {} POSIX
a -> DescribeActivityResponse
s {$sel:creationDate:DescribeActivityResponse' :: POSIX
creationDate = POSIX
a} :: DescribeActivityResponse) ((POSIX -> f POSIX)
 -> DescribeActivityResponse -> f DescribeActivityResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> DescribeActivityResponse
-> f DescribeActivityResponse
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 DescribeActivityResponse