{-# 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.Route53RecoveryControlConfig.DeleteCluster
-- 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)
--
-- Delete a cluster.
module Amazonka.Route53RecoveryControlConfig.DeleteCluster
  ( -- * Creating a Request
    DeleteCluster (..),
    newDeleteCluster,

    -- * Request Lenses
    deleteCluster_clusterArn,

    -- * Destructuring the Response
    DeleteClusterResponse (..),
    newDeleteClusterResponse,

    -- * Response Lenses
    deleteClusterResponse_httpStatus,
  )
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.Route53RecoveryControlConfig.Types

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

-- |
-- Create a value of 'DeleteCluster' 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:
--
-- 'clusterArn', 'deleteCluster_clusterArn' - The Amazon Resource Name (ARN) of the cluster that you\'re deleting.
newDeleteCluster ::
  -- | 'clusterArn'
  Prelude.Text ->
  DeleteCluster
newDeleteCluster :: Text -> DeleteCluster
newDeleteCluster Text
pClusterArn_ =
  DeleteCluster' :: Text -> DeleteCluster
DeleteCluster' {$sel:clusterArn:DeleteCluster' :: Text
clusterArn = Text
pClusterArn_}

-- | The Amazon Resource Name (ARN) of the cluster that you\'re deleting.
deleteCluster_clusterArn :: Lens.Lens' DeleteCluster Prelude.Text
deleteCluster_clusterArn :: (Text -> f Text) -> DeleteCluster -> f DeleteCluster
deleteCluster_clusterArn = (DeleteCluster -> Text)
-> (DeleteCluster -> Text -> DeleteCluster)
-> Lens DeleteCluster DeleteCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCluster' {Text
clusterArn :: Text
$sel:clusterArn:DeleteCluster' :: DeleteCluster -> Text
clusterArn} -> Text
clusterArn) (\s :: DeleteCluster
s@DeleteCluster' {} Text
a -> DeleteCluster
s {$sel:clusterArn:DeleteCluster' :: Text
clusterArn = Text
a} :: DeleteCluster)

instance Core.AWSRequest DeleteCluster where
  type
    AWSResponse DeleteCluster =
      DeleteClusterResponse
  request :: DeleteCluster -> Request DeleteCluster
request = Service -> DeleteCluster -> Request DeleteCluster
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCluster)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteCluster))
-> Logger
-> Service
-> Proxy DeleteCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCluster)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteClusterResponse
DeleteClusterResponse'
            (Int -> DeleteClusterResponse)
-> Either String Int -> Either String DeleteClusterResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteCluster

instance Prelude.NFData DeleteCluster

instance Core.ToHeaders DeleteCluster where
  toHeaders :: DeleteCluster -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteCluster where
  toPath :: DeleteCluster -> ByteString
toPath DeleteCluster' {Text
clusterArn :: Text
$sel:clusterArn:DeleteCluster' :: DeleteCluster -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/cluster/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clusterArn]

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

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

-- |
-- Create a value of 'DeleteClusterResponse' 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:
--
-- 'httpStatus', 'deleteClusterResponse_httpStatus' - The response's http status code.
newDeleteClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteClusterResponse
newDeleteClusterResponse :: Int -> DeleteClusterResponse
newDeleteClusterResponse Int
pHttpStatus_ =
  DeleteClusterResponse' :: Int -> DeleteClusterResponse
DeleteClusterResponse' {$sel:httpStatus:DeleteClusterResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
deleteClusterResponse_httpStatus :: Lens.Lens' DeleteClusterResponse Prelude.Int
deleteClusterResponse_httpStatus :: (Int -> f Int) -> DeleteClusterResponse -> f DeleteClusterResponse
deleteClusterResponse_httpStatus = (DeleteClusterResponse -> Int)
-> (DeleteClusterResponse -> Int -> DeleteClusterResponse)
-> Lens DeleteClusterResponse DeleteClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteClusterResponse' :: DeleteClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteClusterResponse
s@DeleteClusterResponse' {} Int
a -> DeleteClusterResponse
s {$sel:httpStatus:DeleteClusterResponse' :: Int
httpStatus = Int
a} :: DeleteClusterResponse)

instance Prelude.NFData DeleteClusterResponse