{-# 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.SWF.DeprecateActivityType
-- 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)
--
-- Deprecates the specified /activity type/. After an activity type has
-- been deprecated, you cannot create new tasks of that activity type.
-- Tasks of this type that were scheduled before the type was deprecated
-- continue to run.
--
-- This operation is eventually consistent. The results are best effort and
-- may not exactly reflect recent updates and changes.
--
-- __Access Control__
--
-- You can use IAM policies to control this action\'s access to Amazon SWF
-- resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   Constrain the following parameters by using a @Condition@ element
--     with the appropriate keys.
--
--     -   @activityType.name@: String constraint. The key is
--         @swf:activityType.name@.
--
--     -   @activityType.version@: String constraint. The key is
--         @swf:activityType.version@.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
module Amazonka.SWF.DeprecateActivityType
  ( -- * Creating a Request
    DeprecateActivityType (..),
    newDeprecateActivityType,

    -- * Request Lenses
    deprecateActivityType_domain,
    deprecateActivityType_activityType,

    -- * Destructuring the Response
    DeprecateActivityTypeResponse (..),
    newDeprecateActivityTypeResponse,
  )
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.SWF.Types

-- | /See:/ 'newDeprecateActivityType' smart constructor.
data DeprecateActivityType = DeprecateActivityType'
  { -- | The name of the domain in which the activity type is registered.
    DeprecateActivityType -> Text
domain :: Prelude.Text,
    -- | The activity type to deprecate.
    DeprecateActivityType -> ActivityType
activityType :: ActivityType
  }
  deriving (DeprecateActivityType -> DeprecateActivityType -> Bool
(DeprecateActivityType -> DeprecateActivityType -> Bool)
-> (DeprecateActivityType -> DeprecateActivityType -> Bool)
-> Eq DeprecateActivityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeprecateActivityType -> DeprecateActivityType -> Bool
$c/= :: DeprecateActivityType -> DeprecateActivityType -> Bool
== :: DeprecateActivityType -> DeprecateActivityType -> Bool
$c== :: DeprecateActivityType -> DeprecateActivityType -> Bool
Prelude.Eq, ReadPrec [DeprecateActivityType]
ReadPrec DeprecateActivityType
Int -> ReadS DeprecateActivityType
ReadS [DeprecateActivityType]
(Int -> ReadS DeprecateActivityType)
-> ReadS [DeprecateActivityType]
-> ReadPrec DeprecateActivityType
-> ReadPrec [DeprecateActivityType]
-> Read DeprecateActivityType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeprecateActivityType]
$creadListPrec :: ReadPrec [DeprecateActivityType]
readPrec :: ReadPrec DeprecateActivityType
$creadPrec :: ReadPrec DeprecateActivityType
readList :: ReadS [DeprecateActivityType]
$creadList :: ReadS [DeprecateActivityType]
readsPrec :: Int -> ReadS DeprecateActivityType
$creadsPrec :: Int -> ReadS DeprecateActivityType
Prelude.Read, Int -> DeprecateActivityType -> ShowS
[DeprecateActivityType] -> ShowS
DeprecateActivityType -> String
(Int -> DeprecateActivityType -> ShowS)
-> (DeprecateActivityType -> String)
-> ([DeprecateActivityType] -> ShowS)
-> Show DeprecateActivityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeprecateActivityType] -> ShowS
$cshowList :: [DeprecateActivityType] -> ShowS
show :: DeprecateActivityType -> String
$cshow :: DeprecateActivityType -> String
showsPrec :: Int -> DeprecateActivityType -> ShowS
$cshowsPrec :: Int -> DeprecateActivityType -> ShowS
Prelude.Show, (forall x. DeprecateActivityType -> Rep DeprecateActivityType x)
-> (forall x. Rep DeprecateActivityType x -> DeprecateActivityType)
-> Generic DeprecateActivityType
forall x. Rep DeprecateActivityType x -> DeprecateActivityType
forall x. DeprecateActivityType -> Rep DeprecateActivityType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeprecateActivityType x -> DeprecateActivityType
$cfrom :: forall x. DeprecateActivityType -> Rep DeprecateActivityType x
Prelude.Generic)

