{-# 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.CloudHSM.ModifyHapg
(
ModifyHapg (..),
newModifyHapg,
modifyHapg_partitionSerialList,
modifyHapg_label,
modifyHapg_hapgArn,
ModifyHapgResponse (..),
newModifyHapgResponse,
modifyHapgResponse_hapgArn,
modifyHapgResponse_httpStatus,
)
where
import Amazonka.CloudHSM.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ModifyHapg = ModifyHapg'
{
ModifyHapg -> Maybe [Text]
partitionSerialList :: Prelude.Maybe [Prelude.Text],
ModifyHapg -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
ModifyHapg -> Text
hapgArn :: Prelude.Text
}
deriving (ModifyHapg -> ModifyHapg -> Bool
(ModifyHapg -> ModifyHapg -> Bool)
-> (ModifyHapg -> ModifyHapg -> Bool) -> Eq ModifyHapg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyHapg -> ModifyHapg -> Bool
$c/= :: ModifyHapg -> ModifyHapg -> Bool
== :: ModifyHapg -> ModifyHapg -> Bool
$c== :: ModifyHapg -> ModifyHapg -> Bool
Prelude.Eq, ReadPrec [ModifyHapg]
ReadPrec ModifyHapg
Int -> ReadS ModifyHapg
ReadS [ModifyHapg]
(Int -> ReadS ModifyHapg)
-> ReadS [ModifyHapg]
-> ReadPrec ModifyHapg
-> ReadPrec [ModifyHapg]
-> Read ModifyHapg
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyHapg]
$creadListPrec :: ReadPrec [ModifyHapg]
readPrec :: ReadPrec ModifyHapg
$creadPrec :: ReadPrec ModifyHapg
readList :: ReadS [ModifyHapg]
$creadList :: ReadS [ModifyHapg]
readsPrec :: Int -> ReadS ModifyHapg
$creadsPrec :: Int -> ReadS ModifyHapg
Prelude.Read, Int -> ModifyHapg -> ShowS
[ModifyHapg] -> ShowS
ModifyHapg -> String
(Int -> ModifyHapg -> ShowS)
-> (ModifyHapg -> String)
-> ([ModifyHapg] -> ShowS)
-> Show ModifyHapg
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyHapg] -> ShowS
$cshowList :: [ModifyHapg] -> ShowS
show :: ModifyHapg -> String
$cshow :: ModifyHapg -> String
showsPrec :: Int -> ModifyHapg -> ShowS
$cshowsPrec :: Int -> ModifyHapg -> ShowS
Prelude.Show, (forall x. ModifyHapg -> Rep ModifyHapg x)
-> (forall x. Rep ModifyHapg x -> ModifyHapg) -> Generic ModifyHapg
forall x. Rep ModifyHapg x -> ModifyHapg
forall x. ModifyHapg -> Rep ModifyHapg x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyHapg x -> ModifyHapg
$cfrom :: forall x. ModifyHapg -> Rep ModifyHapg x
Prelude.Generic)
newModifyHapg ::
Prelude.Text ->
ModifyHapg
newModifyHapg :: Text -> ModifyHapg
newModifyHapg Text
pHapgArn_ =
ModifyHapg' :: Maybe [Text] -> Maybe Text -> Text -> ModifyHapg
ModifyHapg'
{ $sel:partitionSerialList:ModifyHapg' :: Maybe [Text]
partitionSerialList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:label:ModifyHapg' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:hapgArn:ModifyHapg' :: Text
hapgArn = Text
pHapgArn_
}
modifyHapg_partitionSerialList :: Lens.Lens' ModifyHapg (Prelude.Maybe [Prelude.Text])
modifyHapg_partitionSerialList :: (Maybe [Text] -> f (Maybe [Text])) -> ModifyHapg -> f ModifyHapg
modifyHapg_partitionSerialList = (ModifyHapg -> Maybe [Text])
-> (ModifyHapg -> Maybe [Text] -> ModifyHapg)
-> Lens ModifyHapg ModifyHapg (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHapg' {Maybe [Text]
partitionSerialList :: Maybe [Text]
$sel:partitionSerialList:ModifyHapg' :: ModifyHapg -> Maybe [Text]
partitionSerialList} -> Maybe [Text]
partitionSerialList) (\s :: ModifyHapg
s@ModifyHapg' {} Maybe [Text]
a -> ModifyHapg
s {$sel:partitionSerialList:ModifyHapg' :: Maybe [Text]
partitionSerialList = Maybe [Text]
a} :: ModifyHapg) ((Maybe [Text] -> f (Maybe [Text])) -> ModifyHapg -> f ModifyHapg)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ModifyHapg
-> f ModifyHapg
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
modifyHapg_label :: Lens.Lens' ModifyHapg (Prelude.Maybe Prelude.Text)
modifyHapg_label :: (Maybe Text -> f (Maybe Text)) -> ModifyHapg -> f ModifyHapg
modifyHapg_label = (ModifyHapg -> Maybe Text)
-> (ModifyHapg -> Maybe Text -> ModifyHapg)
-> Lens ModifyHapg ModifyHapg (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHapg' {Maybe Text
label :: Maybe Text
$sel:label:ModifyHapg' :: ModifyHapg -> Maybe Text
label} -> Maybe Text
label) (\s :: ModifyHapg
s@ModifyHapg' {} Maybe Text
a -> ModifyHapg
s {$sel:label:ModifyHapg' :: Maybe Text
label = Maybe Text
a} :: ModifyHapg)
modifyHapg_hapgArn :: Lens.Lens' ModifyHapg Prelude.Text
modifyHapg_hapgArn :: (Text -> f Text) -> ModifyHapg -> f ModifyHapg
modifyHapg_hapgArn = (ModifyHapg -> Text)
-> (ModifyHapg -> Text -> ModifyHapg)
-> Lens ModifyHapg ModifyHapg Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHapg' {Text
hapgArn :: Text
$sel:hapgArn:ModifyHapg' :: ModifyHapg -> Text
hapgArn} -> Text
hapgArn) (\s :: ModifyHapg
s@ModifyHapg' {} Text
a -> ModifyHapg
s {$sel:hapgArn:ModifyHapg' :: Text
hapgArn = Text
a} :: ModifyHapg)
instance Core.AWSRequest ModifyHapg where
type AWSResponse ModifyHapg = ModifyHapgResponse
request :: ModifyHapg -> Request ModifyHapg
request = Service -> ModifyHapg -> Request ModifyHapg
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ModifyHapg
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyHapg)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ModifyHapg))
-> Logger
-> Service
-> Proxy ModifyHapg
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyHapg)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> ModifyHapgResponse
ModifyHapgResponse'
(Maybe Text -> Int -> ModifyHapgResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ModifyHapgResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HapgArn")
Either String (Int -> ModifyHapgResponse)
-> Either String Int -> Either String ModifyHapgResponse
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 ModifyHapg
instance Prelude.NFData ModifyHapg
instance Core.ToHeaders ModifyHapg where
toHeaders :: ModifyHapg -> ResponseHeaders
toHeaders =
ResponseHeaders -> ModifyHapg -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CloudHsmFrontendService.ModifyHapg" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ModifyHapg where
toJSON :: ModifyHapg -> Value
toJSON ModifyHapg' {Maybe [Text]
Maybe Text
Text
hapgArn :: Text
label :: Maybe Text
partitionSerialList :: Maybe [Text]
$sel:hapgArn:ModifyHapg' :: ModifyHapg -> Text
$sel:label:ModifyHapg' :: ModifyHapg -> Maybe Text
$sel:partitionSerialList:ModifyHapg' :: ModifyHapg -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PartitionSerialList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
partitionSerialList,
(Text
"Label" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
label,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HapgArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hapgArn)
]
)
instance Core.ToPath ModifyHapg where
toPath :: ModifyHapg -> ByteString
toPath = ByteString -> ModifyHapg -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ModifyHapg where
toQuery :: ModifyHapg -> QueryString
toQuery = QueryString -> ModifyHapg -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ModifyHapgResponse = ModifyHapgResponse'
{
ModifyHapgResponse -> Maybe Text
hapgArn :: Prelude.Maybe Prelude.Text,
ModifyHapgResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ModifyHapgResponse -> ModifyHapgResponse -> Bool
(ModifyHapgResponse -> ModifyHapgResponse -> Bool)
-> (ModifyHapgResponse -> ModifyHapgResponse -> Bool)
-> Eq ModifyHapgResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyHapgResponse -> ModifyHapgResponse -> Bool
$c/= :: ModifyHapgResponse -> ModifyHapgResponse -> Bool
== :: ModifyHapgResponse -> ModifyHapgResponse -> Bool
$c== :: ModifyHapgResponse -> ModifyHapgResponse -> Bool
Prelude.Eq, ReadPrec [ModifyHapgResponse]
ReadPrec ModifyHapgResponse
Int -> ReadS ModifyHapgResponse
ReadS [ModifyHapgResponse]
(Int -> ReadS ModifyHapgResponse)
-> ReadS [ModifyHapgResponse]
-> ReadPrec ModifyHapgResponse
-> ReadPrec [ModifyHapgResponse]
-> Read ModifyHapgResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyHapgResponse]
$creadListPrec :: ReadPrec [ModifyHapgResponse]
readPrec :: ReadPrec ModifyHapgResponse
$creadPrec :: ReadPrec ModifyHapgResponse
readList :: ReadS [ModifyHapgResponse]
$creadList :: ReadS [ModifyHapgResponse]
readsPrec :: Int -> ReadS ModifyHapgResponse
$creadsPrec :: Int -> ReadS ModifyHapgResponse
Prelude.Read, Int -> ModifyHapgResponse -> ShowS
[ModifyHapgResponse] -> ShowS
ModifyHapgResponse -> String
(Int -> ModifyHapgResponse -> ShowS)
-> (ModifyHapgResponse -> String)
-> ([ModifyHapgResponse] -> ShowS)
-> Show ModifyHapgResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyHapgResponse] -> ShowS
$cshowList :: [ModifyHapgResponse] -> ShowS
show :: ModifyHapgResponse -> String
$cshow :: ModifyHapgResponse -> String
showsPrec :: Int -> ModifyHapgResponse -> ShowS
$cshowsPrec :: Int -> ModifyHapgResponse -> ShowS
Prelude.Show, (forall x. ModifyHapgResponse -> Rep ModifyHapgResponse x)
-> (forall x. Rep ModifyHapgResponse x -> ModifyHapgResponse)
-> Generic ModifyHapgResponse
forall x. Rep ModifyHapgResponse x -> ModifyHapgResponse
forall x. ModifyHapgResponse -> Rep ModifyHapgResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyHapgResponse x -> ModifyHapgResponse
$cfrom :: forall x. ModifyHapgResponse -> Rep ModifyHapgResponse x
Prelude.Generic)
newModifyHapgResponse ::
Prelude.Int ->
ModifyHapgResponse
newModifyHapgResponse :: Int -> ModifyHapgResponse
newModifyHapgResponse Int
pHttpStatus_ =
ModifyHapgResponse' :: Maybe Text -> Int -> ModifyHapgResponse
ModifyHapgResponse'
{ $sel:hapgArn:ModifyHapgResponse' :: Maybe Text
hapgArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ModifyHapgResponse' :: Int
httpStatus = Int
pHttpStatus_
}
modifyHapgResponse_hapgArn :: Lens.Lens' ModifyHapgResponse (Prelude.Maybe Prelude.Text)
modifyHapgResponse_hapgArn :: (Maybe Text -> f (Maybe Text))
-> ModifyHapgResponse -> f ModifyHapgResponse
modifyHapgResponse_hapgArn = (ModifyHapgResponse -> Maybe Text)
-> (ModifyHapgResponse -> Maybe Text -> ModifyHapgResponse)
-> Lens
ModifyHapgResponse ModifyHapgResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHapgResponse' {Maybe Text
hapgArn :: Maybe Text
$sel:hapgArn:ModifyHapgResponse' :: ModifyHapgResponse -> Maybe Text
hapgArn} -> Maybe Text
hapgArn) (\s :: ModifyHapgResponse
s@ModifyHapgResponse' {} Maybe Text
a -> ModifyHapgResponse
s {$sel:hapgArn:ModifyHapgResponse' :: Maybe Text
hapgArn = Maybe Text
a} :: ModifyHapgResponse)
modifyHapgResponse_httpStatus :: Lens.Lens' ModifyHapgResponse Prelude.Int
modifyHapgResponse_httpStatus :: (Int -> f Int) -> ModifyHapgResponse -> f ModifyHapgResponse
modifyHapgResponse_httpStatus = (ModifyHapgResponse -> Int)
-> (ModifyHapgResponse -> Int -> ModifyHapgResponse)
-> Lens ModifyHapgResponse ModifyHapgResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHapgResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyHapgResponse' :: ModifyHapgResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyHapgResponse
s@ModifyHapgResponse' {} Int
a -> ModifyHapgResponse
s {$sel:httpStatus:ModifyHapgResponse' :: Int
httpStatus = Int
a} :: ModifyHapgResponse)
instance Prelude.NFData ModifyHapgResponse