{-# 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.CopyClusterSnapshot
(
CopyClusterSnapshot (..),
newCopyClusterSnapshot,
copyClusterSnapshot_manualSnapshotRetentionPeriod,
copyClusterSnapshot_sourceSnapshotClusterIdentifier,
copyClusterSnapshot_sourceSnapshotIdentifier,
copyClusterSnapshot_targetSnapshotIdentifier,
CopyClusterSnapshotResponse (..),
newCopyClusterSnapshotResponse,
copyClusterSnapshotResponse_snapshot,
copyClusterSnapshotResponse_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 CopyClusterSnapshot = CopyClusterSnapshot'
{
CopyClusterSnapshot -> Maybe Int
manualSnapshotRetentionPeriod :: Prelude.Maybe Prelude.Int,
CopyClusterSnapshot -> Maybe Text
sourceSnapshotClusterIdentifier :: Prelude.Maybe Prelude.Text,
CopyClusterSnapshot -> Text
sourceSnapshotIdentifier :: Prelude.Text,
CopyClusterSnapshot -> Text
targetSnapshotIdentifier :: Prelude.Text
}
deriving (CopyClusterSnapshot -> CopyClusterSnapshot -> Bool
(CopyClusterSnapshot -> CopyClusterSnapshot -> Bool)
-> (CopyClusterSnapshot -> CopyClusterSnapshot -> Bool)
-> Eq CopyClusterSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyClusterSnapshot -> CopyClusterSnapshot -> Bool
$c/= :: CopyClusterSnapshot -> CopyClusterSnapshot -> Bool
== :: CopyClusterSnapshot -> CopyClusterSnapshot -> Bool
$c== :: CopyClusterSnapshot -> CopyClusterSnapshot -> Bool
Prelude.Eq, ReadPrec [CopyClusterSnapshot]
ReadPrec CopyClusterSnapshot
Int -> ReadS CopyClusterSnapshot
ReadS [CopyClusterSnapshot]
(Int -> ReadS CopyClusterSnapshot)
-> ReadS [CopyClusterSnapshot]
-> ReadPrec CopyClusterSnapshot
-> ReadPrec [CopyClusterSnapshot]
-> Read CopyClusterSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyClusterSnapshot]
$creadListPrec :: ReadPrec [CopyClusterSnapshot]
readPrec :: ReadPrec CopyClusterSnapshot
$creadPrec :: ReadPrec CopyClusterSnapshot
readList :: ReadS [CopyClusterSnapshot]
$creadList :: ReadS [CopyClusterSnapshot]
readsPrec :: Int -> ReadS CopyClusterSnapshot
$creadsPrec :: Int -> ReadS CopyClusterSnapshot
Prelude.Read, Int -> CopyClusterSnapshot -> ShowS
[CopyClusterSnapshot] -> ShowS
CopyClusterSnapshot -> String
(Int -> CopyClusterSnapshot -> ShowS)
-> (CopyClusterSnapshot -> String)
-> ([CopyClusterSnapshot] -> ShowS)
-> Show CopyClusterSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyClusterSnapshot] -> ShowS
$cshowList :: [CopyClusterSnapshot] -> ShowS
show :: CopyClusterSnapshot -> String
$cshow :: CopyClusterSnapshot -> String
showsPrec :: Int -> CopyClusterSnapshot -> ShowS
$cshowsPrec :: Int -> CopyClusterSnapshot -> ShowS
Prelude.Show, (forall x. CopyClusterSnapshot -> Rep CopyClusterSnapshot x)
-> (forall x. Rep CopyClusterSnapshot x -> CopyClusterSnapshot)
-> Generic CopyClusterSnapshot
forall x. Rep CopyClusterSnapshot x -> CopyClusterSnapshot
forall x. CopyClusterSnapshot -> Rep CopyClusterSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyClusterSnapshot x -> CopyClusterSnapshot
$cfrom :: forall x. CopyClusterSnapshot -> Rep CopyClusterSnapshot x
Prelude.Generic)
newCopyClusterSnapshot ::
Prelude.Text ->
Prelude.Text ->
CopyClusterSnapshot
newCopyClusterSnapshot :: Text -> Text -> CopyClusterSnapshot
newCopyClusterSnapshot
Text
pSourceSnapshotIdentifier_
Text
pTargetSnapshotIdentifier_ =
CopyClusterSnapshot' :: Maybe Int -> Maybe Text -> Text -> Text -> CopyClusterSnapshot
CopyClusterSnapshot'
{ $sel:manualSnapshotRetentionPeriod:CopyClusterSnapshot' :: Maybe Int
manualSnapshotRetentionPeriod =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:sourceSnapshotClusterIdentifier:CopyClusterSnapshot' :: Maybe Text
sourceSnapshotClusterIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceSnapshotIdentifier:CopyClusterSnapshot' :: Text
sourceSnapshotIdentifier =
Text
pSourceSnapshotIdentifier_,
$sel:targetSnapshotIdentifier:CopyClusterSnapshot' :: Text
targetSnapshotIdentifier =
Text
pTargetSnapshotIdentifier_
}
copyClusterSnapshot_manualSnapshotRetentionPeriod :: Lens.Lens' CopyClusterSnapshot (Prelude.Maybe Prelude.Int)
copyClusterSnapshot_manualSnapshotRetentionPeriod :: (Maybe Int -> f (Maybe Int))
-> CopyClusterSnapshot -> f CopyClusterSnapshot
copyClusterSnapshot_manualSnapshotRetentionPeriod = (CopyClusterSnapshot -> Maybe Int)
-> (CopyClusterSnapshot -> Maybe Int -> CopyClusterSnapshot)
-> Lens
CopyClusterSnapshot CopyClusterSnapshot (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshot' {Maybe Int
manualSnapshotRetentionPeriod :: Maybe Int
$sel:manualSnapshotRetentionPeriod:CopyClusterSnapshot' :: CopyClusterSnapshot -> Maybe Int
manualSnapshotRetentionPeriod} -> Maybe Int
manualSnapshotRetentionPeriod) (\s :: CopyClusterSnapshot
s@CopyClusterSnapshot' {} Maybe Int
a -> CopyClusterSnapshot
s {$sel:manualSnapshotRetentionPeriod:CopyClusterSnapshot' :: Maybe Int
manualSnapshotRetentionPeriod = Maybe Int
a} :: CopyClusterSnapshot)
copyClusterSnapshot_sourceSnapshotClusterIdentifier :: Lens.Lens' CopyClusterSnapshot (Prelude.Maybe Prelude.Text)
copyClusterSnapshot_sourceSnapshotClusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> CopyClusterSnapshot -> f CopyClusterSnapshot
copyClusterSnapshot_sourceSnapshotClusterIdentifier = (CopyClusterSnapshot -> Maybe Text)
-> (CopyClusterSnapshot -> Maybe Text -> CopyClusterSnapshot)
-> Lens
CopyClusterSnapshot CopyClusterSnapshot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshot' {Maybe Text
sourceSnapshotClusterIdentifier :: Maybe Text
$sel:sourceSnapshotClusterIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Maybe Text
sourceSnapshotClusterIdentifier} -> Maybe Text
sourceSnapshotClusterIdentifier) (\s :: CopyClusterSnapshot
s@CopyClusterSnapshot' {} Maybe Text
a -> CopyClusterSnapshot
s {$sel:sourceSnapshotClusterIdentifier:CopyClusterSnapshot' :: Maybe Text
sourceSnapshotClusterIdentifier = Maybe Text
a} :: CopyClusterSnapshot)
copyClusterSnapshot_sourceSnapshotIdentifier :: Lens.Lens' CopyClusterSnapshot Prelude.Text
copyClusterSnapshot_sourceSnapshotIdentifier :: (Text -> f Text) -> CopyClusterSnapshot -> f CopyClusterSnapshot
copyClusterSnapshot_sourceSnapshotIdentifier = (CopyClusterSnapshot -> Text)
-> (CopyClusterSnapshot -> Text -> CopyClusterSnapshot)
-> Lens CopyClusterSnapshot CopyClusterSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshot' {Text
sourceSnapshotIdentifier :: Text
$sel:sourceSnapshotIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Text
sourceSnapshotIdentifier} -> Text
sourceSnapshotIdentifier) (\s :: CopyClusterSnapshot
s@CopyClusterSnapshot' {} Text
a -> CopyClusterSnapshot
s {$sel:sourceSnapshotIdentifier:CopyClusterSnapshot' :: Text
sourceSnapshotIdentifier = Text
a} :: CopyClusterSnapshot)
copyClusterSnapshot_targetSnapshotIdentifier :: Lens.Lens' CopyClusterSnapshot Prelude.Text
copyClusterSnapshot_targetSnapshotIdentifier :: (Text -> f Text) -> CopyClusterSnapshot -> f CopyClusterSnapshot
copyClusterSnapshot_targetSnapshotIdentifier = (CopyClusterSnapshot -> Text)
-> (CopyClusterSnapshot -> Text -> CopyClusterSnapshot)
-> Lens CopyClusterSnapshot CopyClusterSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshot' {Text
targetSnapshotIdentifier :: Text
$sel:targetSnapshotIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Text
targetSnapshotIdentifier} -> Text
targetSnapshotIdentifier) (\s :: CopyClusterSnapshot
s@CopyClusterSnapshot' {} Text
a -> CopyClusterSnapshot
s {$sel:targetSnapshotIdentifier:CopyClusterSnapshot' :: Text
targetSnapshotIdentifier = Text
a} :: CopyClusterSnapshot)
instance Core.AWSRequest CopyClusterSnapshot where
type
AWSResponse CopyClusterSnapshot =
CopyClusterSnapshotResponse
request :: CopyClusterSnapshot -> Request CopyClusterSnapshot
request = Service -> CopyClusterSnapshot -> Request CopyClusterSnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CopyClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CopyClusterSnapshot)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CopyClusterSnapshot))
-> Logger
-> Service
-> Proxy CopyClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CopyClusterSnapshot)))
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
"CopyClusterSnapshotResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Snapshot -> Int -> CopyClusterSnapshotResponse
CopyClusterSnapshotResponse'
(Maybe Snapshot -> Int -> CopyClusterSnapshotResponse)
-> Either String (Maybe Snapshot)
-> Either String (Int -> CopyClusterSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Snapshot)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Snapshot")
Either String (Int -> CopyClusterSnapshotResponse)
-> Either String Int -> Either String CopyClusterSnapshotResponse
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 CopyClusterSnapshot
instance Prelude.NFData CopyClusterSnapshot
instance Core.ToHeaders CopyClusterSnapshot where
toHeaders :: CopyClusterSnapshot -> ResponseHeaders
toHeaders = ResponseHeaders -> CopyClusterSnapshot -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CopyClusterSnapshot where
toPath :: CopyClusterSnapshot -> ByteString
toPath = ByteString -> CopyClusterSnapshot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CopyClusterSnapshot where
toQuery :: CopyClusterSnapshot -> QueryString
toQuery CopyClusterSnapshot' {Maybe Int
Maybe Text
Text
targetSnapshotIdentifier :: Text
sourceSnapshotIdentifier :: Text
sourceSnapshotClusterIdentifier :: Maybe Text
manualSnapshotRetentionPeriod :: Maybe Int
$sel:targetSnapshotIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Text
$sel:sourceSnapshotIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Text
$sel:sourceSnapshotClusterIdentifier:CopyClusterSnapshot' :: CopyClusterSnapshot -> Maybe Text
$sel:manualSnapshotRetentionPeriod:CopyClusterSnapshot' :: CopyClusterSnapshot -> Maybe Int
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CopyClusterSnapshot" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"ManualSnapshotRetentionPeriod"
ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
manualSnapshotRetentionPeriod,
ByteString
"SourceSnapshotClusterIdentifier"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceSnapshotClusterIdentifier,
ByteString
"SourceSnapshotIdentifier"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceSnapshotIdentifier,
ByteString
"TargetSnapshotIdentifier"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetSnapshotIdentifier
]
data CopyClusterSnapshotResponse = CopyClusterSnapshotResponse'
{ CopyClusterSnapshotResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
CopyClusterSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CopyClusterSnapshotResponse -> CopyClusterSnapshotResponse -> Bool
(CopyClusterSnapshotResponse
-> CopyClusterSnapshotResponse -> Bool)
-> (CopyClusterSnapshotResponse
-> CopyClusterSnapshotResponse -> Bool)
-> Eq CopyClusterSnapshotResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyClusterSnapshotResponse -> CopyClusterSnapshotResponse -> Bool
$c/= :: CopyClusterSnapshotResponse -> CopyClusterSnapshotResponse -> Bool
== :: CopyClusterSnapshotResponse -> CopyClusterSnapshotResponse -> Bool
$c== :: CopyClusterSnapshotResponse -> CopyClusterSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CopyClusterSnapshotResponse]
ReadPrec CopyClusterSnapshotResponse
Int -> ReadS CopyClusterSnapshotResponse
ReadS [CopyClusterSnapshotResponse]
(Int -> ReadS CopyClusterSnapshotResponse)
-> ReadS [CopyClusterSnapshotResponse]
-> ReadPrec CopyClusterSnapshotResponse
-> ReadPrec [CopyClusterSnapshotResponse]
-> Read CopyClusterSnapshotResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyClusterSnapshotResponse]
$creadListPrec :: ReadPrec [CopyClusterSnapshotResponse]
readPrec :: ReadPrec CopyClusterSnapshotResponse
$creadPrec :: ReadPrec CopyClusterSnapshotResponse
readList :: ReadS [CopyClusterSnapshotResponse]
$creadList :: ReadS [CopyClusterSnapshotResponse]
readsPrec :: Int -> ReadS CopyClusterSnapshotResponse
$creadsPrec :: Int -> ReadS CopyClusterSnapshotResponse
Prelude.Read, Int -> CopyClusterSnapshotResponse -> ShowS
[CopyClusterSnapshotResponse] -> ShowS
CopyClusterSnapshotResponse -> String
(Int -> CopyClusterSnapshotResponse -> ShowS)
-> (CopyClusterSnapshotResponse -> String)
-> ([CopyClusterSnapshotResponse] -> ShowS)
-> Show CopyClusterSnapshotResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyClusterSnapshotResponse] -> ShowS
$cshowList :: [CopyClusterSnapshotResponse] -> ShowS
show :: CopyClusterSnapshotResponse -> String
$cshow :: CopyClusterSnapshotResponse -> String
showsPrec :: Int -> CopyClusterSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CopyClusterSnapshotResponse -> ShowS
Prelude.Show, (forall x.
CopyClusterSnapshotResponse -> Rep CopyClusterSnapshotResponse x)
-> (forall x.
Rep CopyClusterSnapshotResponse x -> CopyClusterSnapshotResponse)
-> Generic CopyClusterSnapshotResponse
forall x.
Rep CopyClusterSnapshotResponse x -> CopyClusterSnapshotResponse
forall x.
CopyClusterSnapshotResponse -> Rep CopyClusterSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CopyClusterSnapshotResponse x -> CopyClusterSnapshotResponse
$cfrom :: forall x.
CopyClusterSnapshotResponse -> Rep CopyClusterSnapshotResponse x
Prelude.Generic)
newCopyClusterSnapshotResponse ::
Prelude.Int ->
CopyClusterSnapshotResponse
newCopyClusterSnapshotResponse :: Int -> CopyClusterSnapshotResponse
newCopyClusterSnapshotResponse Int
pHttpStatus_ =
CopyClusterSnapshotResponse' :: Maybe Snapshot -> Int -> CopyClusterSnapshotResponse
CopyClusterSnapshotResponse'
{ $sel:snapshot:CopyClusterSnapshotResponse' :: Maybe Snapshot
snapshot =
Maybe Snapshot
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CopyClusterSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
copyClusterSnapshotResponse_snapshot :: Lens.Lens' CopyClusterSnapshotResponse (Prelude.Maybe Snapshot)
copyClusterSnapshotResponse_snapshot :: (Maybe Snapshot -> f (Maybe Snapshot))
-> CopyClusterSnapshotResponse -> f CopyClusterSnapshotResponse
copyClusterSnapshotResponse_snapshot = (CopyClusterSnapshotResponse -> Maybe Snapshot)
-> (CopyClusterSnapshotResponse
-> Maybe Snapshot -> CopyClusterSnapshotResponse)
-> Lens
CopyClusterSnapshotResponse
CopyClusterSnapshotResponse
(Maybe Snapshot)
(Maybe Snapshot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshotResponse' {Maybe Snapshot
snapshot :: Maybe Snapshot
$sel:snapshot:CopyClusterSnapshotResponse' :: CopyClusterSnapshotResponse -> Maybe Snapshot
snapshot} -> Maybe Snapshot
snapshot) (\s :: CopyClusterSnapshotResponse
s@CopyClusterSnapshotResponse' {} Maybe Snapshot
a -> CopyClusterSnapshotResponse
s {$sel:snapshot:CopyClusterSnapshotResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
a} :: CopyClusterSnapshotResponse)
copyClusterSnapshotResponse_httpStatus :: Lens.Lens' CopyClusterSnapshotResponse Prelude.Int
copyClusterSnapshotResponse_httpStatus :: (Int -> f Int)
-> CopyClusterSnapshotResponse -> f CopyClusterSnapshotResponse
copyClusterSnapshotResponse_httpStatus = (CopyClusterSnapshotResponse -> Int)
-> (CopyClusterSnapshotResponse
-> Int -> CopyClusterSnapshotResponse)
-> Lens
CopyClusterSnapshotResponse CopyClusterSnapshotResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyClusterSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:CopyClusterSnapshotResponse' :: CopyClusterSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CopyClusterSnapshotResponse
s@CopyClusterSnapshotResponse' {} Int
a -> CopyClusterSnapshotResponse
s {$sel:httpStatus:CopyClusterSnapshotResponse' :: Int
httpStatus = Int
a} :: CopyClusterSnapshotResponse)
instance Prelude.NFData CopyClusterSnapshotResponse