{-# 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.AuthorizeSnapshotAccess
(
AuthorizeSnapshotAccess (..),
newAuthorizeSnapshotAccess,
authorizeSnapshotAccess_snapshotArn,
authorizeSnapshotAccess_snapshotClusterIdentifier,
authorizeSnapshotAccess_snapshotIdentifier,
authorizeSnapshotAccess_accountWithRestoreAccess,
AuthorizeSnapshotAccessResponse (..),
newAuthorizeSnapshotAccessResponse,
authorizeSnapshotAccessResponse_snapshot,
authorizeSnapshotAccessResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AuthorizeSnapshotAccess = AuthorizeSnapshotAccess'
{
AuthorizeSnapshotAccess -> Maybe Text
snapshotArn :: Prelude.Maybe Prelude.Text,
AuthorizeSnapshotAccess -> Maybe Text
snapshotClusterIdentifier :: Prelude.Maybe Prelude.Text,
AuthorizeSnapshotAccess -> Maybe Text
snapshotIdentifier :: Prelude.Maybe Prelude.Text,
AuthorizeSnapshotAccess -> Text
accountWithRestoreAccess :: Prelude.Text
}
deriving (AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
$c/= :: AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
== :: AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
$c== :: AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
Prelude.Eq, ReadPrec [AuthorizeSnapshotAccess]
ReadPrec AuthorizeSnapshotAccess
Int -> ReadS AuthorizeSnapshotAccess
ReadS [AuthorizeSnapshotAccess]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthorizeSnapshotAccess]
$creadListPrec :: ReadPrec [AuthorizeSnapshotAccess]
readPrec :: ReadPrec AuthorizeSnapshotAccess
$creadPrec :: ReadPrec AuthorizeSnapshotAccess
readList :: ReadS [AuthorizeSnapshotAccess]
$creadList :: ReadS [AuthorizeSnapshotAccess]
readsPrec :: Int -> ReadS AuthorizeSnapshotAccess
$creadsPrec :: Int -> ReadS AuthorizeSnapshotAccess
Prelude.Read, Int -> AuthorizeSnapshotAccess -> ShowS
[AuthorizeSnapshotAccess] -> ShowS
AuthorizeSnapshotAccess -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthorizeSnapshotAccess] -> ShowS
$cshowList :: [AuthorizeSnapshotAccess] -> ShowS
show :: AuthorizeSnapshotAccess -> String
$cshow :: AuthorizeSnapshotAccess -> String
showsPrec :: Int -> AuthorizeSnapshotAccess -> ShowS
$cshowsPrec :: Int -> AuthorizeSnapshotAccess -> ShowS
Prelude.Show, forall x. Rep AuthorizeSnapshotAccess x -> AuthorizeSnapshotAccess
forall x. AuthorizeSnapshotAccess -> Rep AuthorizeSnapshotAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuthorizeSnapshotAccess x -> AuthorizeSnapshotAccess
$cfrom :: forall x. AuthorizeSnapshotAccess -> Rep AuthorizeSnapshotAccess x
Prelude.Generic)
newAuthorizeSnapshotAccess ::
Prelude.Text ->
AuthorizeSnapshotAccess
newAuthorizeSnapshotAccess :: Text -> AuthorizeSnapshotAccess
newAuthorizeSnapshotAccess Text
pAccountWithRestoreAccess_ =
AuthorizeSnapshotAccess'
{ $sel:snapshotArn:AuthorizeSnapshotAccess' :: Maybe Text
snapshotArn =
forall a. Maybe a
Prelude.Nothing,
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: Maybe Text
snapshotClusterIdentifier = forall a. Maybe a
Prelude.Nothing,
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: Maybe Text
snapshotIdentifier = forall a. Maybe a
Prelude.Nothing,
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: Text
accountWithRestoreAccess =
Text
pAccountWithRestoreAccess_
}
authorizeSnapshotAccess_snapshotArn :: Lens.Lens' AuthorizeSnapshotAccess (Prelude.Maybe Prelude.Text)
authorizeSnapshotAccess_snapshotArn :: Lens' AuthorizeSnapshotAccess (Maybe Text)
authorizeSnapshotAccess_snapshotArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccess' {Maybe Text
snapshotArn :: Maybe Text
$sel:snapshotArn:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
snapshotArn} -> Maybe Text
snapshotArn) (\s :: AuthorizeSnapshotAccess
s@AuthorizeSnapshotAccess' {} Maybe Text
a -> AuthorizeSnapshotAccess
s {$sel:snapshotArn:AuthorizeSnapshotAccess' :: Maybe Text
snapshotArn = Maybe Text
a} :: AuthorizeSnapshotAccess)
authorizeSnapshotAccess_snapshotClusterIdentifier :: Lens.Lens' AuthorizeSnapshotAccess (Prelude.Maybe Prelude.Text)
authorizeSnapshotAccess_snapshotClusterIdentifier :: Lens' AuthorizeSnapshotAccess (Maybe Text)
authorizeSnapshotAccess_snapshotClusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccess' {Maybe Text
snapshotClusterIdentifier :: Maybe Text
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
snapshotClusterIdentifier} -> Maybe Text
snapshotClusterIdentifier) (\s :: AuthorizeSnapshotAccess
s@AuthorizeSnapshotAccess' {} Maybe Text
a -> AuthorizeSnapshotAccess
s {$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: Maybe Text
snapshotClusterIdentifier = Maybe Text
a} :: AuthorizeSnapshotAccess)
authorizeSnapshotAccess_snapshotIdentifier :: Lens.Lens' AuthorizeSnapshotAccess (Prelude.Maybe Prelude.Text)
authorizeSnapshotAccess_snapshotIdentifier :: Lens' AuthorizeSnapshotAccess (Maybe Text)
authorizeSnapshotAccess_snapshotIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccess' {Maybe Text
snapshotIdentifier :: Maybe Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
snapshotIdentifier} -> Maybe Text
snapshotIdentifier) (\s :: AuthorizeSnapshotAccess
s@AuthorizeSnapshotAccess' {} Maybe Text
a -> AuthorizeSnapshotAccess
s {$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: Maybe Text
snapshotIdentifier = Maybe Text
a} :: AuthorizeSnapshotAccess)
authorizeSnapshotAccess_accountWithRestoreAccess :: Lens.Lens' AuthorizeSnapshotAccess Prelude.Text
authorizeSnapshotAccess_accountWithRestoreAccess :: Lens' AuthorizeSnapshotAccess Text
authorizeSnapshotAccess_accountWithRestoreAccess = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccess' {Text
accountWithRestoreAccess :: Text
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
accountWithRestoreAccess} -> Text
accountWithRestoreAccess) (\s :: AuthorizeSnapshotAccess
s@AuthorizeSnapshotAccess' {} Text
a -> AuthorizeSnapshotAccess
s {$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: Text
accountWithRestoreAccess = Text
a} :: AuthorizeSnapshotAccess)
instance Core.AWSRequest AuthorizeSnapshotAccess where
type
AWSResponse AuthorizeSnapshotAccess =
AuthorizeSnapshotAccessResponse
request :: (Service -> Service)
-> AuthorizeSnapshotAccess -> Request AuthorizeSnapshotAccess
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AuthorizeSnapshotAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AuthorizeSnapshotAccess)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"AuthorizeSnapshotAccessResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Snapshot -> Int -> AuthorizeSnapshotAccessResponse
AuthorizeSnapshotAccessResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Snapshot")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AuthorizeSnapshotAccess where
hashWithSalt :: Int -> AuthorizeSnapshotAccess -> Int
hashWithSalt Int
_salt AuthorizeSnapshotAccess' {Maybe Text
Text
accountWithRestoreAccess :: Text
snapshotIdentifier :: Maybe Text
snapshotClusterIdentifier :: Maybe Text
snapshotArn :: Maybe Text
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotArn:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotClusterIdentifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotIdentifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountWithRestoreAccess
instance Prelude.NFData AuthorizeSnapshotAccess where
rnf :: AuthorizeSnapshotAccess -> ()
rnf AuthorizeSnapshotAccess' {Maybe Text
Text
accountWithRestoreAccess :: Text
snapshotIdentifier :: Maybe Text
snapshotClusterIdentifier :: Maybe Text
snapshotArn :: Maybe Text
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotArn:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotClusterIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
accountWithRestoreAccess
instance Data.ToHeaders AuthorizeSnapshotAccess where
toHeaders :: AuthorizeSnapshotAccess -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath AuthorizeSnapshotAccess where
toPath :: AuthorizeSnapshotAccess -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AuthorizeSnapshotAccess where
toQuery :: AuthorizeSnapshotAccess -> QueryString
toQuery AuthorizeSnapshotAccess' {Maybe Text
Text
accountWithRestoreAccess :: Text
snapshotIdentifier :: Maybe Text
snapshotClusterIdentifier :: Maybe Text
snapshotArn :: Maybe Text
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
$sel:snapshotArn:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"AuthorizeSnapshotAccess" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"SnapshotArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotArn,
ByteString
"SnapshotClusterIdentifier"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotClusterIdentifier,
ByteString
"SnapshotIdentifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotIdentifier,
ByteString
"AccountWithRestoreAccess"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
accountWithRestoreAccess
]
data AuthorizeSnapshotAccessResponse = AuthorizeSnapshotAccessResponse'
{ AuthorizeSnapshotAccessResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
AuthorizeSnapshotAccessResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
$c/= :: AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
== :: AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
$c== :: AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
Prelude.Eq, ReadPrec [AuthorizeSnapshotAccessResponse]
ReadPrec AuthorizeSnapshotAccessResponse
Int -> ReadS AuthorizeSnapshotAccessResponse
ReadS [AuthorizeSnapshotAccessResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthorizeSnapshotAccessResponse]
$creadListPrec :: ReadPrec [AuthorizeSnapshotAccessResponse]
readPrec :: ReadPrec AuthorizeSnapshotAccessResponse
$creadPrec :: ReadPrec AuthorizeSnapshotAccessResponse
readList :: ReadS [AuthorizeSnapshotAccessResponse]
$creadList :: ReadS [AuthorizeSnapshotAccessResponse]
readsPrec :: Int -> ReadS AuthorizeSnapshotAccessResponse
$creadsPrec :: Int -> ReadS AuthorizeSnapshotAccessResponse
Prelude.Read, Int -> AuthorizeSnapshotAccessResponse -> ShowS
[AuthorizeSnapshotAccessResponse] -> ShowS
AuthorizeSnapshotAccessResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthorizeSnapshotAccessResponse] -> ShowS
$cshowList :: [AuthorizeSnapshotAccessResponse] -> ShowS
show :: AuthorizeSnapshotAccessResponse -> String
$cshow :: AuthorizeSnapshotAccessResponse -> String
showsPrec :: Int -> AuthorizeSnapshotAccessResponse -> ShowS
$cshowsPrec :: Int -> AuthorizeSnapshotAccessResponse -> ShowS
Prelude.Show, forall x.
Rep AuthorizeSnapshotAccessResponse x
-> AuthorizeSnapshotAccessResponse
forall x.
AuthorizeSnapshotAccessResponse
-> Rep AuthorizeSnapshotAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AuthorizeSnapshotAccessResponse x
-> AuthorizeSnapshotAccessResponse
$cfrom :: forall x.
AuthorizeSnapshotAccessResponse
-> Rep AuthorizeSnapshotAccessResponse x
Prelude.Generic)
newAuthorizeSnapshotAccessResponse ::
Prelude.Int ->
AuthorizeSnapshotAccessResponse
newAuthorizeSnapshotAccessResponse :: Int -> AuthorizeSnapshotAccessResponse
newAuthorizeSnapshotAccessResponse Int
pHttpStatus_ =
AuthorizeSnapshotAccessResponse'
{ $sel:snapshot:AuthorizeSnapshotAccessResponse' :: Maybe Snapshot
snapshot =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AuthorizeSnapshotAccessResponse' :: Int
httpStatus = Int
pHttpStatus_
}
authorizeSnapshotAccessResponse_snapshot :: Lens.Lens' AuthorizeSnapshotAccessResponse (Prelude.Maybe Snapshot)
authorizeSnapshotAccessResponse_snapshot :: Lens' AuthorizeSnapshotAccessResponse (Maybe Snapshot)
authorizeSnapshotAccessResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccessResponse' {Maybe Snapshot
snapshot :: Maybe Snapshot
$sel:snapshot:AuthorizeSnapshotAccessResponse' :: AuthorizeSnapshotAccessResponse -> Maybe Snapshot
snapshot} -> Maybe Snapshot
snapshot) (\s :: AuthorizeSnapshotAccessResponse
s@AuthorizeSnapshotAccessResponse' {} Maybe Snapshot
a -> AuthorizeSnapshotAccessResponse
s {$sel:snapshot:AuthorizeSnapshotAccessResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
a} :: AuthorizeSnapshotAccessResponse)
authorizeSnapshotAccessResponse_httpStatus :: Lens.Lens' AuthorizeSnapshotAccessResponse Prelude.Int
authorizeSnapshotAccessResponse_httpStatus :: Lens' AuthorizeSnapshotAccessResponse Int
authorizeSnapshotAccessResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccessResponse' {Int
httpStatus :: Int
$sel:httpStatus:AuthorizeSnapshotAccessResponse' :: AuthorizeSnapshotAccessResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AuthorizeSnapshotAccessResponse
s@AuthorizeSnapshotAccessResponse' {} Int
a -> AuthorizeSnapshotAccessResponse
s {$sel:httpStatus:AuthorizeSnapshotAccessResponse' :: Int
httpStatus = Int
a} :: AuthorizeSnapshotAccessResponse)
instance
Prelude.NFData
AuthorizeSnapshotAccessResponse
where
rnf :: AuthorizeSnapshotAccessResponse -> ()
rnf AuthorizeSnapshotAccessResponse' {Int
Maybe Snapshot
httpStatus :: Int
snapshot :: Maybe Snapshot
$sel:httpStatus:AuthorizeSnapshotAccessResponse' :: AuthorizeSnapshotAccessResponse -> Int
$sel:snapshot:AuthorizeSnapshotAccessResponse' :: AuthorizeSnapshotAccessResponse -> Maybe Snapshot
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Snapshot
snapshot
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus