{-# 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.RedshiftServerLess.UpdateSnapshot
(
UpdateSnapshot (..),
newUpdateSnapshot,
updateSnapshot_retentionPeriod,
updateSnapshot_snapshotName,
UpdateSnapshotResponse (..),
newUpdateSnapshotResponse,
updateSnapshotResponse_snapshot,
updateSnapshotResponse_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.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateSnapshot = UpdateSnapshot'
{
UpdateSnapshot -> Maybe Int
retentionPeriod :: Prelude.Maybe Prelude.Int,
UpdateSnapshot -> Text
snapshotName :: Prelude.Text
}
deriving (UpdateSnapshot -> UpdateSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSnapshot -> UpdateSnapshot -> Bool
$c/= :: UpdateSnapshot -> UpdateSnapshot -> Bool
== :: UpdateSnapshot -> UpdateSnapshot -> Bool
$c== :: UpdateSnapshot -> UpdateSnapshot -> Bool
Prelude.Eq, ReadPrec [UpdateSnapshot]
ReadPrec UpdateSnapshot
Int -> ReadS UpdateSnapshot
ReadS [UpdateSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSnapshot]
$creadListPrec :: ReadPrec [UpdateSnapshot]
readPrec :: ReadPrec UpdateSnapshot
$creadPrec :: ReadPrec UpdateSnapshot
readList :: ReadS [UpdateSnapshot]
$creadList :: ReadS [UpdateSnapshot]
readsPrec :: Int -> ReadS UpdateSnapshot
$creadsPrec :: Int -> ReadS UpdateSnapshot
Prelude.Read, Int -> UpdateSnapshot -> ShowS
[UpdateSnapshot] -> ShowS
UpdateSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSnapshot] -> ShowS
$cshowList :: [UpdateSnapshot] -> ShowS
show :: UpdateSnapshot -> String
$cshow :: UpdateSnapshot -> String
showsPrec :: Int -> UpdateSnapshot -> ShowS
$cshowsPrec :: Int -> UpdateSnapshot -> ShowS
Prelude.Show, forall x. Rep UpdateSnapshot x -> UpdateSnapshot
forall x. UpdateSnapshot -> Rep UpdateSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSnapshot x -> UpdateSnapshot
$cfrom :: forall x. UpdateSnapshot -> Rep UpdateSnapshot x
Prelude.Generic)
newUpdateSnapshot ::
Prelude.Text ->
UpdateSnapshot
newUpdateSnapshot :: Text -> UpdateSnapshot
newUpdateSnapshot Text
pSnapshotName_ =
UpdateSnapshot'
{ $sel:retentionPeriod:UpdateSnapshot' :: Maybe Int
retentionPeriod = forall a. Maybe a
Prelude.Nothing,
$sel:snapshotName:UpdateSnapshot' :: Text
snapshotName = Text
pSnapshotName_
}
updateSnapshot_retentionPeriod :: Lens.Lens' UpdateSnapshot (Prelude.Maybe Prelude.Int)
updateSnapshot_retentionPeriod :: Lens' UpdateSnapshot (Maybe Int)
updateSnapshot_retentionPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshot' {Maybe Int
retentionPeriod :: Maybe Int
$sel:retentionPeriod:UpdateSnapshot' :: UpdateSnapshot -> Maybe Int
retentionPeriod} -> Maybe Int
retentionPeriod) (\s :: UpdateSnapshot
s@UpdateSnapshot' {} Maybe Int
a -> UpdateSnapshot
s {$sel:retentionPeriod:UpdateSnapshot' :: Maybe Int
retentionPeriod = Maybe Int
a} :: UpdateSnapshot)
updateSnapshot_snapshotName :: Lens.Lens' UpdateSnapshot Prelude.Text
updateSnapshot_snapshotName :: Lens' UpdateSnapshot Text
updateSnapshot_snapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshot' {Text
snapshotName :: Text
$sel:snapshotName:UpdateSnapshot' :: UpdateSnapshot -> Text
snapshotName} -> Text
snapshotName) (\s :: UpdateSnapshot
s@UpdateSnapshot' {} Text
a -> UpdateSnapshot
s {$sel:snapshotName:UpdateSnapshot' :: Text
snapshotName = Text
a} :: UpdateSnapshot)
instance Core.AWSRequest UpdateSnapshot where
type
AWSResponse UpdateSnapshot =
UpdateSnapshotResponse
request :: (Service -> Service) -> UpdateSnapshot -> Request UpdateSnapshot
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSnapshot)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Snapshot -> Int -> UpdateSnapshotResponse
UpdateSnapshotResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"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 UpdateSnapshot where
hashWithSalt :: Int -> UpdateSnapshot -> Int
hashWithSalt Int
_salt UpdateSnapshot' {Maybe Int
Text
snapshotName :: Text
retentionPeriod :: Maybe Int
$sel:snapshotName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:retentionPeriod:UpdateSnapshot' :: UpdateSnapshot -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
retentionPeriod
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotName
instance Prelude.NFData UpdateSnapshot where
rnf :: UpdateSnapshot -> ()
rnf UpdateSnapshot' {Maybe Int
Text
snapshotName :: Text
retentionPeriod :: Maybe Int
$sel:snapshotName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:retentionPeriod:UpdateSnapshot' :: UpdateSnapshot -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
retentionPeriod
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotName
instance Data.ToHeaders UpdateSnapshot where
toHeaders :: UpdateSnapshot -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RedshiftServerless.UpdateSnapshot" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateSnapshot where
toJSON :: UpdateSnapshot -> Value
toJSON UpdateSnapshot' {Maybe Int
Text
snapshotName :: Text
retentionPeriod :: Maybe Int
$sel:snapshotName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:retentionPeriod:UpdateSnapshot' :: UpdateSnapshot -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"retentionPeriod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
retentionPeriod,
forall a. a -> Maybe a
Prelude.Just (Key
"snapshotName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
snapshotName)
]
)
instance Data.ToPath UpdateSnapshot where
toPath :: UpdateSnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateSnapshot where
toQuery :: UpdateSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateSnapshotResponse = UpdateSnapshotResponse'
{
UpdateSnapshotResponse -> Maybe Snapshot
snapshot :: Prelude.Maybe Snapshot,
UpdateSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
$c/= :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
== :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
$c== :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSnapshotResponse]
ReadPrec UpdateSnapshotResponse
Int -> ReadS UpdateSnapshotResponse
ReadS [UpdateSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSnapshotResponse]
$creadListPrec :: ReadPrec [UpdateSnapshotResponse]
readPrec :: ReadPrec UpdateSnapshotResponse
$creadPrec :: ReadPrec UpdateSnapshotResponse
readList :: ReadS [UpdateSnapshotResponse]
$creadList :: ReadS [UpdateSnapshotResponse]
readsPrec :: Int -> ReadS UpdateSnapshotResponse
$creadsPrec :: Int -> ReadS UpdateSnapshotResponse
Prelude.Read, Int -> UpdateSnapshotResponse -> ShowS
[UpdateSnapshotResponse] -> ShowS
UpdateSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSnapshotResponse] -> ShowS
$cshowList :: [UpdateSnapshotResponse] -> ShowS
show :: UpdateSnapshotResponse -> String
$cshow :: UpdateSnapshotResponse -> String
showsPrec :: Int -> UpdateSnapshotResponse -> ShowS
$cshowsPrec :: Int -> UpdateSnapshotResponse -> ShowS
Prelude.Show, forall x. Rep UpdateSnapshotResponse x -> UpdateSnapshotResponse
forall x. UpdateSnapshotResponse -> Rep UpdateSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSnapshotResponse x -> UpdateSnapshotResponse
$cfrom :: forall x. UpdateSnapshotResponse -> Rep UpdateSnapshotResponse x
Prelude.Generic)
newUpdateSnapshotResponse ::
Prelude.Int ->
UpdateSnapshotResponse
newUpdateSnapshotResponse :: Int -> UpdateSnapshotResponse
newUpdateSnapshotResponse Int
pHttpStatus_ =
UpdateSnapshotResponse'
{ $sel:snapshot:UpdateSnapshotResponse' :: Maybe Snapshot
snapshot = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSnapshotResponse_snapshot :: Lens.Lens' UpdateSnapshotResponse (Prelude.Maybe Snapshot)
updateSnapshotResponse_snapshot :: Lens' UpdateSnapshotResponse (Maybe Snapshot)
updateSnapshotResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshotResponse' {Maybe Snapshot
snapshot :: Maybe Snapshot
$sel:snapshot:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Maybe Snapshot
snapshot} -> Maybe Snapshot
snapshot) (\s :: UpdateSnapshotResponse
s@UpdateSnapshotResponse' {} Maybe Snapshot
a -> UpdateSnapshotResponse
s {$sel:snapshot:UpdateSnapshotResponse' :: Maybe Snapshot
snapshot = Maybe Snapshot
a} :: UpdateSnapshotResponse)
updateSnapshotResponse_httpStatus :: Lens.Lens' UpdateSnapshotResponse Prelude.Int
updateSnapshotResponse_httpStatus :: Lens' UpdateSnapshotResponse Int
updateSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSnapshotResponse
s@UpdateSnapshotResponse' {} Int
a -> UpdateSnapshotResponse
s {$sel:httpStatus:UpdateSnapshotResponse' :: Int
httpStatus = Int
a} :: UpdateSnapshotResponse)
instance Prelude.NFData UpdateSnapshotResponse where
rnf :: UpdateSnapshotResponse -> ()
rnf UpdateSnapshotResponse' {Int
Maybe Snapshot
httpStatus :: Int
snapshot :: Maybe Snapshot
$sel:httpStatus:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Int
$sel:snapshot:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> 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