{-# 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.CreateCluster
(
CreateCluster (..),
newCreateCluster,
createCluster_backupRetentionPolicy,
createCluster_sourceBackupId,
createCluster_tagList,
createCluster_hsmType,
createCluster_subnetIds,
CreateClusterResponse (..),
newCreateClusterResponse,
createClusterResponse_cluster,
createClusterResponse_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 CreateCluster = CreateCluster'
{
CreateCluster -> Maybe BackupRetentionPolicy
backupRetentionPolicy :: Prelude.Maybe BackupRetentionPolicy,
CreateCluster -> Maybe Text
sourceBackupId :: Prelude.Maybe Prelude.Text,
CreateCluster -> Maybe [Tag]
tagList :: Prelude.Maybe [Tag],
CreateCluster -> Text
hsmType :: Prelude.Text,
CreateCluster -> NonEmpty Text
subnetIds :: Prelude.NonEmpty Prelude.Text
}
deriving (CreateCluster -> CreateCluster -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCluster -> CreateCluster -> Bool
$c/= :: CreateCluster -> CreateCluster -> Bool
== :: CreateCluster -> CreateCluster -> Bool
$c== :: CreateCluster -> CreateCluster -> Bool
Prelude.Eq, ReadPrec [CreateCluster]
ReadPrec CreateCluster
Int -> ReadS CreateCluster
ReadS [CreateCluster]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCluster]
$creadListPrec :: ReadPrec [CreateCluster]
readPrec :: ReadPrec CreateCluster
$creadPrec :: ReadPrec CreateCluster
readList :: ReadS [CreateCluster]
$creadList :: ReadS [CreateCluster]
readsPrec :: Int -> ReadS CreateCluster
$creadsPrec :: Int -> ReadS CreateCluster
Prelude.Read, Int -> CreateCluster -> ShowS
[CreateCluster] -> ShowS
CreateCluster -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCluster] -> ShowS
$cshowList :: [CreateCluster] -> ShowS
show :: CreateCluster -> String
$cshow :: CreateCluster -> String
showsPrec :: Int -> CreateCluster -> ShowS
$cshowsPrec :: Int -> CreateCluster -> ShowS
Prelude.Show, forall x. Rep CreateCluster x -> CreateCluster
forall x. CreateCluster -> Rep CreateCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCluster x -> CreateCluster
$cfrom :: forall x. CreateCluster -> Rep CreateCluster x
Prelude.Generic)
newCreateCluster ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
CreateCluster
newCreateCluster :: Text -> NonEmpty Text -> CreateCluster
newCreateCluster Text
pHsmType_ NonEmpty Text
pSubnetIds_ =
CreateCluster'
{ $sel:backupRetentionPolicy:CreateCluster' :: Maybe BackupRetentionPolicy
backupRetentionPolicy =
forall a. Maybe a
Prelude.Nothing,
$sel:sourceBackupId:CreateCluster' :: Maybe Text
sourceBackupId = forall a. Maybe a
Prelude.Nothing,
$sel:tagList:CreateCluster' :: Maybe [Tag]
tagList = forall a. Maybe a
Prelude.Nothing,
$sel:hsmType:CreateCluster' :: Text
hsmType = Text
pHsmType_,
$sel:subnetIds:CreateCluster' :: NonEmpty Text
subnetIds = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSubnetIds_
}
createCluster_backupRetentionPolicy :: Lens.Lens' CreateCluster (Prelude.Maybe BackupRetentionPolicy)
createCluster_backupRetentionPolicy :: Lens' CreateCluster (Maybe BackupRetentionPolicy)
createCluster_backupRetentionPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe BackupRetentionPolicy
backupRetentionPolicy :: Maybe BackupRetentionPolicy
$sel:backupRetentionPolicy:CreateCluster' :: CreateCluster -> Maybe BackupRetentionPolicy
backupRetentionPolicy} -> Maybe BackupRetentionPolicy
backupRetentionPolicy) (\s :: CreateCluster
s@CreateCluster' {} Maybe BackupRetentionPolicy
a -> CreateCluster
s {$sel:backupRetentionPolicy:CreateCluster' :: Maybe BackupRetentionPolicy
backupRetentionPolicy = Maybe BackupRetentionPolicy
a} :: CreateCluster)
createCluster_sourceBackupId :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_sourceBackupId :: Lens' CreateCluster (Maybe Text)
createCluster_sourceBackupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
sourceBackupId :: Maybe Text
$sel:sourceBackupId:CreateCluster' :: CreateCluster -> Maybe Text
sourceBackupId} -> Maybe Text
sourceBackupId) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:sourceBackupId:CreateCluster' :: Maybe Text
sourceBackupId = Maybe Text
a} :: CreateCluster)
createCluster_tagList :: Lens.Lens' CreateCluster (Prelude.Maybe [Tag])
createCluster_tagList :: Lens' CreateCluster (Maybe [Tag])
createCluster_tagList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe [Tag]
tagList :: Maybe [Tag]
$sel:tagList:CreateCluster' :: CreateCluster -> Maybe [Tag]
tagList} -> Maybe [Tag]
tagList) (\s :: CreateCluster
s@CreateCluster' {} Maybe [Tag]
a -> CreateCluster
s {$sel:tagList:CreateCluster' :: Maybe [Tag]
tagList = Maybe [Tag]
a} :: CreateCluster) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCluster_hsmType :: Lens.Lens' CreateCluster Prelude.Text
createCluster_hsmType :: Lens' CreateCluster Text
createCluster_hsmType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
hsmType :: Text
$sel:hsmType:CreateCluster' :: CreateCluster -> Text
hsmType} -> Text
hsmType) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:hsmType:CreateCluster' :: Text
hsmType = Text
a} :: CreateCluster)
createCluster_subnetIds :: Lens.Lens' CreateCluster (Prelude.NonEmpty Prelude.Text)
createCluster_subnetIds :: Lens' CreateCluster (NonEmpty Text)
createCluster_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {NonEmpty Text
subnetIds :: NonEmpty Text
$sel:subnetIds:CreateCluster' :: CreateCluster -> NonEmpty Text
subnetIds} -> NonEmpty Text
subnetIds) (\s :: CreateCluster
s@CreateCluster' {} NonEmpty Text
a -> CreateCluster
s {$sel:subnetIds:CreateCluster' :: NonEmpty Text
subnetIds = NonEmpty Text
a} :: CreateCluster) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateCluster where
type
AWSResponse CreateCluster =
CreateClusterResponse
request :: (Service -> Service) -> CreateCluster -> Request CreateCluster
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 CreateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCluster)))
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 -> CreateClusterResponse
CreateClusterResponse'
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 CreateCluster where
hashWithSalt :: Int -> CreateCluster -> Int
hashWithSalt Int
_salt CreateCluster' {Maybe [Tag]
Maybe Text
Maybe BackupRetentionPolicy
NonEmpty Text
Text
subnetIds :: NonEmpty Text
hsmType :: Text
tagList :: Maybe [Tag]
sourceBackupId :: Maybe Text
backupRetentionPolicy :: Maybe BackupRetentionPolicy
$sel:subnetIds:CreateCluster' :: CreateCluster -> NonEmpty Text
$sel:hsmType:CreateCluster' :: CreateCluster -> Text
$sel:tagList:CreateCluster' :: CreateCluster -> Maybe [Tag]
$sel:sourceBackupId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:backupRetentionPolicy:CreateCluster' :: CreateCluster -> Maybe BackupRetentionPolicy
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BackupRetentionPolicy
backupRetentionPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceBackupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tagList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
hsmType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
subnetIds
instance Prelude.NFData CreateCluster where
rnf :: CreateCluster -> ()
rnf CreateCluster' {Maybe [Tag]
Maybe Text
Maybe BackupRetentionPolicy
NonEmpty Text
Text
subnetIds :: NonEmpty Text
hsmType :: Text
tagList :: Maybe [Tag]
sourceBackupId :: Maybe Text
backupRetentionPolicy :: Maybe BackupRetentionPolicy
$sel:subnetIds:CreateCluster' :: CreateCluster -> NonEmpty Text
$sel:hsmType:CreateCluster' :: CreateCluster -> Text
$sel:tagList:CreateCluster' :: CreateCluster -> Maybe [Tag]
$sel:sourceBackupId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:backupRetentionPolicy:CreateCluster' :: CreateCluster -> Maybe BackupRetentionPolicy
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BackupRetentionPolicy
backupRetentionPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceBackupId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tagList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
hsmType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
subnetIds
instance Data.ToHeaders CreateCluster where
toHeaders :: CreateCluster -> 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.CreateCluster" ::
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 CreateCluster where
toJSON :: CreateCluster -> Value
toJSON CreateCluster' {Maybe [Tag]
Maybe Text
Maybe BackupRetentionPolicy
NonEmpty Text
Text
subnetIds :: NonEmpty Text
hsmType :: Text
tagList :: Maybe [Tag]
sourceBackupId :: Maybe Text
backupRetentionPolicy :: Maybe BackupRetentionPolicy
$sel:subnetIds:CreateCluster' :: CreateCluster -> NonEmpty Text
$sel:hsmType:CreateCluster' :: CreateCluster -> Text
$sel:tagList:CreateCluster' :: CreateCluster -> Maybe [Tag]
$sel:sourceBackupId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:backupRetentionPolicy:CreateCluster' :: CreateCluster -> Maybe BackupRetentionPolicy
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"BackupRetentionPolicy" 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 BackupRetentionPolicy
backupRetentionPolicy,
(Key
"SourceBackupId" 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 Text
sourceBackupId,
(Key
"TagList" 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 [Tag]
tagList,
forall a. a -> Maybe a
Prelude.Just (Key
"HsmType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hsmType),
forall a. a -> Maybe a
Prelude.Just (Key
"SubnetIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
subnetIds)
]
)
instance Data.ToPath CreateCluster where
toPath :: CreateCluster -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateCluster where
toQuery :: CreateCluster -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateClusterResponse = CreateClusterResponse'
{
CreateClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
CreateClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateClusterResponse -> CreateClusterResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateClusterResponse -> CreateClusterResponse -> Bool
$c/= :: CreateClusterResponse -> CreateClusterResponse -> Bool
== :: CreateClusterResponse -> CreateClusterResponse -> Bool
$c== :: CreateClusterResponse -> CreateClusterResponse -> Bool
Prelude.Eq, ReadPrec [CreateClusterResponse]
ReadPrec CreateClusterResponse
Int -> ReadS CreateClusterResponse
ReadS [CreateClusterResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateClusterResponse]
$creadListPrec :: ReadPrec [CreateClusterResponse]
readPrec :: ReadPrec CreateClusterResponse
$creadPrec :: ReadPrec CreateClusterResponse
readList :: ReadS [CreateClusterResponse]
$creadList :: ReadS [CreateClusterResponse]
readsPrec :: Int -> ReadS CreateClusterResponse
$creadsPrec :: Int -> ReadS CreateClusterResponse
Prelude.Read, Int -> CreateClusterResponse -> ShowS
[CreateClusterResponse] -> ShowS
CreateClusterResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateClusterResponse] -> ShowS
$cshowList :: [CreateClusterResponse] -> ShowS
show :: CreateClusterResponse -> String
$cshow :: CreateClusterResponse -> String
showsPrec :: Int -> CreateClusterResponse -> ShowS
$cshowsPrec :: Int -> CreateClusterResponse -> ShowS
Prelude.Show, forall x. Rep CreateClusterResponse x -> CreateClusterResponse
forall x. CreateClusterResponse -> Rep CreateClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateClusterResponse x -> CreateClusterResponse
$cfrom :: forall x. CreateClusterResponse -> Rep CreateClusterResponse x
Prelude.Generic)
newCreateClusterResponse ::
Prelude.Int ->
CreateClusterResponse
newCreateClusterResponse :: Int -> CreateClusterResponse
newCreateClusterResponse Int
pHttpStatus_ =
CreateClusterResponse'
{ $sel:cluster:CreateClusterResponse' :: Maybe Cluster
cluster = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createClusterResponse_cluster :: Lens.Lens' CreateClusterResponse (Prelude.Maybe Cluster)
createClusterResponse_cluster :: Lens' CreateClusterResponse (Maybe Cluster)
createClusterResponse_cluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:CreateClusterResponse' :: CreateClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Maybe Cluster
a -> CreateClusterResponse
s {$sel:cluster:CreateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: CreateClusterResponse)
createClusterResponse_httpStatus :: Lens.Lens' CreateClusterResponse Prelude.Int
createClusterResponse_httpStatus :: Lens' CreateClusterResponse Int
createClusterResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateClusterResponse' :: CreateClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Int
a -> CreateClusterResponse
s {$sel:httpStatus:CreateClusterResponse' :: Int
httpStatus = Int
a} :: CreateClusterResponse)
instance Prelude.NFData CreateClusterResponse where
rnf :: CreateClusterResponse -> ()
rnf CreateClusterResponse' {Int
Maybe Cluster
httpStatus :: Int
cluster :: Maybe Cluster
$sel:httpStatus:CreateClusterResponse' :: CreateClusterResponse -> Int
$sel:cluster:CreateClusterResponse' :: CreateClusterResponse -> 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