{-# 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.DeprecateDomain
-- 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 domain. After a domain has been deprecated it
-- cannot be used to create new workflow executions or register new types.
-- However, you can still use visibility actions on this domain.
-- Deprecating a domain also deprecates all activity and workflow types
-- registered in the domain. Executions that were started before the domain
-- was deprecated continues 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.
--
-- -   You cannot use an IAM policy to constrain this action\'s parameters.
--
-- 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.DeprecateDomain
  ( -- * Creating a Request
    DeprecateDomain (..),
    newDeprecateDomain,

    -- * Request Lenses
    deprecateDomain_name,

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

-- |
-- Create a value of 'DeprecateDomain' 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:
--
-- 'name', 'deprecateDomain_name' - The name of the domain to deprecate.
newDeprecateDomain ::
  -- | 'name'
  Prelude.Text ->
  DeprecateDomain
newDeprecateDomain :: Text -> DeprecateDomain
newDeprecateDomain Text
pName_ =
  DeprecateDomain' :: Text -> DeprecateDomain
DeprecateDomain' {$sel:name:DeprecateDomain' :: Text
name = Text
pName_}

-- | The name of the domain to deprecate.
deprecateDomain_name :: Lens.Lens' DeprecateDomain Prelude.Text
deprecateDomain_name :: (Text -> f Text) -> DeprecateDomain -> f DeprecateDomain
deprecateDomain_name = (DeprecateDomain -> Text)
-> (DeprecateDomain -> Text -> DeprecateDomain)
-> Lens DeprecateDomain DeprecateDomain Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeprecateDomain' {Text
name :: Text
$sel:name:DeprecateDomain' :: DeprecateDomain -> Text
name} -> Text
name) (\s :: DeprecateDomain
s@DeprecateDomain' {} Text
a -> DeprecateDomain
s {$sel:name:DeprecateDomain' :: Text
name = Text
a} :: DeprecateDomain)

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

instance Prelude.Hashable DeprecateDomain

instance Prelude.NFData DeprecateDomain

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

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

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

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

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

instance Prelude.NFData DeprecateDomainResponse