{-# 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 #-}
module Amazonka.Redshift.DeleteCluster
(
DeleteCluster (..),
newDeleteCluster,
deleteCluster_skipFinalClusterSnapshot,
deleteCluster_finalClusterSnapshotRetentionPeriod,
deleteCluster_finalClusterSnapshotIdentifier,
deleteCluster_clusterIdentifier,
DeleteClusterResponse (..),
newDeleteClusterResponse,
deleteClusterResponse_cluster,
deleteClusterResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteCluster = DeleteCluster'
{
DeleteCluster -> Maybe Bool
skipFinalClusterSnapshot :: Prelude.Maybe Prelude.Bool,
DeleteCluster -> Maybe Int
finalClusterSnapshotRetentionPeriod :: Prelude.Maybe Prelude.Int,
DeleteCluster -> Maybe Text
finalClusterSnapshotIdentifier :: Prelude.Maybe Prelude.Text,
DeleteCluster -> Text
clusterIdentifier :: 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)
newDeleteCluster ::
Prelude.Text ->
DeleteCluster
newDeleteCluster :: Text -> DeleteCluster
newDeleteCluster Text
pClusterIdentifier_ =
DeleteCluster' :: Maybe Bool -> Maybe Int -> Maybe Text -> Text -> DeleteCluster
DeleteCluster'
{ $sel:skipFinalClusterSnapshot:DeleteCluster' :: Maybe Bool
skipFinalClusterSnapshot =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:finalClusterSnapshotRetentionPeriod:DeleteCluster' :: Maybe Int
finalClusterSnapshotRetentionPeriod =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:finalClusterSnapshotIdentifier:DeleteCluster' :: Maybe Text
finalClusterSnapshotIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterIdentifier:DeleteCluster' :: Text
clusterIdentifier = Text
pClusterIdentifier_
}
deleteCluster_skipFinalClusterSnapshot :: Lens.Lens' DeleteCluster (Prelude.Maybe Prelude.Bool)
deleteCluster_skipFinalClusterSnapshot :: (Maybe Bool -> f (Maybe Bool)) -> DeleteCluster -> f DeleteCluster
deleteCluster_skipFinalClusterSnapshot = (DeleteCluster -> Maybe Bool)
-> (DeleteCluster -> Maybe Bool -> DeleteCluster)
-> Lens DeleteCluster DeleteCluster (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCluster' {Maybe Bool
skipFinalClusterSnapshot :: Maybe Bool
$sel:skipFinalClusterSnapshot:DeleteCluster' :: DeleteCluster -> Maybe Bool
skipFinalClusterSnapshot} -> Maybe Bool
skipFinalClusterSnapshot) (\s :: DeleteCluster
s@DeleteCluster' {} Maybe Bool
a -> DeleteCluster
s {$sel:skipFinalClusterSnapshot:DeleteCluster' :: Maybe Bool
skipFinalClusterSnapshot = Maybe Bool
a} :: DeleteCluster)
deleteCluster_finalClusterSnapshotRetentionPeriod :: Lens.Lens' DeleteCluster (Prelude.Maybe Prelude.Int)
deleteCluster_finalClusterSnapshotRetentionPeriod :: (Maybe Int -> f (Maybe Int)) -> DeleteCluster -> f DeleteCluster
deleteCluster_finalClusterSnapshotRetentionPeriod = (DeleteCluster -> Maybe Int)
-> (DeleteCluster -> Maybe Int -> DeleteCluster)
-> Lens DeleteCluster DeleteCluster (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCluster' {Maybe Int
finalClusterSnapshotRetentionPeriod :: Maybe Int
$sel:finalClusterSnapshotRetentionPeriod:DeleteCluster' :: DeleteCluster -> Maybe Int
finalClusterSnapshotRetentionPeriod} -> Maybe Int
finalClusterSnapshotRetentionPeriod) (\s :: DeleteCluster
s@DeleteCluster' {} Maybe Int
a -> DeleteCluster
s {$sel:finalClusterSnapshotRetentionPeriod:DeleteCluster' :: Maybe Int
finalClusterSnapshotRetentionPeriod = Maybe Int
a} :: DeleteCluster)
deleteCluster_finalClusterSnapshotIdentifier :: Lens.Lens' DeleteCluster (Prelude.Maybe Prelude.Text)
deleteCluster_finalClusterSnapshotIdentifier :: (Maybe Text -> f (Maybe Text)) -> DeleteCluster -> f DeleteCluster
deleteCluster_finalClusterSnapshotIdentifier = (DeleteCluster -> Maybe Text)
-> (DeleteCluster -> Maybe Text -> DeleteCluster)
-> Lens DeleteCluster DeleteCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCluster' {Maybe Text
finalClusterSnapshotIdentifier :: Maybe Text
$sel:finalClusterSnapshotIdentifier:DeleteCluster' :: DeleteCluster -> Maybe Text
finalClusterSnapshotIdentifier} -> Maybe Text
finalClusterSnapshotIdentifier) (\s :: DeleteCluster
s@DeleteCluster' {} Maybe Text
a -> DeleteCluster
s {$sel:finalClusterSnapshotIdentifier:DeleteCluster' :: Maybe Text
finalClusterSnapshotIdentifier = Maybe Text
a} :: DeleteCluster)
deleteCluster_clusterIdentifier :: Lens.Lens' DeleteCluster Prelude.Text
deleteCluster_clusterIdentifier :: (Text -> f Text) -> DeleteCluster -> f DeleteCluster
deleteCluster_clusterIdentifier = (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
clusterIdentifier :: Text
$sel:clusterIdentifier:DeleteCluster' :: DeleteCluster -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: DeleteCluster
s@DeleteCluster' {} Text
a -> DeleteCluster
s {$sel:clusterIdentifier:DeleteCluster' :: Text
clusterIdentifier = 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.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCluster)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DeleteCluster))
-> Logger
-> Service
-> Proxy DeleteCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCluster)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"DeleteClusterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Cluster -> Int -> DeleteClusterResponse
DeleteClusterResponse'
(Maybe Cluster -> Int -> DeleteClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> DeleteClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Cluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Cluster")
Either String (Int -> DeleteClusterResponse)
-> Either String Int -> Either String DeleteClusterResponse
forall (f :: * -> *) a b. Applicative f => 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
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DeleteCluster where
toPath :: DeleteCluster -> ByteString
toPath = ByteString -> DeleteCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteCluster where
toQuery :: DeleteCluster -> QueryString
toQuery DeleteCluster' {Maybe Bool
Maybe Int
Maybe Text
Text
clusterIdentifier :: Text
finalClusterSnapshotIdentifier :: Maybe Text
finalClusterSnapshotRetentionPeriod :: Maybe Int
skipFinalClusterSnapshot :: Maybe Bool
$sel:clusterIdentifier:DeleteCluster' :: DeleteCluster -> Text
$sel:finalClusterSnapshotIdentifier:DeleteCluster' :: DeleteCluster -> Maybe Text
$sel:finalClusterSnapshotRetentionPeriod:DeleteCluster' :: DeleteCluster -> Maybe Int
$sel:skipFinalClusterSnapshot:DeleteCluster' :: DeleteCluster -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteCluster" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"SkipFinalClusterSnapshot"
ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
skipFinalClusterSnapshot,
ByteString
"FinalClusterSnapshotRetentionPeriod"
ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
finalClusterSnapshotRetentionPeriod,
ByteString
"FinalClusterSnapshotIdentifier"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
finalClusterSnapshotIdentifier,
ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier
]
data DeleteClusterResponse = DeleteClusterResponse'
{ DeleteClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
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)
newDeleteClusterResponse ::
Prelude.Int ->
DeleteClusterResponse
newDeleteClusterResponse :: Int -> DeleteClusterResponse
newDeleteClusterResponse Int
pHttpStatus_ =
DeleteClusterResponse' :: Maybe Cluster -> Int -> DeleteClusterResponse
DeleteClusterResponse'
{ $sel:cluster:DeleteClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteClusterResponse_cluster :: Lens.Lens' DeleteClusterResponse (Prelude.Maybe Cluster)
deleteClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> DeleteClusterResponse -> f DeleteClusterResponse
deleteClusterResponse_cluster = (DeleteClusterResponse -> Maybe Cluster)
-> (DeleteClusterResponse
-> Maybe Cluster -> DeleteClusterResponse)
-> Lens
DeleteClusterResponse
DeleteClusterResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:DeleteClusterResponse' :: DeleteClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: DeleteClusterResponse
s@DeleteClusterResponse' {} Maybe Cluster
a -> DeleteClusterResponse
s {$sel:cluster:DeleteClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: DeleteClusterResponse)
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