{-# 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.DeleteActivity
-- 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)
--
-- Deletes an activity.
module Amazonka.StepFunctions.DeleteActivity
  ( -- * Creating a Request
    DeleteActivity (..),
    newDeleteActivity,

    -- * Request Lenses
    deleteActivity_activityArn,

    -- * Destructuring the Response
    DeleteActivityResponse (..),
    newDeleteActivityResponse,

    -- * Response Lenses
    deleteActivityResponse_httpStatus,
  )
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:/ 'newDeleteActivity' smart constructor.
data DeleteActivity = DeleteActivity'
  { -- | The Amazon Resource Name (ARN) of the activity to delete.
    DeleteActivity -> Text
activityArn :: Prelude.Text
  }
  deriving (DeleteActivity -> DeleteActivity -> Bool
(DeleteActivity -> DeleteActivity -> Bool)
-> (DeleteActivity -> DeleteActivity -> Bool) -> Eq DeleteActivity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteActivity -> DeleteActivity -> Bool
$c/= :: DeleteActivity -> DeleteActivity -> Bool
== :: DeleteActivity -> DeleteActivity -> Bool
$c== :: DeleteActivity -> DeleteActivity -> Bool
Prelude.Eq, ReadPrec [DeleteActivity]
ReadPrec DeleteActivity
Int -> ReadS DeleteActivity
ReadS [DeleteActivity]
(Int -> ReadS DeleteActivity)
-> ReadS [DeleteActivity]
-> ReadPrec DeleteActivity
-> ReadPrec [DeleteActivity]
-> Read DeleteActivity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteActivity]
$creadListPrec :: ReadPrec [DeleteActivity]
readPrec :: ReadPrec DeleteActivity
$creadPrec :: ReadPrec DeleteActivity
readList :: ReadS [DeleteActivity]
$creadList :: ReadS [DeleteActivity]
readsPrec :: Int -> ReadS DeleteActivity
$creadsPrec :: Int -> ReadS DeleteActivity
Prelude.Read, Int -> DeleteActivity -> ShowS
[DeleteActivity] -> ShowS
DeleteActivity -> String
(Int -> DeleteActivity -> ShowS)
-> (DeleteActivity -> String)
-> ([DeleteActivity] -> ShowS)
-> Show DeleteActivity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteActivity] -> ShowS
$cshowList :: [DeleteActivity] -> ShowS
show :: DeleteActivity -> String
$cshow :: DeleteActivity -> String
showsPrec :: Int -> DeleteActivity -> ShowS
$cshowsPrec :: Int -> DeleteActivity -> ShowS
Prelude.Show, (forall x. DeleteActivity -> Rep DeleteActivity x)
-> (forall x. Rep DeleteActivity x -> DeleteActivity)
-> Generic DeleteActivity
forall x. Rep DeleteActivity x -> DeleteActivity
forall x. DeleteActivity -> Rep DeleteActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteActivity x -> DeleteActivity
$cfrom :: forall x. DeleteActivity -> Rep DeleteActivity x
Prelude.Generic)

-- |
-- Create a value of 'DeleteActivity' 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', 'deleteActivity_activityArn' - The Amazon Resource Name (ARN) of the activity to delete.
newDeleteActivity ::
  -- | 'activityArn'
  Prelude.Text ->
  DeleteActivity
newDeleteActivity :: Text -> DeleteActivity
newDeleteActivity Text
pActivityArn_ =
  DeleteActivity' :: Text -> DeleteActivity
DeleteActivity' {$sel:activityArn:DeleteActivity' :: Text
activityArn = Text
pActivityArn_}

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

instance Core.AWSRequest DeleteActivity where
  type
    AWSResponse DeleteActivity =
      DeleteActivityResponse
  request :: DeleteActivity -> Request DeleteActivity
request = Service -> DeleteActivity -> Request DeleteActivity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteActivity)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteActivity))
-> Logger
-> Service
-> Proxy DeleteActivity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteActivity)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteActivityResponse
DeleteActivityResponse'
            (Int -> DeleteActivityResponse)
