{-# 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.Lightsail.DeleteKeyPair
(
DeleteKeyPair (..),
newDeleteKeyPair,
deleteKeyPair_keyPairName,
DeleteKeyPairResponse (..),
newDeleteKeyPairResponse,
deleteKeyPairResponse_operation,
deleteKeyPairResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteKeyPair = DeleteKeyPair'
{
DeleteKeyPair -> Text
keyPairName :: Prelude.Text
}
deriving (DeleteKeyPair -> DeleteKeyPair -> Bool
(DeleteKeyPair -> DeleteKeyPair -> Bool)
-> (DeleteKeyPair -> DeleteKeyPair -> Bool) -> Eq DeleteKeyPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteKeyPair -> DeleteKeyPair -> Bool
$c/= :: DeleteKeyPair -> DeleteKeyPair -> Bool
== :: DeleteKeyPair -> DeleteKeyPair -> Bool
$c== :: DeleteKeyPair -> DeleteKeyPair -> Bool
Prelude.Eq, ReadPrec [DeleteKeyPair]
ReadPrec DeleteKeyPair
Int -> ReadS DeleteKeyPair
ReadS [DeleteKeyPair]
(Int -> ReadS DeleteKeyPair)
-> ReadS [DeleteKeyPair]
-> ReadPrec DeleteKeyPair
-> ReadPrec [DeleteKeyPair]
-> Read DeleteKeyPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteKeyPair]
$creadListPrec :: ReadPrec [DeleteKeyPair]
readPrec :: ReadPrec DeleteKeyPair
$creadPrec :: ReadPrec DeleteKeyPair
readList :: ReadS [DeleteKeyPair]
$creadList :: ReadS [DeleteKeyPair]
readsPrec :: Int -> ReadS DeleteKeyPair
$creadsPrec :: Int -> ReadS DeleteKeyPair
Prelude.Read, Int -> DeleteKeyPair -> ShowS
[DeleteKeyPair] -> ShowS
DeleteKeyPair -> String
(Int -> DeleteKeyPair -> ShowS)
-> (DeleteKeyPair -> String)
-> ([DeleteKeyPair] -> ShowS)
-> Show DeleteKeyPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteKeyPair] -> ShowS
$cshowList :: [DeleteKeyPair] -> ShowS
show :: DeleteKeyPair -> String
$cshow :: DeleteKeyPair -> String
showsPrec :: Int -> DeleteKeyPair -> ShowS
$cshowsPrec :: Int -> DeleteKeyPair -> ShowS
Prelude.Show, (forall x. DeleteKeyPair -> Rep DeleteKeyPair x)
-> (forall x. Rep DeleteKeyPair x -> DeleteKeyPair)
-> Generic DeleteKeyPair
forall x. Rep DeleteKeyPair x -> DeleteKeyPair
forall x. DeleteKeyPair -> Rep DeleteKeyPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteKeyPair x -> DeleteKeyPair
$cfrom :: forall x. DeleteKeyPair -> Rep DeleteKeyPair x
Prelude.Generic)
newDeleteKeyPair ::
Prelude.Text ->
DeleteKeyPair
newDeleteKeyPair :: Text -> DeleteKeyPair
newDeleteKeyPair Text
pKeyPairName_ =
DeleteKeyPair' :: Text -> DeleteKeyPair
DeleteKeyPair' {$sel:keyPairName:DeleteKeyPair' :: Text
keyPairName = Text
pKeyPairName_}
deleteKeyPair_keyPairName :: Lens.Lens' DeleteKeyPair Prelude.Text
deleteKeyPair_keyPairName :: (Text -> f Text) -> DeleteKeyPair -> f DeleteKeyPair
deleteKeyPair_keyPairName = (DeleteKeyPair -> Text)
-> (DeleteKeyPair -> Text -> DeleteKeyPair)
-> Lens DeleteKeyPair DeleteKeyPair Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteKeyPair' {Text
keyPairName :: Text
$sel:keyPairName:DeleteKeyPair' :: DeleteKeyPair -> Text
keyPairName} -> Text
keyPairName) (\s :: DeleteKeyPair
s@DeleteKeyPair' {} Text
a -> DeleteKeyPair
s {$sel:keyPairName:DeleteKeyPair' :: Text
keyPairName = Text
a} :: DeleteKeyPair)
instance Core.AWSRequest DeleteKeyPair where
type
AWSResponse DeleteKeyPair =
DeleteKeyPairResponse
request :: DeleteKeyPair -> Request DeleteKeyPair
request = Service -> DeleteKeyPair -> Request DeleteKeyPair
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteKeyPair
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteKeyPair)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteKeyPair))
-> Logger
-> Service
-> Proxy DeleteKeyPair
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteKeyPair)))
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 Operation -> Int -> DeleteKeyPairResponse
DeleteKeyPairResponse'
(Maybe Operation -> Int -> DeleteKeyPairResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> DeleteKeyPairResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operation")
Either String (Int -> DeleteKeyPairResponse)
-> Either String Int -> Either String DeleteKeyPairResponse
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 DeleteKeyPair
instance Prelude.NFData DeleteKeyPair
instance Core.ToHeaders DeleteKeyPair where
toHeaders :: DeleteKeyPair -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteKeyPair -> 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
"Lightsail_20161128.DeleteKeyPair" ::
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 DeleteKeyPair where
toJSON :: DeleteKeyPair -> Value
toJSON DeleteKeyPair' {Text
keyPairName :: Text
$sel:keyPairName:DeleteKeyPair' :: DeleteKeyPair -> 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
"keyPairName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
keyPairName)]
)
instance Core.ToPath DeleteKeyPair where
toPath :: DeleteKeyPair -> ByteString
toPath = ByteString -> DeleteKeyPair -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteKeyPair where
toQuery :: DeleteKeyPair -> QueryString
toQuery = QueryString -> DeleteKeyPair -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteKeyPairResponse = DeleteKeyPairResponse'
{
DeleteKeyPairResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
DeleteKeyPairResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool
(DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool)
-> (DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool)
-> Eq DeleteKeyPairResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool
$c/= :: DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool
== :: DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool
$c== :: DeleteKeyPairResponse -> DeleteKeyPairResponse -> Bool
Prelude.Eq, ReadPrec [DeleteKeyPairResponse]
ReadPrec DeleteKeyPairResponse
Int -> ReadS DeleteKeyPairResponse
ReadS [DeleteKeyPairResponse]
(Int -> ReadS DeleteKeyPairResponse)
-> ReadS [DeleteKeyPairResponse]
-> ReadPrec DeleteKeyPairResponse
-> ReadPrec [DeleteKeyPairResponse]
-> Read DeleteKeyPairResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteKeyPairResponse]
$creadListPrec :: ReadPrec [DeleteKeyPairResponse]
readPrec :: ReadPrec DeleteKeyPairResponse
$creadPrec :: ReadPrec DeleteKeyPairResponse
readList :: ReadS [DeleteKeyPairResponse]
$creadList :: ReadS [DeleteKeyPairResponse]
readsPrec :: Int -> ReadS DeleteKeyPairResponse
$creadsPrec :: Int -> ReadS DeleteKeyPairResponse
Prelude.Read, Int -> DeleteKeyPairResponse -> ShowS
[DeleteKeyPairResponse] -> ShowS
DeleteKeyPairResponse -> String
(Int -> DeleteKeyPairResponse -> ShowS)
-> (DeleteKeyPairResponse -> String)
-> ([DeleteKeyPairResponse] -> ShowS)
-> Show DeleteKeyPairResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteKeyPairResponse] -> ShowS
$cshowList :: [DeleteKeyPairResponse] -> ShowS
show :: DeleteKeyPairResponse -> String
$cshow :: DeleteKeyPairResponse -> String
showsPrec :: Int -> DeleteKeyPairResponse -> ShowS
$cshowsPrec :: Int -> DeleteKeyPairResponse -> ShowS
Prelude.Show, (forall x. DeleteKeyPairResponse -> Rep DeleteKeyPairResponse x)
-> (forall x. Rep DeleteKeyPairResponse x -> DeleteKeyPairResponse)
-> Generic DeleteKeyPairResponse
forall x. Rep DeleteKeyPairResponse x -> DeleteKeyPairResponse
forall x. DeleteKeyPairResponse -> Rep DeleteKeyPairResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteKeyPairResponse x -> DeleteKeyPairResponse
$cfrom :: forall x. DeleteKeyPairResponse -> Rep DeleteKeyPairResponse x
Prelude.Generic)
newDeleteKeyPairResponse ::
Prelude.Int ->
DeleteKeyPairResponse
newDeleteKeyPairResponse :: Int -> DeleteKeyPairResponse
newDeleteKeyPairResponse Int
pHttpStatus_ =
DeleteKeyPairResponse' :: Maybe Operation -> Int -> DeleteKeyPairResponse
DeleteKeyPairResponse'
{ $sel:operation:DeleteKeyPairResponse' :: Maybe Operation
operation = Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteKeyPairResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteKeyPairResponse_operation :: Lens.Lens' DeleteKeyPairResponse (Prelude.Maybe Operation)
deleteKeyPairResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> DeleteKeyPairResponse -> f DeleteKeyPairResponse
deleteKeyPairResponse_operation = (DeleteKeyPairResponse -> Maybe Operation)
-> (DeleteKeyPairResponse
-> Maybe Operation -> DeleteKeyPairResponse)
-> Lens
DeleteKeyPairResponse
DeleteKeyPairResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteKeyPairResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:DeleteKeyPairResponse' :: DeleteKeyPairResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: DeleteKeyPairResponse
s@DeleteKeyPairResponse' {} Maybe Operation
a -> DeleteKeyPairResponse
s {$sel:operation:DeleteKeyPairResponse' :: Maybe Operation
operation = Maybe Operation
a} :: DeleteKeyPairResponse)
deleteKeyPairResponse_httpStatus :: Lens.Lens' DeleteKeyPairResponse Prelude.Int
deleteKeyPairResponse_httpStatus :: (Int -> f Int) -> DeleteKeyPairResponse -> f DeleteKeyPairResponse
deleteKeyPairResponse_httpStatus = (DeleteKeyPairResponse -> Int)
-> (DeleteKeyPairResponse -> Int -> DeleteKeyPairResponse)
-> Lens DeleteKeyPairResponse DeleteKeyPairResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteKeyPairResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteKeyPairResponse' :: DeleteKeyPairResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteKeyPairResponse
s@DeleteKeyPairResponse' {} Int
a -> DeleteKeyPairResponse
s {$sel:httpStatus:DeleteKeyPairResponse' :: Int
httpStatus = Int
a} :: DeleteKeyPairResponse)
instance Prelude.NFData DeleteKeyPairResponse