{-# 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.CloudHSMV2.CopyBackupToRegion
(
CopyBackupToRegion (..),
newCopyBackupToRegion,
copyBackupToRegion_tagList,
copyBackupToRegion_destinationRegion,
copyBackupToRegion_backupId,
CopyBackupToRegionResponse (..),
newCopyBackupToRegionResponse,
copyBackupToRegionResponse_destinationBackup,
copyBackupToRegionResponse_httpStatus,
)
where
import Amazonka.CloudHSMV2.Types
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
data CopyBackupToRegion = CopyBackupToRegion'
{
CopyBackupToRegion -> Maybe [Tag]
tagList :: Prelude.Maybe [Tag],
CopyBackupToRegion -> Text
destinationRegion :: Prelude.Text,
CopyBackupToRegion -> Text
backupId :: Prelude.Text
}
deriving (CopyBackupToRegion -> CopyBackupToRegion -> Bool
(CopyBackupToRegion -> CopyBackupToRegion -> Bool)
-> (CopyBackupToRegion -> CopyBackupToRegion -> Bool)
-> Eq CopyBackupToRegion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyBackupToRegion -> CopyBackupToRegion -> Bool
$c/= :: CopyBackupToRegion -> CopyBackupToRegion -> Bool
== :: CopyBackupToRegion -> CopyBackupToRegion -> Bool
$c== :: CopyBackupToRegion -> CopyBackupToRegion -> Bool
Prelude.Eq, ReadPrec [CopyBackupToRegion]
ReadPrec CopyBackupToRegion
Int -> ReadS CopyBackupToRegion
ReadS [CopyBackupToRegion]
(Int -> ReadS CopyBackupToRegion)
-> ReadS [CopyBackupToRegion]
-> ReadPrec CopyBackupToRegion
-> ReadPrec [CopyBackupToRegion]
-> Read CopyBackupToRegion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyBackupToRegion]
$creadListPrec :: ReadPrec [CopyBackupToRegion]
readPrec :: ReadPrec CopyBackupToRegion
$creadPrec :: ReadPrec CopyBackupToRegion
readList :: ReadS [CopyBackupToRegion]
$creadList :: ReadS [CopyBackupToRegion]
readsPrec :: Int -> ReadS CopyBackupToRegion
$creadsPrec :: Int -> ReadS CopyBackupToRegion
Prelude.Read, Int -> CopyBackupToRegion -> ShowS
[CopyBackupToRegion] -> ShowS
CopyBackupToRegion -> String
(Int -> CopyBackupToRegion -> ShowS)
-> (CopyBackupToRegion -> String)
-> ([CopyBackupToRegion] -> ShowS)
-> Show CopyBackupToRegion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyBackupToRegion] -> ShowS
$cshowList :: [CopyBackupToRegion] -> ShowS
show :: CopyBackupToRegion -> String
$cshow :: CopyBackupToRegion -> String
showsPrec :: Int -> CopyBackupToRegion -> ShowS
$cshowsPrec :: Int -> CopyBackupToRegion -> ShowS
Prelude.Show, (forall x. CopyBackupToRegion -> Rep CopyBackupToRegion x)
-> (forall x. Rep CopyBackupToRegion x -> CopyBackupToRegion)
-> Generic CopyBackupToRegion
forall x. Rep CopyBackupToRegion x -> CopyBackupToRegion
forall x. CopyBackupToRegion -> Rep CopyBackupToRegion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyBackupToRegion x -> CopyBackupToRegion
$cfrom :: forall x. CopyBackupToRegion -> Rep CopyBackupToRegion x
Prelude.Generic)
newCopyBackupToRegion ::
Prelude.Text ->
Prelude.Text ->
CopyBackupToRegion
newCopyBackupToRegion :: Text -> Text -> CopyBackupToRegion
newCopyBackupToRegion Text
pDestinationRegion_ Text
pBackupId_ =
CopyBackupToRegion' :: Maybe [Tag] -> Text -> Text -> CopyBackupToRegion
CopyBackupToRegion'
{ $sel:tagList:CopyBackupToRegion' :: Maybe [Tag]
tagList = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:destinationRegion:CopyBackupToRegion' :: Text
destinationRegion = Text
pDestinationRegion_,
$sel:backupId:CopyBackupToRegion' :: Text
backupId = Text
pBackupId_
}
copyBackupToRegion_tagList :: Lens.Lens' CopyBackupToRegion (Prelude.Maybe [Tag])
copyBackupToRegion_tagList :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CopyBackupToRegion -> f CopyBackupToRegion
copyBackupToRegion_tagList = (CopyBackupToRegion -> Maybe [Tag])
-> (CopyBackupToRegion -> Maybe [Tag] -> CopyBackupToRegion)
-> Lens
CopyBackupToRegion CopyBackupToRegion (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyBackupToRegion' {Maybe [Tag]
tagList :: Maybe [Tag]
$sel:tagList:CopyBackupToRegion' :: CopyBackupToRegion -> Maybe [Tag]
tagList} -> Maybe [Tag]
tagList) (\s :: CopyBackupToRegion
s@CopyBackupToRegion' {} Maybe [Tag]
a -> CopyBackupToRegion
s {$sel:tagList:CopyBackupToRegion' :: Maybe [Tag]
tagList = Maybe [Tag]
a} :: CopyBackupToRegion) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CopyBackupToRegion -> f CopyBackupToRegion)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CopyBackupToRegion
-> f CopyBackupToRegion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
copyBackupToRegion_destinationRegion :: Lens.Lens' CopyBackupToRegion Prelude.Text
copyBackupToRegion_destinationRegion :: (Text -> f Text) -> CopyBackupToRegion -> f CopyBackupToRegion
copyBackupToRegion_destinationRegion = (CopyBackupToRegion -> Text)
-> (CopyBackupToRegion -> Text -> CopyBackupToRegion)
-> Lens CopyBackupToRegion CopyBackupToRegion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyBackupToRegion' {Text
destinationRegion :: Text
$sel:destinationRegion:CopyBackupToRegion' :: CopyBackupToRegion -> Text
destinationRegion} -> Text
destinationRegion) (\s :: CopyBackupToRegion
s@CopyBackupToRegion' {} Text
a -> CopyBackupToRegion
s {$sel:destinationRegion:CopyBackupToRegion' :: Text
destinationRegion = Text
a} :: CopyBackupToRegion)
copyBackupToRegion_backupId :: Lens.Lens' CopyBackupToRegion Prelude.Text
copyBackupToRegion_backupId :: (Text -> f Text) -> CopyBackupToRegion -> f CopyBackupToRegion
copyBackupToRegion_backupId = (CopyBackupToRegion -> Text)
-> (CopyBackupToRegion -> Text -> CopyBackupToRegion)
-> Lens CopyBackupToRegion CopyBackupToRegion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyBackupToRegion' {Text
backupId :: Text
$sel:backupId:CopyBackupToRegion' :: CopyBackupToRegion -> Text
backupId} -> Text
backupId) (\s :: CopyBackupToRegion
s@CopyBackupToRegion' {} Text
a -> CopyBackupToRegion
s {$sel:backupId:CopyBackupToRegion' :: Text
backupId = Text
a} :: CopyBackupToRegion)
instance Core.AWSRequest CopyBackupToRegion where
type
AWSResponse CopyBackupToRegion =
CopyBackupToRegionResponse
request :: CopyBackupToRegion -> Request CopyBackupToRegion
request = Service -> CopyBackupToRegion -> Request CopyBackupToRegion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CopyBackupToRegion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CopyBackupToRegion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CopyBackupToRegion))
-> Logger
-> Service
-> Proxy CopyBackupToRegion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CopyBackupToRegion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DestinationBackup -> Int -> CopyBackupToRegionResponse
CopyBackupToRegionResponse'
(Maybe DestinationBackup -> Int -> CopyBackupToRegionResponse)
-> Either String (Maybe DestinationBackup)
-> Either String (Int -> CopyBackupToRegionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DestinationBackup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DestinationBackup")
Either String (Int -> CopyBackupToRegionResponse)
-> Either String Int -> Either String CopyBackupToRegionResponse
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 CopyBackupToRegion
instance Prelude.NFData CopyBackupToRegion
instance Core.ToHeaders CopyBackupToRegion where
toHeaders :: CopyBackupToRegion -> ResponseHeaders
toHeaders =
ResponseHeaders -> CopyBackupToRegion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"BaldrApiService.CopyBackupToRegion" ::
Prelude.ByteString
),
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.ToJSON CopyBackupToRegion where
toJSON :: CopyBackupToRegion -> Value
toJSON CopyBackupToRegion' {Maybe [Tag]
Text
backupId :: Text
destinationRegion :: Text
tagList :: Maybe [Tag]
$sel:backupId:CopyBackupToRegion' :: CopyBackupToRegion -> Text
$sel:destinationRegion:CopyBackupToRegion' :: CopyBackupToRegion -> Text
$sel:tagList:CopyBackupToRegion' :: CopyBackupToRegion -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TagList" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tagList,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DestinationRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationRegion),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BackupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupId)
]
)
instance Core.ToPath CopyBackupToRegion where
toPath :: CopyBackupToRegion -> ByteString
toPath = ByteString -> CopyBackupToRegion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CopyBackupToRegion where
toQuery :: CopyBackupToRegion -> QueryString
toQuery = QueryString -> CopyBackupToRegion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CopyBackupToRegionResponse = CopyBackupToRegionResponse'
{
CopyBackupToRegionResponse -> Maybe DestinationBackup
destinationBackup :: Prelude.Maybe DestinationBackup,
CopyBackupToRegionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool
(CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool)
-> (CopyBackupToRegionResponse
-> CopyBackupToRegionResponse -> Bool)
-> Eq CopyBackupToRegionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool
$c/= :: CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool
== :: CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool
$c== :: CopyBackupToRegionResponse -> CopyBackupToRegionResponse -> Bool
Prelude.Eq, ReadPrec [CopyBackupToRegionResponse]
ReadPrec CopyBackupToRegionResponse
Int -> ReadS CopyBackupToRegionResponse
ReadS [CopyBackupToRegionResponse]
(Int -> ReadS CopyBackupToRegionResponse)
-> ReadS [CopyBackupToRegionResponse]
-> ReadPrec CopyBackupToRegionResponse
-> ReadPrec [CopyBackupToRegionResponse]
-> Read CopyBackupToRegionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyBackupToRegionResponse]
$creadListPrec :: ReadPrec [CopyBackupToRegionResponse]
readPrec :: ReadPrec CopyBackupToRegionResponse
$creadPrec :: ReadPrec CopyBackupToRegionResponse
readList :: ReadS [CopyBackupToRegionResponse]
$creadList :: ReadS [CopyBackupToRegionResponse]
readsPrec :: Int -> ReadS CopyBackupToRegionResponse
$creadsPrec :: Int -> ReadS CopyBackupToRegionResponse
Prelude.Read, Int -> CopyBackupToRegionResponse -> ShowS
[CopyBackupToRegionResponse] -> ShowS
CopyBackupToRegionResponse -> String
(Int -> CopyBackupToRegionResponse -> ShowS)
-> (CopyBackupToRegionResponse -> String)
-> ([CopyBackupToRegionResponse] -> ShowS)
-> Show CopyBackupToRegionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyBackupToRegionResponse] -> ShowS
$cshowList :: [CopyBackupToRegionResponse] -> ShowS
show :: CopyBackupToRegionResponse -> String
$cshow :: CopyBackupToRegionResponse -> String
showsPrec :: Int -> CopyBackupToRegionResponse -> ShowS
$cshowsPrec :: Int -> CopyBackupToRegionResponse -> ShowS
Prelude.Show, (forall x.
CopyBackupToRegionResponse -> Rep CopyBackupToRegionResponse x)
-> (forall x.
Rep CopyBackupToRegionResponse x -> CopyBackupToRegionResponse)
-> Generic CopyBackupToRegionResponse
forall x.
Rep CopyBackupToRegionResponse x -> CopyBackupToRegionResponse
forall x.
CopyBackupToRegionResponse -> Rep CopyBackupToRegionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CopyBackupToRegionResponse x -> CopyBackupToRegionResponse
$cfrom :: forall x.
CopyBackupToRegionResponse -> Rep CopyBackupToRegionResponse x
Prelude.Generic)
newCopyBackupToRegionResponse ::
Prelude.Int ->
CopyBackupToRegionResponse
newCopyBackupToRegionResponse :: Int -> CopyBackupToRegionResponse
newCopyBackupToRegionResponse Int
pHttpStatus_ =
CopyBackupToRegionResponse' :: Maybe DestinationBackup -> Int -> CopyBackupToRegionResponse
CopyBackupToRegionResponse'
{ $sel:destinationBackup:CopyBackupToRegionResponse' :: Maybe DestinationBackup
destinationBackup =
Maybe DestinationBackup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CopyBackupToRegionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
copyBackupToRegionResponse_destinationBackup :: Lens.Lens' CopyBackupToRegionResponse (Prelude.Maybe DestinationBackup)
copyBackupToRegionResponse_destinationBackup :: (Maybe DestinationBackup -> f (Maybe DestinationBackup))
-> CopyBackupToRegionResponse -> f CopyBackupToRegionResponse
copyBackupToRegionResponse_destinationBackup = (CopyBackupToRegionResponse -> Maybe DestinationBackup)
-> (CopyBackupToRegionResponse
-> Maybe DestinationBackup -> CopyBackupToRegionResponse)
-> Lens
CopyBackupToRegionResponse
CopyBackupToRegionResponse
(Maybe DestinationBackup)
(Maybe DestinationBackup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyBackupToRegionResponse' {Maybe DestinationBackup
destinationBackup :: Maybe DestinationBackup
$sel:destinationBackup:CopyBackupToRegionResponse' :: CopyBackupToRegionResponse -> Maybe DestinationBackup
destinationBackup} -> Maybe DestinationBackup
destinationBackup) (\s :: CopyBackupToRegionResponse
s@CopyBackupToRegionResponse' {} Maybe DestinationBackup
a -> CopyBackupToRegionResponse
s {$sel:destinationBackup:CopyBackupToRegionResponse' :: Maybe DestinationBackup
destinationBackup = Maybe DestinationBackup
a} :: CopyBackupToRegionResponse)
copyBackupToRegionResponse_httpStatus :: Lens.Lens' CopyBackupToRegionResponse Prelude.Int
copyBackupToRegionResponse_httpStatus :: (Int -> f Int)
-> CopyBackupToRegionResponse -> f CopyBackupToRegionResponse
copyBackupToRegionResponse_httpStatus = (CopyBackupToRegionResponse -> Int)
-> (CopyBackupToRegionResponse
-> Int -> CopyBackupToRegionResponse)
-> Lens
CopyBackupToRegionResponse CopyBackupToRegionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyBackupToRegionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CopyBackupToRegionResponse' :: CopyBackupToRegionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CopyBackupToRegionResponse
s@CopyBackupToRegionResponse' {} Int
a -> CopyBackupToRegionResponse
s {$sel:httpStatus:CopyBackupToRegionResponse' :: Int
httpStatus = Int
a} :: CopyBackupToRegionResponse)
instance Prelude.NFData CopyBackupToRegionResponse