{-# 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.UndeprecateWorkflowType
-- 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 /workflow type/. After a workflow
-- type has been undeprecated, you can create new executions of that 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.
--
--     -   @workflowType.name@: String constraint. The key is
--         @swf:workflowType.name@.
--
--     -   @workflowType.version@: String constraint. The key is
--         @swf:workflowType.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.UndeprecateWorkflowType
  ( -- * Creating a Request
    UndeprecateWorkflowType (..),
    newUndeprecateWorkflowType,

    -- * Request Lenses
    undeprecateWorkflowType_domain,
    undeprecateWorkflowType_workflowType,

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

-- |
-- Create a value of 'UndeprecateWorkflowType' 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', 'undeprecateWorkflowType_domain' - The name of the domain of the deprecated workflow type.
--
-- 'workflowType', 'undeprecateWorkflowType_workflowType' - The name of the domain of the deprecated workflow type.
newUndeprecateWorkflowType ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'workflowType'
  WorkflowType ->
  UndeprecateWorkflowType
newUndeprecateWorkflowType :: Text -> WorkflowType -> UndeprecateWorkflowType
newUndeprecateWorkflowType Text
pDomain_ WorkflowType
pWorkflowType_ =
  UndeprecateWorkflowType' :: Text -> WorkflowType -> UndeprecateWorkflowType
UndeprecateWorkflowType'
    { $sel:domain:UndeprecateWorkflowType' :: Text
domain = Text
pDomain_,
      $sel:workflowType:UndeprecateWorkflowType' :: WorkflowType
workflowType = WorkflowType
pWorkflowType_
    }

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

-- | The name of the domain of the deprecated workflow type.
undeprecateWorkflowType_workflowType :: Lens.Lens' UndeprecateWorkflowType WorkflowType
undeprecateWorkflowType_workflowType :: (WorkflowType -> f WorkflowType)
-> UndeprecateWorkflowType -> f UndeprecateWorkflowType
undeprecateWorkflowType_workflowType = (UndeprecateWorkflowType -> WorkflowType)
-> (UndeprecateWorkflowType
    -> WorkflowType -> UndeprecateWorkflowType)
-> Lens
     UndeprecateWorkflowType
     UndeprecateWorkflowType
     WorkflowType
     WorkflowType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UndeprecateWorkflowType' {WorkflowType
workflowType :: WorkflowType
$sel:workflowType:UndeprecateWorkflowType' :: UndeprecateWorkflowType -> WorkflowType
workflowType} -> WorkflowType
workflowType) (\s :: UndeprecateWorkflowType
s@UndeprecateWorkflowType' {} WorkflowType
a -> UndeprecateWorkflowType
s {$sel:workflowType:UndeprecateWorkflowType' :: WorkflowType
workflowType = WorkflowType
a} :: UndeprecateWorkflowType)

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

instance Prelude.Hashable UndeprecateWorkflowType

instance Prelude.NFData UndeprecateWorkflowType

instance Core.ToHeaders UndeprecateWorkflowType where
  toHeaders :: UndeprecateWorkflowType -> [Header]
toHeaders =
    [Header] -> UndeprecateWorkflowType -> [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.UndeprecateWorkflowType" ::
                          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 UndeprecateWorkflowType where
  toJSON :: UndeprecateWorkflowType -> Value
toJSON UndeprecateWorkflowType' {Text
WorkflowType
workflowType :: WorkflowType
domain :: Text
$sel:workflowType:UndeprecateWorkflowType' :: UndeprecateWorkflowType -> WorkflowType
$sel:domain:UndeprecateWorkflowType' :: UndeprecateWorkflowType -> 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
"workflowType" Text -> WorkflowType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WorkflowType
workflowType)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    UndeprecateWorkflowTypeResponse