{-# 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.OpsWorksCM.DeleteServer
(
DeleteServer (..),
newDeleteServer,
deleteServer_serverName,
DeleteServerResponse (..),
newDeleteServerResponse,
deleteServerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorksCM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteServer = DeleteServer'
{
DeleteServer -> Text
serverName :: Prelude.Text
}
deriving (DeleteServer -> DeleteServer -> Bool
(DeleteServer -> DeleteServer -> Bool)
-> (DeleteServer -> DeleteServer -> Bool) -> Eq DeleteServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteServer -> DeleteServer -> Bool
$c/= :: DeleteServer -> DeleteServer -> Bool
== :: DeleteServer -> DeleteServer -> Bool
$c== :: DeleteServer -> DeleteServer -> Bool
Prelude.Eq, ReadPrec [DeleteServer]
ReadPrec DeleteServer
Int -> ReadS DeleteServer
ReadS [DeleteServer]
(Int -> ReadS DeleteServer)
-> ReadS [DeleteServer]
-> ReadPrec DeleteServer
-> ReadPrec [DeleteServer]
-> Read DeleteServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteServer]
$creadListPrec :: ReadPrec [DeleteServer]
readPrec :: ReadPrec DeleteServer
$creadPrec :: ReadPrec DeleteServer
readList :: ReadS [DeleteServer]
$creadList :: ReadS [DeleteServer]
readsPrec :: Int -> ReadS DeleteServer
$creadsPrec :: Int -> ReadS DeleteServer
Prelude.Read, Int -> DeleteServer -> ShowS
[DeleteServer] -> ShowS
DeleteServer -> String
(Int -> DeleteServer -> ShowS)
-> (DeleteServer -> String)
-> ([DeleteServer] -> ShowS)
-> Show DeleteServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteServer] -> ShowS
$cshowList :: [DeleteServer] -> ShowS
show :: DeleteServer -> String
$cshow :: DeleteServer -> String
showsPrec :: Int -> DeleteServer -> ShowS
$cshowsPrec :: Int -> DeleteServer -> ShowS
Prelude.Show, (forall x. DeleteServer -> Rep DeleteServer x)
-> (forall x. Rep DeleteServer x -> DeleteServer)
-> Generic DeleteServer
forall x. Rep DeleteServer x -> DeleteServer
forall x. DeleteServer -> Rep DeleteServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteServer x -> DeleteServer
$cfrom :: forall x. DeleteServer -> Rep DeleteServer x
Prelude.Generic)
newDeleteServer ::
Prelude.Text ->
DeleteServer
newDeleteServer :: Text -> DeleteServer
newDeleteServer Text
pServerName_ =
DeleteServer' :: Text -> DeleteServer
DeleteServer' {$sel:serverName:DeleteServer' :: Text
serverName = Text
pServerName_}
deleteServer_serverName :: Lens.Lens' DeleteServer Prelude.Text
deleteServer_serverName :: (Text -> f Text) -> DeleteServer -> f DeleteServer
deleteServer_serverName = (DeleteServer -> Text)
-> (DeleteServer -> Text -> DeleteServer)
-> Lens DeleteServer DeleteServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServer' {Text
serverName :: Text
$sel:serverName:DeleteServer' :: DeleteServer -> Text
serverName} -> Text
serverName) (\s :: DeleteServer
s@DeleteServer' {} Text
a -> DeleteServer
s {$sel:serverName:DeleteServer' :: Text
serverName = Text
a} :: DeleteServer)
instance Core.AWSRequest DeleteServer where
type AWSResponse DeleteServer = DeleteServerResponse
request :: DeleteServer -> Request DeleteServer
request = Service -> DeleteServer -> Request DeleteServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteServer)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteServer))
-> Logger
-> Service
-> Proxy DeleteServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteServer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DeleteServerResponse
DeleteServerResponse'
(Int -> DeleteServerResponse)
-> Either String Int -> Either String DeleteServerResponse
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))
)
instance Prelude.Hashable DeleteServer
instance Prelude.NFData DeleteServer
instance Core.ToHeaders DeleteServer where
toHeaders :: DeleteServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteServer -> 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
"OpsWorksCM_V2016_11_01.DeleteServer" ::
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 DeleteServer where
toJSON :: DeleteServer -> Value
toJSON DeleteServer' {Text
serverName :: Text
$sel:serverName:DeleteServer' :: DeleteServer -> 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
"ServerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverName)]
)
instance Core.ToPath DeleteServer where
toPath :: DeleteServer -> ByteString
toPath = ByteString -> DeleteServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteServer where
toQuery :: DeleteServer -> QueryString
toQuery = QueryString -> DeleteServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteServerResponse = DeleteServerResponse'
{
DeleteServerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteServerResponse -> DeleteServerResponse -> Bool
(DeleteServerResponse -> DeleteServerResponse -> Bool)
-> (DeleteServerResponse -> DeleteServerResponse -> Bool)
-> Eq DeleteServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteServerResponse -> DeleteServerResponse -> Bool
$c/= :: DeleteServerResponse -> DeleteServerResponse -> Bool
== :: DeleteServerResponse -> DeleteServerResponse -> Bool
$c== :: DeleteServerResponse -> DeleteServerResponse -> Bool
Prelude.Eq, ReadPrec [DeleteServerResponse]
ReadPrec DeleteServerResponse
Int -> ReadS DeleteServerResponse
ReadS [DeleteServerResponse]
(Int -> ReadS DeleteServerResponse)
-> ReadS [DeleteServerResponse]
-> ReadPrec DeleteServerResponse
-> ReadPrec [DeleteServerResponse]
-> Read DeleteServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteServerResponse]
$creadListPrec :: ReadPrec [DeleteServerResponse]
readPrec :: ReadPrec DeleteServerResponse
$creadPrec :: ReadPrec DeleteServerResponse
readList :: ReadS [DeleteServerResponse]
$creadList :: ReadS [DeleteServerResponse]
readsPrec :: Int -> ReadS DeleteServerResponse
$creadsPrec :: Int -> ReadS DeleteServerResponse
Prelude.Read, Int -> DeleteServerResponse -> ShowS
[DeleteServerResponse] -> ShowS
DeleteServerResponse -> String
(Int -> DeleteServerResponse -> ShowS)
-> (DeleteServerResponse -> String)
-> ([DeleteServerResponse] -> ShowS)
-> Show DeleteServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteServerResponse] -> ShowS
$cshowList :: [DeleteServerResponse] -> ShowS
show :: DeleteServerResponse -> String
$cshow :: DeleteServerResponse -> String
showsPrec :: Int -> DeleteServerResponse -> ShowS
$cshowsPrec :: Int -> DeleteServerResponse -> ShowS
Prelude.Show, (forall x. DeleteServerResponse -> Rep DeleteServerResponse x)
-> (forall x. Rep DeleteServerResponse x -> DeleteServerResponse)
-> Generic DeleteServerResponse
forall x. Rep DeleteServerResponse x -> DeleteServerResponse
forall x. DeleteServerResponse -> Rep DeleteServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteServerResponse x -> DeleteServerResponse
$cfrom :: forall x. DeleteServerResponse -> Rep DeleteServerResponse x
Prelude.Generic)
newDeleteServerResponse ::
Prelude.Int ->
DeleteServerResponse
newDeleteServerResponse :: Int -> DeleteServerResponse
newDeleteServerResponse Int
pHttpStatus_ =
DeleteServerResponse' :: Int -> DeleteServerResponse
DeleteServerResponse' {$sel:httpStatus:DeleteServerResponse' :: Int
httpStatus = Int
pHttpStatus_}
deleteServerResponse_httpStatus :: Lens.Lens' DeleteServerResponse Prelude.Int
deleteServerResponse_httpStatus :: (Int -> f Int) -> DeleteServerResponse -> f DeleteServerResponse
deleteServerResponse_httpStatus = (DeleteServerResponse -> Int)
-> (DeleteServerResponse -> Int -> DeleteServerResponse)
-> Lens DeleteServerResponse DeleteServerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteServerResponse' :: DeleteServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteServerResponse
s@DeleteServerResponse' {} Int
a -> DeleteServerResponse
s {$sel:httpStatus:DeleteServerResponse' :: Int
httpStatus = Int
a} :: DeleteServerResponse)
instance Prelude.NFData DeleteServerResponse