{-# 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_snapshotClusterIdentifier,
authorizeSnapshotAccess_snapshotIdentifier,
authorizeSnapshotAccess_accountWithRestoreAccess,
AuthorizeSnapshotAccessResponse (..),
newAuthorizeSnapshotAccessResponse,
authorizeSnapshotAccessResponse_snapshot,
authorizeSnapshotAccessResponse_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 AuthorizeSnapshotAccess = AuthorizeSnapshotAccess'
{
AuthorizeSnapshotAccess -> Maybe Text
snapshotClusterIdentifier :: Prelude.Maybe Prelude.Text,
AuthorizeSnapshotAccess -> Text
snapshotIdentifier :: Prelude.Text,
AuthorizeSnapshotAccess -> Text
accountWithRestoreAccess :: Prelude.Text
}
deriving (AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool
(AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool)
-> (AuthorizeSnapshotAccess -> AuthorizeSnapshotAccess -> Bool)
-> Eq AuthorizeSnapshotAccess
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]
(Int -> ReadS AuthorizeSnapshotAccess)
-> ReadS [AuthorizeSnapshotAccess]
-> ReadPrec AuthorizeSnapshotAccess
-> ReadPrec [AuthorizeSnapshotAccess]
-> Read 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
(Int -> AuthorizeSnapshotAccess -> ShowS)
-> (AuthorizeSnapshotAccess -> String)
-> ([AuthorizeSnapshotAccess] -> ShowS)
-> Show AuthorizeSnapshotAccess
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.
AuthorizeSnapshotAccess -> Rep AuthorizeSnapshotAccess x)
-> (forall x.
Rep AuthorizeSnapshotAccess x -> AuthorizeSnapshotAccess)
-> Generic AuthorizeSnapshotAccess
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 ->
Prelude.Text ->
AuthorizeSnapshotAccess
newAuthorizeSnapshotAccess :: Text -> Text -> AuthorizeSnapshotAccess
newAuthorizeSnapshotAccess
Text
pSnapshotIdentifier_
Text
pAccountWithRestoreAccess_ =
AuthorizeSnapshotAccess' :: Maybe Text -> Text -> Text -> AuthorizeSnapshotAccess
AuthorizeSnapshotAccess'
{ $sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: Maybe Text
snapshotClusterIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: Text
snapshotIdentifier = Text
pSnapshotIdentifier_,
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: Text
accountWithRestoreAccess =
Text
pAccountWithRestoreAccess_
}
authorizeSnapshotAccess_snapshotClusterIdentifier :: Lens.Lens' AuthorizeSnapshotAccess (Prelude.Maybe Prelude.Text)
authorizeSnapshotAccess_snapshotClusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> AuthorizeSnapshotAccess -> f AuthorizeSnapshotAccess
authorizeSnapshotAccess_snapshotClusterIdentifier = (AuthorizeSnapshotAccess -> Maybe Text)
-> (AuthorizeSnapshotAccess
-> Maybe Text -> AuthorizeSnapshotAccess)
-> Lens
AuthorizeSnapshotAccess
AuthorizeSnapshotAccess
(Maybe Text)
(Maybe Text)
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.Text
authorizeSnapshotAccess_snapshotIdentifier :: (Text -> f Text)
-> AuthorizeSnapshotAccess -> f AuthorizeSnapshotAccess
authorizeSnapshotAccess_snapshotIdentifier = (AuthorizeSnapshotAccess -> Text)
-> (AuthorizeSnapshotAccess -> Text -> AuthorizeSnapshotAccess)
-> Lens AuthorizeSnapshotAccess AuthorizeSnapshotAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeSnapshotAccess' {Text
snapshotIdentifier :: Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
snapshotIdentifier} -> Text
snapshotIdentifier) (\s :: AuthorizeSnapshotAccess
s@AuthorizeSnapshotAccess' {} Text
a -> AuthorizeSnapshotAccess
s {$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: Text
snapshotIdentifier = Text
a} :: AuthorizeSnapshotAccess)
authorizeSnapshotAccess_accountWithRestoreAccess :: Lens.Lens' AuthorizeSnapshotAccess Prelude.Text
authorizeSnapshotAccess_accountWithRestoreAccess :: (Text -> f Text)
-> AuthorizeSnapshotAccess -> f AuthorizeSnapshotAccess
authorizeSnapshotAccess_accountWithRestoreAccess = (AuthorizeSnapshotAccess -> Text)
-> (AuthorizeSnapshotAccess -> Text -> AuthorizeSnapshotAccess)
-> Lens AuthorizeSnapshotAccess AuthorizeSnapshotAccess Text Text
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 :: AuthorizeSnapshotAccess -> Request AuthorizeSnapshotAccess
request = Service
-> AuthorizeSnapshotAccess -> Request AuthorizeSnapshotAccess
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy AuthorizeSnapshotAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AuthorizeSnapshotAccess)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse AuthorizeSnapshotAccess))
-> Logger
-> Service
-> Proxy AuthorizeSnapshotAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AuthorizeSnapshotAccess)))
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
"AuthorizeSnapshotAccessResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Snapshot -> Int -> AuthorizeSnapshotAccessResponse
AuthorizeSnapshotAccessResponse'
(Maybe Snapshot -> Int -> AuthorizeSnapshotAccessResponse)
-> Either String (Maybe Snapshot)
-> Either String (Int -> AuthorizeSnapshotAccessResponse)
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 -> AuthorizeSnapshotAccessResponse)
-> Either String Int
-> Either String AuthorizeSnapshotAccessResponse
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 AuthorizeSnapshotAccess
instance Prelude.NFData AuthorizeSnapshotAccess
instance Core.ToHeaders AuthorizeSnapshotAccess where
toHeaders :: AuthorizeSnapshotAccess -> ResponseHeaders
toHeaders = ResponseHeaders -> AuthorizeSnapshotAccess -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath AuthorizeSnapshotAccess where
toPath :: AuthorizeSnapshotAccess -> ByteString
toPath = ByteString -> AuthorizeSnapshotAccess -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AuthorizeSnapshotAccess where
toQuery :: AuthorizeSnapshotAccess -> QueryString
toQuery AuthorizeSnapshotAccess' {Maybe Text
Text
accountWithRestoreAccess :: Text
snapshotIdentifier :: Text
snapshotClusterIdentifier :: Maybe Text
$sel:accountWithRestoreAccess:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
$sel:snapshotIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Text
$sel:snapshotClusterIdentifier:AuthorizeSnapshotAccess' :: AuthorizeSnapshotAccess -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"AuthorizeSnapshotAccess" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"SnapshotClusterIdentifier"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
snapshotClusterIdentifier,
ByteString
"SnapshotIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
snapshotIdentifier,
ByteString
"AccountWithRestoreAccess"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
accountWithRestoreAccess
]
data AuthorizeSnapshotAccessResponse = AuthorizeSnapshotAccessResponse'
{ AuthorizeSnapshotAccessResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
AuthorizeSnapshotAccessResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool
(AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool)
-> (AuthorizeSnapshotAccessResponse
-> AuthorizeSnapshotAccessResponse -> Bool)
-> Eq AuthorizeSnapshotAccessResponse
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]
(Int -> ReadS AuthorizeSnapshotAccessResponse)
-> ReadS [AuthorizeSnapshotAccessResponse]
-> ReadPrec AuthorizeSnapshotAccessResponse
-> ReadPrec [AuthorizeSnapshotAccessResponse]
-> Read 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
(Int -> AuthorizeSnapshotAccessResponse -> ShowS)
-> (AuthorizeSnapshotAccessResponse -> String)
-> ([AuthorizeSnapshotAccessResponse] -> ShowS)
-> Show AuthorizeSnapshotAccessResponse
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.
AuthorizeSnapshotAccessResponse
-> Rep AuthorizeSnapshotAccessResponse x)
-> (forall x.
Rep AuthorizeSnapshotAccessResponse x
-> AuthorizeSnapshotAccessResponse)
-> Generic AuthorizeSnapshotAccessResponse
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' :: Maybe Snapshot -> Int -> AuthorizeSnapshotAccessResponse
AuthorizeSnapshotAccessResponse'
{ $sel:snapshot:AuthorizeSnapshotAccessResponse' :: Maybe Snapshot
snapshot =
Maybe Snapshot
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AuthorizeSnapshotAccessResponse' :: Int
httpStatus = Int
pHttpStatus_
}
authorizeSnapshotAccessResponse_snapshot :: Lens.Lens' AuthorizeSnapshotAccessResponse (Prelude.Maybe Snapshot)
authorizeSnapshotAccessResponse_snapshot :: (Maybe Snapshot -> f (Maybe Snapshot))
-> AuthorizeSnapshotAccessResponse
-> f AuthorizeSnapshotAccessResponse
authorizeSnapshotAccessResponse_snapshot = (AuthorizeSnapshotAccessResponse -> Maybe Snapshot)
-> (AuthorizeSnapshotAccessResponse
-> Maybe Snapshot -> AuthorizeSnapshotAccessResponse)
-> Lens
AuthorizeSnapshotAccessResponse
AuthorizeSnapshotAccessResponse
(Maybe Snapshot)
(Maybe 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 :: (Int -> f Int)
-> AuthorizeSnapshotAccessResponse
-> f AuthorizeSnapshotAccessResponse
authorizeSnapshotAccessResponse_httpStatus = (AuthorizeSnapshotAccessResponse -> Int)
-> (AuthorizeSnapshotAccessResponse
-> Int -> AuthorizeSnapshotAccessResponse)
-> Lens
AuthorizeSnapshotAccessResponse
AuthorizeSnapshotAccessResponse
Int
Int
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