-- |
-- Create a value of 'DeprecateActivityType' 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:
--
-- 'domain', 'deprecateActivityType_domain' - The name of the domain in which the activity type is registered.
--
-- 'activityType', 'deprecateActivityType_activityType' - The activity type to deprecate.
newDeprecateActivityType ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'activityType'
  ActivityType ->
  DeprecateActivityType
newDeprecateActivityType :: Text -> ActivityType -> DeprecateActivityType
newDeprecateActivityType Text
pDomain_ ActivityType
pActivityType_ =
  DeprecateActivityType' :: Text -> ActivityType -> DeprecateActivityType
DeprecateActivityType'
    { $sel:domain:DeprecateActivityType' :: Text
domain = Text
pDomain_,
      $sel:activityType:DeprecateActivityType' :: ActivityType
activityType = ActivityType
pActivityType_
    }

-- | The name of the domain in which the activity type is registered.
deprecateActivityType_domain :: Lens.Lens' DeprecateActivityType Prelude.Text
deprecateActivityType_domain :: (Text -> f Text)
-> DeprecateActivityType -> f DeprecateActivityType
deprecateActivityType_domain = (DeprecateActivityType -> Text)
-> (DeprecateActivityType -> Text -> DeprecateActivityType)
-> Lens DeprecateActivityType DeprecateActivityType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeprecateActivityType' {Text
domain :: Text
$sel:domain:DeprecateActivityType' :: DeprecateActivityType -> Text
domain} -> Text
domain) (\s :: DeprecateActivityType
s@DeprecateActivityType' {} Text
a -> DeprecateActivityType
s {$sel:domain:DeprecateActivityType' :: Text
domain = Text
a} :: DeprecateActivityType)

-- | The activity type to deprecate.
deprecateActivityType_activityType :: Lens.Lens' DeprecateActivityType ActivityType
deprecateActivityType_activityType :: (ActivityType -> f ActivityType)
-> DeprecateActivityType -> f DeprecateActivityType
deprecateActivityType_activityType = (DeprecateActivityType -> ActivityType)
-> (DeprecateActivityType -> ActivityType -> DeprecateActivityType)
-> Lens
     DeprecateActivityType
     DeprecateActivityType
     ActivityType
     ActivityType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeprecateActivityType' {ActivityType
activityType :: ActivityType
$sel:activityType:DeprecateActivityType' :: DeprecateActivityType -> ActivityType
activityType} -> ActivityType
activityType) (\s :: DeprecateActivityType
s@DeprecateActivityType' {} ActivityType
a -> DeprecateActivityType
s {$sel:activityType:DeprecateActivityType' :: ActivityType
activityType = ActivityType
a} :: DeprecateActivityType)

instance Core.AWSRequest DeprecateActivityType where
  type
    AWSResponse DeprecateActivityType =
      DeprecateActivityTypeResponse
  request :: DeprecateActivityType -> Request DeprecateActivityType
request = Service -> DeprecateActivityType -> Request DeprecateActivityType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeprecateActivityType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeprecateActivityType)))
response =
    AWSResponse DeprecateActivityType
-> Logger
-> Service
-> Proxy DeprecateActivityType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeprecateActivityType)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeprecateActivityType
DeprecateActivityTypeResponse
DeprecateActivityTypeResponse'

instance Prelude.Hashable DeprecateActivityType

instance Prelude.NFData DeprecateActivityType

instance Core.ToHeaders DeprecateActivityType where
  toHeaders :: DeprecateActivityType -> [Header]
toHeaders =
    [Header] -> DeprecateActivityType -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"SimpleWorkflowService.DeprecateActivityType" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeprecateActivityType where
  toJSON :: DeprecateActivityType -> Value
toJSON DeprecateActivityType' {Text
ActivityType
activityType :: ActivityType
domain :: Text
$sel:activityType:DeprecateActivityType' :: DeprecateActivityType -> ActivityType
$sel:domain:DeprecateActivityType' :: DeprecateActivityType -> 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
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"activityType" Text -> ActivityType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ActivityType
activityType)
          ]
      )

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

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

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

-- |
-- Create a value of 'DeprecateActivityTypeResponse' 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.
newDeprecateActivityTypeResponse ::
  DeprecateActivityTypeResponse
newDeprecateActivityTypeResponse :: DeprecateActivityTypeResponse
newDeprecateActivityTypeResponse =
  DeprecateActivityTypeResponse
DeprecateActivityTypeResponse'

instance Prelude.NFData DeprecateActivityTypeResponse