-> Either String Int -> Either String DeleteActivityResponse
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))
      )

instance Prelude.Hashable DeleteActivity

instance Prelude.NFData DeleteActivity

instance Core.ToHeaders DeleteActivity where
  toHeaders :: DeleteActivity -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteActivity -> 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.DeleteActivity" ::
                          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 DeleteActivity where
  toJSON :: DeleteActivity -> Value
toJSON DeleteActivity' {Text
activityArn :: Text
$sel:activityArn:DeleteActivity' :: DeleteActivity -> 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 DeleteActivity where
  toPath :: DeleteActivity -> ByteString
toPath = ByteString -> DeleteActivity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDeleteActivityResponse' smart constructor.
data DeleteActivityResponse = DeleteActivityResponse'
  { -- | The response's http status code.
    DeleteActivityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteActivityResponse -> DeleteActivityResponse -> Bool
(DeleteActivityResponse -> DeleteActivityResponse -> Bool)
-> (DeleteActivityResponse -> DeleteActivityResponse -> Bool)
-> Eq DeleteActivityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteActivityResponse -> DeleteActivityResponse -> Bool
$c/= :: DeleteActivityResponse -> DeleteActivityResponse -> Bool
== :: DeleteActivityResponse -> DeleteActivityResponse -> Bool
$c== :: DeleteActivityResponse -> DeleteActivityResponse -> Bool
Prelude.Eq, ReadPrec [DeleteActivityResponse]
ReadPrec DeleteActivityResponse
Int -> ReadS DeleteActivityResponse
ReadS [DeleteActivityResponse]
(Int -> ReadS DeleteActivityResponse)
-> ReadS [DeleteActivityResponse]
-> ReadPrec DeleteActivityResponse
-> ReadPrec [DeleteActivityResponse]
-> Read DeleteActivityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteActivityResponse]
$creadListPrec :: ReadPrec [DeleteActivityResponse]
readPrec :: ReadPrec DeleteActivityResponse
$creadPrec :: ReadPrec DeleteActivityResponse
readList :: ReadS [DeleteActivityResponse]
$creadList :: ReadS [DeleteActivityResponse]
readsPrec :: Int -> ReadS DeleteActivityResponse
$creadsPrec :: Int -> ReadS DeleteActivityResponse
Prelude.Read, Int -> DeleteActivityResponse -> ShowS
[DeleteActivityResponse] -> ShowS
DeleteActivityResponse -> String
(Int -> DeleteActivityResponse -> ShowS)
-> (DeleteActivityResponse -> String)
-> ([DeleteActivityResponse] -> ShowS)
-> Show DeleteActivityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteActivityResponse] -> ShowS
$cshowList :: [DeleteActivityResponse] -> ShowS
show :: DeleteActivityResponse -> String
$cshow :: DeleteActivityResponse -> String
showsPrec :: Int -> DeleteActivityResponse -> ShowS
$cshowsPrec :: Int -> DeleteActivityResponse -> ShowS
Prelude.Show, (forall x. DeleteActivityResponse -> Rep DeleteActivityResponse x)
-> (forall x.
    Rep DeleteActivityResponse x -> DeleteActivityResponse)
-> Generic DeleteActivityResponse
forall x. Rep DeleteActivityResponse x -> DeleteActivityResponse
forall x. DeleteActivityResponse -> Rep DeleteActivityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteActivityResponse x -> DeleteActivityResponse
$cfrom :: forall x. DeleteActivityResponse -> Rep DeleteActivityResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteActivityResponse' 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', 'deleteActivityResponse_httpStatus' - The response's http status code.
newDeleteActivityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteActivityResponse
newDeleteActivityResponse :: Int -> DeleteActivityResponse
newDeleteActivityResponse Int
pHttpStatus_ =
  DeleteActivityResponse' :: Int -> DeleteActivityResponse
DeleteActivityResponse' {$sel:httpStatus:DeleteActivityResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteActivityResponse