{-# 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.ModifyBackupAttributes
(
ModifyBackupAttributes (..),
newModifyBackupAttributes,
modifyBackupAttributes_backupId,
modifyBackupAttributes_neverExpires,
ModifyBackupAttributesResponse (..),
newModifyBackupAttributesResponse,
modifyBackupAttributesResponse_backup,
modifyBackupAttributesResponse_httpStatus,
)
where
import Amazonka.CloudHSMV2.Types
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ModifyBackupAttributes = ModifyBackupAttributes'
{
ModifyBackupAttributes -> Text
backupId :: Prelude.Text,
ModifyBackupAttributes -> Bool
neverExpires :: Prelude.Bool
}
deriving (ModifyBackupAttributes -> ModifyBackupAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyBackupAttributes -> ModifyBackupAttributes -> Bool
$c/= :: ModifyBackupAttributes -> ModifyBackupAttributes -> Bool
== :: ModifyBackupAttributes -> ModifyBackupAttributes -> Bool
$c== :: ModifyBackupAttributes -> ModifyBackupAttributes -> Bool
Prelude.Eq, ReadPrec [ModifyBackupAttributes]
ReadPrec ModifyBackupAttributes
Int -> ReadS ModifyBackupAttributes
ReadS [ModifyBackupAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyBackupAttributes]
$creadListPrec :: ReadPrec [ModifyBackupAttributes]
readPrec :: ReadPrec ModifyBackupAttributes
$creadPrec :: ReadPrec ModifyBackupAttributes
readList :: ReadS [ModifyBackupAttributes]
$creadList :: ReadS [ModifyBackupAttributes]
readsPrec :: Int -> ReadS ModifyBackupAttributes
$creadsPrec :: Int -> ReadS ModifyBackupAttributes
Prelude.Read, Int -> ModifyBackupAttributes -> ShowS
[ModifyBackupAttributes] -> ShowS
ModifyBackupAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyBackupAttributes] -> ShowS
$cshowList :: [ModifyBackupAttributes] -> ShowS
show :: ModifyBackupAttributes -> String
$cshow :: ModifyBackupAttributes -> String
showsPrec :: Int -> ModifyBackupAttributes -> ShowS
$cshowsPrec :: Int -> ModifyBackupAttributes -> ShowS
Prelude.Show, forall x. Rep ModifyBackupAttributes x -> ModifyBackupAttributes
forall x. ModifyBackupAttributes -> Rep ModifyBackupAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyBackupAttributes x -> ModifyBackupAttributes
$cfrom :: forall x. ModifyBackupAttributes -> Rep ModifyBackupAttributes x
Prelude.Generic)
newModifyBackupAttributes ::
Prelude.Text ->
Prelude.Bool ->
ModifyBackupAttributes
newModifyBackupAttributes :: Text -> Bool -> ModifyBackupAttributes
newModifyBackupAttributes Text
pBackupId_ Bool
pNeverExpires_ =
ModifyBackupAttributes'
{ $sel:backupId:ModifyBackupAttributes' :: Text
backupId = Text
pBackupId_,
$sel:neverExpires:ModifyBackupAttributes' :: Bool
neverExpires = Bool
pNeverExpires_
}
modifyBackupAttributes_backupId :: Lens.Lens' ModifyBackupAttributes Prelude.Text
modifyBackupAttributes_backupId :: Lens' ModifyBackupAttributes Text
modifyBackupAttributes_backupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyBackupAttributes' {Text
backupId :: Text
$sel:backupId:ModifyBackupAttributes' :: ModifyBackupAttributes -> Text
backupId} -> Text
backupId) (\s :: ModifyBackupAttributes
s@ModifyBackupAttributes' {} Text
a -> ModifyBackupAttributes
s {$sel:backupId:ModifyBackupAttributes' :: Text
backupId = Text
a} :: ModifyBackupAttributes)
modifyBackupAttributes_neverExpires :: Lens.Lens' ModifyBackupAttributes Prelude.Bool
modifyBackupAttributes_neverExpires :: Lens' ModifyBackupAttributes Bool
modifyBackupAttributes_neverExpires = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyBackupAttributes' {Bool
neverExpires :: Bool
$sel:neverExpires:ModifyBackupAttributes' :: ModifyBackupAttributes -> Bool
neverExpires} -> Bool
neverExpires) (\s :: ModifyBackupAttributes
s@ModifyBackupAttributes' {} Bool
a -> ModifyBackupAttributes
s {$sel:neverExpires:ModifyBackupAttributes' :: Bool
neverExpires = Bool
a} :: ModifyBackupAttributes)
instance Core.AWSRequest ModifyBackupAttributes where
type
AWSResponse ModifyBackupAttributes =
ModifyBackupAttributesResponse
request :: (Service -> Service)
-> ModifyBackupAttributes -> Request ModifyBackupAttributes
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 ModifyBackupAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ModifyBackupAttributes)))
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 Backup -> Int -> ModifyBackupAttributesResponse
ModifyBackupAttributesResponse'
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
"Backup")
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 ModifyBackupAttributes where
hashWithSalt :: Int -> ModifyBackupAttributes -> Int
hashWithSalt Int
_salt ModifyBackupAttributes' {Bool
Text
neverExpires :: Bool
backupId :: Text
$sel:neverExpires:ModifyBackupAttributes' :: ModifyBackupAttributes -> Bool
$sel:backupId:ModifyBackupAttributes' :: ModifyBackupAttributes -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
neverExpires
instance Prelude.NFData ModifyBackupAttributes where
rnf :: ModifyBackupAttributes -> ()
rnf ModifyBackupAttributes' {Bool
Text
neverExpires :: Bool
backupId :: Text
$sel:neverExpires:ModifyBackupAttributes' :: ModifyBackupAttributes -> Bool
$sel:backupId:ModifyBackupAttributes' :: ModifyBackupAttributes -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
backupId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
neverExpires
instance Data.ToHeaders ModifyBackupAttributes where
toHeaders :: ModifyBackupAttributes -> 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
"BaldrApiService.ModifyBackupAttributes" ::
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 ModifyBackupAttributes where
toJSON :: ModifyBackupAttributes -> Value
toJSON ModifyBackupAttributes' {Bool
Text
neverExpires :: Bool
backupId :: Text
$sel:neverExpires:ModifyBackupAttributes' :: ModifyBackupAttributes -> Bool
$sel:backupId:ModifyBackupAttributes' :: ModifyBackupAttributes -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"BackupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
backupId),
forall a. a -> Maybe a
Prelude.Just (Key
"NeverExpires" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
neverExpires)
]
)
instance Data.ToPath ModifyBackupAttributes where
toPath :: ModifyBackupAttributes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ModifyBackupAttributes where
toQuery :: ModifyBackupAttributes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ModifyBackupAttributesResponse = ModifyBackupAttributesResponse'
{ ModifyBackupAttributesResponse -> Maybe Backup
backup :: Prelude.Maybe Backup,
ModifyBackupAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ModifyBackupAttributesResponse
-> ModifyBackupAttributesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyBackupAttributesResponse
-> ModifyBackupAttributesResponse -> Bool
$c/= :: ModifyBackupAttributesResponse
-> ModifyBackupAttributesResponse -> Bool
== :: ModifyBackupAttributesResponse
-> ModifyBackupAttributesResponse -> Bool
$c== :: ModifyBackupAttributesResponse
-> ModifyBackupAttributesResponse -> Bool
Prelude.Eq, ReadPrec [ModifyBackupAttributesResponse]
ReadPrec ModifyBackupAttributesResponse
Int -> ReadS ModifyBackupAttributesResponse
ReadS [ModifyBackupAttributesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyBackupAttributesResponse]
$creadListPrec :: ReadPrec [ModifyBackupAttributesResponse]
readPrec :: ReadPrec ModifyBackupAttributesResponse
$creadPrec :: ReadPrec ModifyBackupAttributesResponse
readList :: ReadS [ModifyBackupAttributesResponse]
$creadList :: ReadS [ModifyBackupAttributesResponse]
readsPrec :: Int -> ReadS ModifyBackupAttributesResponse
$creadsPrec :: Int -> ReadS ModifyBackupAttributesResponse
Prelude.Read, Int -> ModifyBackupAttributesResponse -> ShowS
[ModifyBackupAttributesResponse] -> ShowS
ModifyBackupAttributesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyBackupAttributesResponse] -> ShowS
$cshowList :: [ModifyBackupAttributesResponse] -> ShowS
show :: ModifyBackupAttributesResponse -> String
$cshow :: ModifyBackupAttributesResponse -> String
showsPrec :: Int -> ModifyBackupAttributesResponse -> ShowS
$cshowsPrec :: Int -> ModifyBackupAttributesResponse -> ShowS
Prelude.Show, forall x.
Rep ModifyBackupAttributesResponse x
-> ModifyBackupAttributesResponse
forall x.
ModifyBackupAttributesResponse
-> Rep ModifyBackupAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyBackupAttributesResponse x
-> ModifyBackupAttributesResponse
$cfrom :: forall x.
ModifyBackupAttributesResponse
-> Rep ModifyBackupAttributesResponse x
Prelude.Generic)
newModifyBackupAttributesResponse ::
Prelude.Int ->
ModifyBackupAttributesResponse
newModifyBackupAttributesResponse :: Int -> ModifyBackupAttributesResponse
newModifyBackupAttributesResponse Int
pHttpStatus_ =
ModifyBackupAttributesResponse'
{ $sel:backup:ModifyBackupAttributesResponse' :: Maybe Backup
backup =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ModifyBackupAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
modifyBackupAttributesResponse_backup :: Lens.Lens' ModifyBackupAttributesResponse (Prelude.Maybe Backup)
modifyBackupAttributesResponse_backup :: Lens' ModifyBackupAttributesResponse (Maybe Backup)
modifyBackupAttributesResponse_backup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyBackupAttributesResponse' {Maybe Backup
backup :: Maybe Backup
$sel:backup:ModifyBackupAttributesResponse' :: ModifyBackupAttributesResponse -> Maybe Backup
backup} -> Maybe Backup
backup) (\s :: ModifyBackupAttributesResponse
s@ModifyBackupAttributesResponse' {} Maybe Backup
a -> ModifyBackupAttributesResponse
s {$sel:backup:ModifyBackupAttributesResponse' :: Maybe Backup
backup = Maybe Backup
a} :: ModifyBackupAttributesResponse)
modifyBackupAttributesResponse_httpStatus :: Lens.Lens' ModifyBackupAttributesResponse Prelude.Int
modifyBackupAttributesResponse_httpStatus :: Lens' ModifyBackupAttributesResponse Int
modifyBackupAttributesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyBackupAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyBackupAttributesResponse' :: ModifyBackupAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyBackupAttributesResponse
s@ModifyBackupAttributesResponse' {} Int
a -> ModifyBackupAttributesResponse
s {$sel:httpStatus:ModifyBackupAttributesResponse' :: Int
httpStatus = Int
a} :: ModifyBackupAttributesResponse)
instance
Prelude.NFData
ModifyBackupAttributesResponse
where
rnf :: ModifyBackupAttributesResponse -> ()
rnf ModifyBackupAttributesResponse' {Int
Maybe Backup
httpStatus :: Int
backup :: Maybe Backup
$sel:httpStatus:ModifyBackupAttributesResponse' :: ModifyBackupAttributesResponse -> Int
$sel:backup:ModifyBackupAttributesResponse' :: ModifyBackupAttributesResponse -> Maybe Backup
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Backup
backup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus