{-# 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.DeleteHapg
(
DeleteHapg (..),
newDeleteHapg,
deleteHapg_hapgArn,
DeleteHapgResponse (..),
newDeleteHapgResponse,
deleteHapgResponse_httpStatus,
deleteHapgResponse_status,
)
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 DeleteHapg = DeleteHapg'
{
DeleteHapg -> Text
hapgArn :: Prelude.Text
}
deriving (DeleteHapg -> DeleteHapg -> Bool
(DeleteHapg -> DeleteHapg -> Bool)
-> (DeleteHapg -> DeleteHapg -> Bool) -> Eq DeleteHapg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteHapg -> DeleteHapg -> Bool
$c/= :: DeleteHapg -> DeleteHapg -> Bool
== :: DeleteHapg -> DeleteHapg -> Bool
$c== :: DeleteHapg -> DeleteHapg -> Bool
Prelude.Eq, ReadPrec [DeleteHapg]
ReadPrec DeleteHapg
Int -> ReadS DeleteHapg
ReadS [DeleteHapg]
(Int -> ReadS DeleteHapg)
-> ReadS [DeleteHapg]
-> ReadPrec DeleteHapg
-> ReadPrec [DeleteHapg]
-> Read DeleteHapg
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteHapg]
$creadListPrec :: ReadPrec [DeleteHapg]
readPrec :: ReadPrec DeleteHapg
$creadPrec :: ReadPrec DeleteHapg
readList :: ReadS [DeleteHapg]
$creadList :: ReadS [DeleteHapg]
readsPrec :: Int -> ReadS DeleteHapg
$creadsPrec :: Int -> ReadS DeleteHapg
Prelude.Read, Int -> DeleteHapg -> ShowS
[DeleteHapg] -> ShowS
DeleteHapg -> String
(Int -> DeleteHapg -> ShowS)
-> (DeleteHapg -> String)
-> ([DeleteHapg] -> ShowS)
-> Show DeleteHapg
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteHapg] -> ShowS
$cshowList :: [DeleteHapg] -> ShowS
show :: DeleteHapg -> String
$cshow :: DeleteHapg -> String
showsPrec :: Int -> DeleteHapg -> ShowS
$cshowsPrec :: Int -> DeleteHapg -> ShowS
Prelude.Show, (forall x. DeleteHapg -> Rep DeleteHapg x)
-> (forall x. Rep DeleteHapg x -> DeleteHapg) -> Generic DeleteHapg
forall x. Rep DeleteHapg x -> DeleteHapg
forall x. DeleteHapg -> Rep DeleteHapg x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteHapg x -> DeleteHapg
$cfrom :: forall x. DeleteHapg -> Rep DeleteHapg x
Prelude.Generic)
newDeleteHapg ::
Prelude.Text ->
DeleteHapg
newDeleteHapg :: Text -> DeleteHapg
newDeleteHapg Text
pHapgArn_ =
DeleteHapg' :: Text -> DeleteHapg
DeleteHapg' {$sel:hapgArn:DeleteHapg' :: Text
hapgArn = Text
pHapgArn_}
deleteHapg_hapgArn :: Lens.Lens' DeleteHapg Prelude.Text
deleteHapg_hapgArn :: (Text -> f Text) -> DeleteHapg -> f DeleteHapg
deleteHapg_hapgArn = (DeleteHapg -> Text)
-> (DeleteHapg -> Text -> DeleteHapg)
-> Lens DeleteHapg DeleteHapg Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteHapg' {Text
hapgArn :: Text
$sel:hapgArn:DeleteHapg' :: DeleteHapg -> Text
hapgArn} -> Text
hapgArn) (\s :: DeleteHapg
s@DeleteHapg' {} Text
a -> DeleteHapg
s {$sel:hapgArn:DeleteHapg' :: Text
hapgArn = Text
a} :: DeleteHapg)
instance Core.AWSRequest DeleteHapg where
type AWSResponse DeleteHapg = DeleteHapgResponse
request :: DeleteHapg -> Request DeleteHapg
request = Service -> DeleteHapg -> Request DeleteHapg
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteHapg
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteHapg)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteHapg))
-> Logger
-> Service
-> Proxy DeleteHapg
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteHapg)))
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 ->
Int -> Text -> DeleteHapgResponse
DeleteHapgResponse'
(Int -> Text -> DeleteHapgResponse)
-> Either String Int -> Either String (Text -> DeleteHapgResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> DeleteHapgResponse)
-> Either String Text -> Either String DeleteHapgResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Status")
)
instance Prelude.Hashable DeleteHapg
instance Prelude.NFData DeleteHapg
instance Core.ToHeaders DeleteHapg where
toHeaders :: DeleteHapg -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteHapg -> 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.DeleteHapg" ::
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 DeleteHapg where
toJSON :: DeleteHapg -> Value
toJSON DeleteHapg' {Text
hapgArn :: Text
$sel:hapgArn:DeleteHapg' :: DeleteHapg -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[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 DeleteHapg where
toPath :: DeleteHapg -> ByteString
toPath = ByteString -> DeleteHapg -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteHapg where
toQuery :: DeleteHapg -> QueryString
toQuery = QueryString -> DeleteHapg -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteHapgResponse = DeleteHapgResponse'
{
DeleteHapgResponse -> Int
httpStatus :: Prelude.Int,
DeleteHapgResponse -> Text
status :: Prelude.Text
}
deriving (DeleteHapgResponse -> DeleteHapgResponse -> Bool
(DeleteHapgResponse -> DeleteHapgResponse -> Bool)
-> (DeleteHapgResponse -> DeleteHapgResponse -> Bool)
-> Eq DeleteHapgResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteHapgResponse -> DeleteHapgResponse -> Bool
$c/= :: DeleteHapgResponse -> DeleteHapgResponse -> Bool
== :: DeleteHapgResponse -> DeleteHapgResponse -> Bool
$c== :: DeleteHapgResponse -> DeleteHapgResponse -> Bool
Prelude.Eq, ReadPrec [DeleteHapgResponse]
ReadPrec DeleteHapgResponse
Int -> ReadS DeleteHapgResponse
ReadS [DeleteHapgResponse]
(Int -> ReadS DeleteHapgResponse)
-> ReadS [DeleteHapgResponse]
-> ReadPrec DeleteHapgResponse
-> ReadPrec [DeleteHapgResponse]
-> Read DeleteHapgResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteHapgResponse]
$creadListPrec :: ReadPrec [DeleteHapgResponse]
readPrec :: ReadPrec DeleteHapgResponse
$creadPrec :: ReadPrec DeleteHapgResponse
readList :: ReadS [DeleteHapgResponse]
$creadList :: ReadS [DeleteHapgResponse]
readsPrec :: Int -> ReadS DeleteHapgResponse
$creadsPrec :: Int -> ReadS DeleteHapgResponse
Prelude.Read, Int -> DeleteHapgResponse -> ShowS
[DeleteHapgResponse] -> ShowS
DeleteHapgResponse -> String
(Int -> DeleteHapgResponse -> ShowS)
-> (DeleteHapgResponse -> String)
-> ([DeleteHapgResponse] -> ShowS)
-> Show DeleteHapgResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteHapgResponse] -> ShowS
$cshowList :: [DeleteHapgResponse] -> ShowS
show :: DeleteHapgResponse -> String
$cshow :: DeleteHapgResponse -> String
showsPrec :: Int -> DeleteHapgResponse -> ShowS
$cshowsPrec :: Int -> DeleteHapgResponse -> ShowS
Prelude.Show, (forall x. DeleteHapgResponse -> Rep DeleteHapgResponse x)
-> (forall x. Rep DeleteHapgResponse x -> DeleteHapgResponse)
-> Generic DeleteHapgResponse
forall x. Rep DeleteHapgResponse x -> DeleteHapgResponse
forall x. DeleteHapgResponse -> Rep DeleteHapgResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteHapgResponse x -> DeleteHapgResponse
$cfrom :: forall x. DeleteHapgResponse -> Rep DeleteHapgResponse x
Prelude.Generic)
newDeleteHapgResponse ::
Prelude.Int ->
Prelude.Text ->
DeleteHapgResponse
newDeleteHapgResponse :: Int -> Text -> DeleteHapgResponse
newDeleteHapgResponse Int
pHttpStatus_ Text
pStatus_ =
DeleteHapgResponse' :: Int -> Text -> DeleteHapgResponse
DeleteHapgResponse'
{ $sel:httpStatus:DeleteHapgResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:status:DeleteHapgResponse' :: Text
status = Text
pStatus_
}
deleteHapgResponse_httpStatus :: Lens.Lens' DeleteHapgResponse Prelude.Int
deleteHapgResponse_httpStatus :: (Int -> f Int) -> DeleteHapgResponse -> f DeleteHapgResponse
deleteHapgResponse_httpStatus = (DeleteHapgResponse -> Int)
-> (DeleteHapgResponse -> Int -> DeleteHapgResponse)
-> Lens DeleteHapgResponse DeleteHapgResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteHapgResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteHapgResponse' :: DeleteHapgResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteHapgResponse
s@DeleteHapgResponse' {} Int
a -> DeleteHapgResponse
s {$sel:httpStatus:DeleteHapgResponse' :: Int
httpStatus = Int
a} :: DeleteHapgResponse)
deleteHapgResponse_status :: Lens.Lens' DeleteHapgResponse Prelude.Text
deleteHapgResponse_status :: (Text -> f Text) -> DeleteHapgResponse -> f DeleteHapgResponse
deleteHapgResponse_status = (DeleteHapgResponse -> Text)
-> (DeleteHapgResponse -> Text -> DeleteHapgResponse)
-> Lens DeleteHapgResponse DeleteHapgResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteHapgResponse' {Text
status :: Text
$sel:status:DeleteHapgResponse' :: DeleteHapgResponse -> Text
status} -> Text
status) (\s :: DeleteHapgResponse
s@DeleteHapgResponse' {} Text
a -> DeleteHapgResponse
s {$sel:status:DeleteHapgResponse' :: Text
status = Text
a} :: DeleteHapgResponse)
instance Prelude.NFData DeleteHapgResponse