{-# 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.OpsWorks.DeregisterEcsCluster
-- 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)
--
-- Deregisters a specified Amazon ECS cluster from a stack. For more
-- information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-ecscluster.html#workinglayers-ecscluster-delete Resource Management>.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Manage permissions level for the stack or an attached policy that
-- explicitly grants permissions. For more information on user permissions,
-- see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html>.
module Amazonka.OpsWorks.DeregisterEcsCluster
  ( -- * Creating a Request
    DeregisterEcsCluster (..),
    newDeregisterEcsCluster,

    -- * Request Lenses
    deregisterEcsCluster_ecsClusterArn,

    -- * Destructuring the Response
    DeregisterEcsClusterResponse (..),
    newDeregisterEcsClusterResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeregisterEcsCluster' smart constructor.
data DeregisterEcsCluster = DeregisterEcsCluster'
  { -- | The cluster\'s Amazon Resource Number (ARN).
    DeregisterEcsCluster -> Text
ecsClusterArn :: Prelude.Text
  }
  deriving (DeregisterEcsCluster -> DeregisterEcsCluster -> Bool
(DeregisterEcsCluster -> DeregisterEcsCluster -> Bool)
-> (DeregisterEcsCluster -> DeregisterEcsCluster -> Bool)
-> Eq DeregisterEcsCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterEcsCluster -> DeregisterEcsCluster -> Bool
$c/= :: DeregisterEcsCluster -> DeregisterEcsCluster -> Bool
== :: DeregisterEcsCluster -> DeregisterEcsCluster -> Bool
$c== :: DeregisterEcsCluster -> DeregisterEcsCluster -> Bool
Prelude.Eq, ReadPrec [DeregisterEcsCluster]
ReadPrec DeregisterEcsCluster
Int -> ReadS DeregisterEcsCluster
ReadS [DeregisterEcsCluster]
(Int -> ReadS DeregisterEcsCluster)
-> ReadS [DeregisterEcsCluster]
-> ReadPrec DeregisterEcsCluster
-> ReadPrec [DeregisterEcsCluster]
-> Read DeregisterEcsCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterEcsCluster]
$creadListPrec :: ReadPrec [DeregisterEcsCluster]
readPrec :: ReadPrec DeregisterEcsCluster
$creadPrec :: ReadPrec DeregisterEcsCluster
readList :: ReadS [DeregisterEcsCluster]
$creadList :: ReadS [DeregisterEcsCluster]
readsPrec :: Int -> ReadS DeregisterEcsCluster
$creadsPrec :: Int -> ReadS DeregisterEcsCluster
Prelude.Read, Int -> DeregisterEcsCluster -> ShowS
[DeregisterEcsCluster] -> ShowS
DeregisterEcsCluster -> String
(Int -> DeregisterEcsCluster -> ShowS)
-> (DeregisterEcsCluster -> String)
-> ([DeregisterEcsCluster] -> ShowS)
-> Show DeregisterEcsCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterEcsCluster] -> ShowS
$cshowList :: [DeregisterEcsCluster] -> ShowS
show :: DeregisterEcsCluster -> String
$cshow :: DeregisterEcsCluster -> String
showsPrec :: Int -> DeregisterEcsCluster -> ShowS
$cshowsPrec :: Int -> DeregisterEcsCluster -> ShowS
Prelude.Show, (forall x. DeregisterEcsCluster -> Rep DeregisterEcsCluster x)
-> (forall x. Rep DeregisterEcsCluster x -> DeregisterEcsCluster)
-> Generic DeregisterEcsCluster
forall x. Rep DeregisterEcsCluster x -> DeregisterEcsCluster
forall x. DeregisterEcsCluster -> Rep DeregisterEcsCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterEcsCluster x -> DeregisterEcsCluster
$cfrom :: forall x. DeregisterEcsCluster -> Rep DeregisterEcsCluster x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterEcsCluster' 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:
--
-- 'ecsClusterArn', 'deregisterEcsCluster_ecsClusterArn' - The cluster\'s Amazon Resource Number (ARN).
newDeregisterEcsCluster ::
  -- | 'ecsClusterArn'
  Prelude.Text ->
  DeregisterEcsCluster
newDeregisterEcsCluster :: Text -> DeregisterEcsCluster
newDeregisterEcsCluster Text
pEcsClusterArn_ =
  DeregisterEcsCluster' :: Text -> DeregisterEcsCluster
DeregisterEcsCluster'
    { $sel:ecsClusterArn:DeregisterEcsCluster' :: Text
ecsClusterArn =
        Text
pEcsClusterArn_
    }

-- | The cluster\'s Amazon Resource Number (ARN).
deregisterEcsCluster_ecsClusterArn :: Lens.Lens' DeregisterEcsCluster Prelude.Text
deregisterEcsCluster_ecsClusterArn :: (Text -> f Text) -> DeregisterEcsCluster -> f DeregisterEcsCluster
deregisterEcsCluster_ecsClusterArn = (DeregisterEcsCluster -> Text)
-> (DeregisterEcsCluster -> Text -> DeregisterEcsCluster)
-> Lens DeregisterEcsCluster DeregisterEcsCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterEcsCluster' {Text
ecsClusterArn :: Text
$sel:ecsClusterArn:DeregisterEcsCluster' :: DeregisterEcsCluster -> Text
ecsClusterArn} -> Text
ecsClusterArn) (\s :: DeregisterEcsCluster
s@DeregisterEcsCluster' {} Text
a -> DeregisterEcsCluster
s {$sel:ecsClusterArn:DeregisterEcsCluster' :: Text
ecsClusterArn = Text
a} :: DeregisterEcsCluster)

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

instance Prelude.Hashable DeregisterEcsCluster

instance Prelude.NFData DeregisterEcsCluster

instance Core.ToHeaders DeregisterEcsCluster where
  toHeaders :: DeregisterEcsCluster -> [Header]
toHeaders =
    [Header] -> DeregisterEcsCluster -> [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
"OpsWorks_20130218.DeregisterEcsCluster" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeregisterEcsCluster where
  toJSON :: DeregisterEcsCluster -> Value
toJSON DeregisterEcsCluster' {Text
ecsClusterArn :: Text
$sel:ecsClusterArn:DeregisterEcsCluster' :: DeregisterEcsCluster -> 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
"EcsClusterArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ecsClusterArn)
          ]
      )

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

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

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

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

instance Prelude.NFData DeregisterEcsClusterResponse