{-# 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.ModifyCluster
(
ModifyCluster (..),
newModifyCluster,
modifyCluster_backupRetentionPolicy,
modifyCluster_clusterId,
ModifyClusterResponse (..),
newModifyClusterResponse,
modifyClusterResponse_cluster,
modifyClusterResponse_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 ModifyCluster = ModifyCluster'
{
ModifyCluster -> BackupRetentionPolicy
backupRetentionPolicy :: BackupRetentionPolicy,
ModifyCluster -> Text
clusterId :: Prelude.Text
}
deriving (ModifyCluster -> ModifyCluster -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyCluster -> ModifyCluster -> Bool
$c/= :: ModifyCluster -> ModifyCluster -> Bool
== :: ModifyCluster -> ModifyCluster -> Bool
$c== :: ModifyCluster -> ModifyCluster -> Bool
Prelude.Eq, ReadPrec [ModifyCluster]
ReadPrec ModifyCluster
Int -> ReadS ModifyCluster
ReadS [ModifyCluster]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyCluster]
$creadListPrec :: ReadPrec [ModifyCluster]
readPrec :: ReadPrec ModifyCluster
$creadPrec :: ReadPrec ModifyCluster
readList :: ReadS [ModifyCluster]
$creadList :: ReadS [ModifyCluster]
readsPrec :: Int -> ReadS ModifyCluster
$creadsPrec :: Int -> ReadS ModifyCluster
Prelude.Read, Int -> ModifyCluster -> ShowS
[ModifyCluster] -> ShowS
ModifyCluster -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyCluster] -> ShowS
$cshowList :: [ModifyCluster] -> ShowS
show :: ModifyCluster -> String
$cshow :: ModifyCluster -> String
showsPrec :: Int -> ModifyCluster -> ShowS
$cshowsPrec :: Int -> ModifyCluster -> ShowS
Prelude.Show, forall x. Rep ModifyCluster x -> ModifyCluster
forall x. ModifyCluster -> Rep ModifyCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyCluster x -> ModifyCluster
$cfrom :: forall x. ModifyCluster -> Rep ModifyCluster x
Prelude.Generic)
newModifyCluster ::
BackupRetentionPolicy ->
Prelude.Text ->
ModifyCluster
newModifyCluster :: BackupRetentionPolicy -> Text -> ModifyCluster
newModifyCluster BackupRetentionPolicy
pBackupRetentionPolicy_ Text
pClusterId_ =
ModifyCluster'
{ $sel:backupRetentionPolicy:ModifyCluster' :: BackupRetentionPolicy
backupRetentionPolicy =
BackupRetentionPolicy
pBackupRetentionPolicy_,
$sel:clusterId:ModifyCluster' :: Text
clusterId = Text
pClusterId_
}
modifyCluster_backupRetentionPolicy :: Lens.Lens' ModifyCluster BackupRetentionPolicy
modifyCluster_backupRetentionPolicy :: Lens' ModifyCluster BackupRetentionPolicy
modifyCluster_backupRetentionPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCluster' {BackupRetentionPolicy
backupRetentionPolicy :: BackupRetentionPolicy
$sel:backupRetentionPolicy:ModifyCluster' :: ModifyCluster -> BackupRetentionPolicy
backupRetentionPolicy} -> BackupRetentionPolicy
backupRetentionPolicy) (\s :: ModifyCluster
s@ModifyCluster' {} BackupRetentionPolicy
a -> ModifyCluster
s {$sel:backupRetentionPolicy:ModifyCluster' :: BackupRetentionPolicy
backupRetentionPolicy = BackupRetentionPolicy
a} :: ModifyCluster)
modifyCluster_clusterId :: Lens.Lens' ModifyCluster Prelude.Text
modifyCluster_clusterId :: Lens' ModifyCluster Text
modifyCluster_clusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCluster' {Text
clusterId :: Text
$sel:clusterId:ModifyCluster' :: ModifyCluster -> Text
clusterId} -> Text
clusterId) (\s :: ModifyCluster
s@ModifyCluster' {} Text
a -> ModifyCluster
s {$sel:clusterId:ModifyCluster' :: Text
clusterId = Text
a} :: ModifyCluster)
instance Core.AWSRequest ModifyCluster where
type
AWSResponse ModifyCluster =
ModifyClusterResponse
request :: (Service -> Service) -> ModifyCluster -> Request ModifyCluster
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 ModifyCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyCluster)))
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 Cluster -> Int -> ModifyClusterResponse
ModifyClusterResponse'
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
"Cluster")
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 ModifyCluster where
hashWithSalt :: Int -> ModifyCluster -> Int
hashWithSalt Int
_salt ModifyCluster' {Text
BackupRetentionPolicy
clusterId :: Text
backupRetentionPolicy :: BackupRetentionPolicy
$sel:clusterId:ModifyCluster' :: ModifyCluster -> Text
$sel:backupRetentionPolicy:ModifyCluster' :: ModifyCluster -> BackupRetentionPolicy
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BackupRetentionPolicy
backupRetentionPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterId
instance Prelude.NFData ModifyCluster where
rnf :: ModifyCluster -> ()
rnf ModifyCluster' {Text
BackupRetentionPolicy
clusterId :: Text
backupRetentionPolicy :: BackupRetentionPolicy
$sel:clusterId:ModifyCluster' :: ModifyCluster -> Text
$sel:backupRetentionPolicy:ModifyCluster' :: ModifyCluster -> BackupRetentionPolicy
..} =
forall a. NFData a => a -> ()
Prelude.rnf BackupRetentionPolicy
backupRetentionPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clusterId
instance Data.ToHeaders ModifyCluster where
toHeaders :: ModifyCluster -> 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.ModifyCluster" ::
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 ModifyCluster where
toJSON :: ModifyCluster -> Value
toJSON ModifyCluster' {Text
BackupRetentionPolicy
clusterId :: Text
backupRetentionPolicy :: BackupRetentionPolicy
$sel:clusterId:ModifyCluster' :: ModifyCluster -> Text
$sel:backupRetentionPolicy:ModifyCluster' :: ModifyCluster -> BackupRetentionPolicy
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"BackupRetentionPolicy"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= BackupRetentionPolicy
backupRetentionPolicy
),
forall a. a -> Maybe a
Prelude.Just (Key
"ClusterId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clusterId)
]
)
instance Data.ToPath ModifyCluster where
toPath :: ModifyCluster -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ModifyCluster where
toQuery :: ModifyCluster -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ModifyClusterResponse = ModifyClusterResponse'
{ ModifyClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
ModifyClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ModifyClusterResponse -> ModifyClusterResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyClusterResponse -> ModifyClusterResponse -> Bool
$c/= :: ModifyClusterResponse -> ModifyClusterResponse -> Bool
== :: ModifyClusterResponse -> ModifyClusterResponse -> Bool
$c== :: ModifyClusterResponse -> ModifyClusterResponse -> Bool
Prelude.Eq, ReadPrec [ModifyClusterResponse]
ReadPrec ModifyClusterResponse
Int -> ReadS ModifyClusterResponse
ReadS [ModifyClusterResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyClusterResponse]
$creadListPrec :: ReadPrec [ModifyClusterResponse]
readPrec :: ReadPrec ModifyClusterResponse
$creadPrec :: ReadPrec ModifyClusterResponse
readList :: ReadS [ModifyClusterResponse]
$creadList :: ReadS [ModifyClusterResponse]
readsPrec :: Int -> ReadS ModifyClusterResponse
$creadsPrec :: Int -> ReadS ModifyClusterResponse
Prelude.Read, Int -> ModifyClusterResponse -> ShowS
[ModifyClusterResponse] -> ShowS
ModifyClusterResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyClusterResponse] -> ShowS
$cshowList :: [ModifyClusterResponse] -> ShowS
show :: ModifyClusterResponse -> String
$cshow :: ModifyClusterResponse -> String
showsPrec :: Int -> ModifyClusterResponse -> ShowS
$cshowsPrec :: Int -> ModifyClusterResponse -> ShowS
Prelude.Show, forall x. Rep ModifyClusterResponse x -> ModifyClusterResponse
forall x. ModifyClusterResponse -> Rep ModifyClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyClusterResponse x -> ModifyClusterResponse
$cfrom :: forall x. ModifyClusterResponse -> Rep ModifyClusterResponse x
Prelude.Generic)
newModifyClusterResponse ::
Prelude.Int ->
ModifyClusterResponse
newModifyClusterResponse :: Int -> ModifyClusterResponse
newModifyClusterResponse Int
pHttpStatus_ =
ModifyClusterResponse'
{ $sel:cluster:ModifyClusterResponse' :: Maybe Cluster
cluster = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ModifyClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
modifyClusterResponse_cluster :: Lens.Lens' ModifyClusterResponse (Prelude.Maybe Cluster)
modifyClusterResponse_cluster :: Lens' ModifyClusterResponse (Maybe Cluster)
modifyClusterResponse_cluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:ModifyClusterResponse' :: ModifyClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: ModifyClusterResponse
s@ModifyClusterResponse' {} Maybe Cluster
a -> ModifyClusterResponse
s {$sel:cluster:ModifyClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: ModifyClusterResponse)
modifyClusterResponse_httpStatus :: Lens.Lens' ModifyClusterResponse Prelude.Int
modifyClusterResponse_httpStatus :: Lens' ModifyClusterResponse Int
modifyClusterResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyClusterResponse' :: ModifyClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyClusterResponse
s@ModifyClusterResponse' {} Int
a -> ModifyClusterResponse
s {$sel:httpStatus:ModifyClusterResponse' :: Int
httpStatus = Int
a} :: ModifyClusterResponse)
instance Prelude.NFData ModifyClusterResponse where
rnf :: ModifyClusterResponse -> ()
rnf ModifyClusterResponse' {Int
Maybe Cluster
httpStatus :: Int
cluster :: Maybe Cluster
$sel:httpStatus:ModifyClusterResponse' :: ModifyClusterResponse -> Int
$sel:cluster:ModifyClusterResponse' :: ModifyClusterResponse -> Maybe Cluster
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Cluster
cluster
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus