{-# 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.UndeprecateActivityType
-- 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)
--
-- Undeprecates a previously deprecated /activity type/. After an activity
-- type has been undeprecated, you can create new tasks of that activity
-- type.
--
-- 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.UndeprecateActivityType
  ( -- * Creating a Request
    UndeprecateActivityType (..),
    newUndeprecateActivityType,

    -- * Request Lenses
    undeprecateActivityType_domain,
    undeprecateActivityType_activityType,

    -- * Destructuring the Response
    UndeprecateActivityTypeResponse (..),
    newUndeprecateActivityTypeResponse,
  )
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:/ 'newUndeprecateActivityType' smart constructor.
data UndeprecateActivityType = UndeprecateActivityType'
  { -- | The name of the domain of the deprecated activity type.
    UndeprecateActivityType -> Text
domain :: Prelude.Text,
    -- | The activity type to undeprecate.
    UndeprecateActivityType -> ActivityType
activityType :: ActivityType
  }
  deriving (UndeprecateActivityType -> UndeprecateActivityType -> Bool
(UndeprecateActivityType -> UndeprecateActivityType -> Bool)
-> (UndeprecateActivityType -> UndeprecateActivityType -> Bool)
-> Eq UndeprecateActivityType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UndeprecateActivityType -> UndeprecateActivityType -> Bool
$c/= :: UndeprecateActivityType -> UndeprecateActivityType -> Bool
== :: UndeprecateActivityType -> UndeprecateActivityType -> Bool
$c== :: UndeprecateActivityType -> UndeprecateActivityType -> Bool
Prelude.Eq, ReadPrec [UndeprecateActivityType]
ReadPrec UndeprecateActivityType
Int -> ReadS UndeprecateActivityType
ReadS [UndeprecateActivityType]
(Int -> ReadS UndeprecateActivityType)
-> ReadS [UndeprecateActivityType]
-> ReadPrec UndeprecateActivityType
-> ReadPrec [UndeprecateActivityType]
-> Read UndeprecateActivityType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UndeprecateActivityType]
$creadListPrec :: ReadPrec [UndeprecateActivityType]
readPrec :: ReadPrec UndeprecateActivityType
$creadPrec :: ReadPrec UndeprecateActivityType
readList :: ReadS [UndeprecateActivityType]
$creadList :: ReadS [UndeprecateActivityType]
readsPrec :: Int -> ReadS UndeprecateActivityType
$creadsPrec :: Int -> ReadS UndeprecateActivityType
Prelude.Read, Int -> UndeprecateActivityType -> ShowS
[UndeprecateActivityType] -> ShowS
UndeprecateActivityType -> String
(Int -> UndeprecateActivityType -> ShowS)
-> (UndeprecateActivityType -> String)
-> ([UndeprecateActivityType] -> ShowS)
-> Show UndeprecateActivityType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UndeprecateActivityType] -> ShowS
$cshowList :: [UndeprecateActivityType] -> ShowS
show :: UndeprecateActivityType -> String
$cshow :: UndeprecateActivityType -> String
showsPrec :: Int -> UndeprecateActivityType -> ShowS
$cshowsPrec :: Int -> UndeprecateActivityType -> ShowS
Prelude.Show, (forall x.
 UndeprecateActivityType -> Rep UndeprecateActivityType x)
-> (forall x.
    Rep UndeprecateActivityType x -> UndeprecateActivityType)
-> Generic UndeprecateActivityType
forall x. Rep UndeprecateActivityType x -> UndeprecateActivityType
forall x. UndeprecateActivityType -> Rep UndeprecateActivityType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UndeprecateActivityType x -> UndeprecateActivityType
$cfrom :: forall x. UndeprecateActivityType -> Rep UndeprecateActivityType x
Prelude.Generic)

-- |
-- Create a value of 'UndeprecateActivityType' 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', 'undeprecateActivityType_domain' - The name of the domain of the deprecated activity type.
--
-- 'activityType', 'undeprecateActivityType_activityType' - The activity type to undeprecate.
newUndeprecateActivityType ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'activityType'
  ActivityType ->
  UndeprecateActivityType
newUndeprecateActivityType :: Text -> ActivityType -> UndeprecateActivityType
newUndeprecateActivityType Text
pDomain_ ActivityType
pActivityType_ =
  UndeprecateActivityType' :: Text -> ActivityType -> UndeprecateActivityType
UndeprecateActivityType'
    { $sel:domain:UndeprecateActivityType' :: Text
domain = Text
pDomain_,
      $sel:activityType:UndeprecateActivityType' :: ActivityType
activityType = ActivityType
pActivityType_
    }

-- | The name of the domain of the deprecated activity type.
undeprecateActivityType_domain :: Lens.Lens' UndeprecateActivityType Prelude.Text
undeprecateActivityType_domain :: (Text -> f Text)
-> UndeprecateActivityType -> f UndeprecateActivityType
undeprecateActivityType_domain = (UndeprecateActivityType -> Text)
-> (UndeprecateActivityType -> Text -> UndeprecateActivityType)
-> Lens UndeprecateActivityType UndeprecateActivityType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UndeprecateActivityType' {Text
domain :: Text
$sel:domain:UndeprecateActivityType' :: UndeprecateActivityType -> Text
domain} -> Text
domain) (\s :: UndeprecateActivityType
s@UndeprecateActivityType' {} Text
a -> UndeprecateActivityType
s {$sel:domain:UndeprecateActivityType' :: Text
domain = Text
a} :: UndeprecateActivityType)

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

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

instance Prelude.Hashable UndeprecateActivityType

instance Prelude.NFData UndeprecateActivityType

instance Core.ToHeaders UndeprecateActivityType where
  toHeaders :: UndeprecateActivityType -> [Header]
toHeaders =
    [Header] -> UndeprecateActivityType -> [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.UndeprecateActivityType" ::
                          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 UndeprecateActivityType where
  toJSON :: UndeprecateActivityType -> Value
toJSON UndeprecateActivityType' {Text
ActivityType
activityType :: ActivityType
domain :: Text
$sel:activityType:UndeprecateActivityType' :: UndeprecateActivityType -> ActivityType
$sel:domain:UndeprecateActivityType' :: UndeprecateActivityType -> 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 UndeprecateActivityType where
  toPath :: UndeprecateActivityType -> ByteString
toPath = ByteString -> UndeprecateActivityType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

instance
  Prelude.NFData
    UndeprecateActivityTypeResponse