{-# 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.Route53AutoNaming.DeregisterInstance
(
DeregisterInstance (..),
newDeregisterInstance,
deregisterInstance_serviceId,
deregisterInstance_instanceId,
DeregisterInstanceResponse (..),
newDeregisterInstanceResponse,
deregisterInstanceResponse_operationId,
deregisterInstanceResponse_httpStatus,
)
where
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
import Amazonka.Route53AutoNaming.Types
data DeregisterInstance = DeregisterInstance'
{
DeregisterInstance -> Text
serviceId :: Prelude.Text,
DeregisterInstance -> Text
instanceId :: Prelude.Text
}
deriving (DeregisterInstance -> DeregisterInstance -> Bool
(DeregisterInstance -> DeregisterInstance -> Bool)
-> (DeregisterInstance -> DeregisterInstance -> Bool)
-> Eq DeregisterInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterInstance -> DeregisterInstance -> Bool
$c/= :: DeregisterInstance -> DeregisterInstance -> Bool
== :: DeregisterInstance -> DeregisterInstance -> Bool
$c== :: DeregisterInstance -> DeregisterInstance -> Bool
Prelude.Eq, ReadPrec [DeregisterInstance]
ReadPrec DeregisterInstance
Int -> ReadS DeregisterInstance
ReadS [DeregisterInstance]
(Int -> ReadS DeregisterInstance)
-> ReadS [DeregisterInstance]
-> ReadPrec DeregisterInstance
-> ReadPrec [DeregisterInstance]
-> Read DeregisterInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterInstance]
$creadListPrec :: ReadPrec [DeregisterInstance]
readPrec :: ReadPrec DeregisterInstance
$creadPrec :: ReadPrec DeregisterInstance
readList :: ReadS [DeregisterInstance]
$creadList :: ReadS [DeregisterInstance]
readsPrec :: Int -> ReadS DeregisterInstance
$creadsPrec :: Int -> ReadS DeregisterInstance
Prelude.Read, Int -> DeregisterInstance -> ShowS
[DeregisterInstance] -> ShowS
DeregisterInstance -> String
(Int -> DeregisterInstance -> ShowS)
-> (DeregisterInstance -> String)
-> ([DeregisterInstance] -> ShowS)
-> Show DeregisterInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterInstance] -> ShowS
$cshowList :: [DeregisterInstance] -> ShowS
show :: DeregisterInstance -> String
$cshow :: DeregisterInstance -> String
showsPrec :: Int -> DeregisterInstance -> ShowS
$cshowsPrec :: Int -> DeregisterInstance -> ShowS
Prelude.Show, (forall x. DeregisterInstance -> Rep DeregisterInstance x)
-> (forall x. Rep DeregisterInstance x -> DeregisterInstance)
-> Generic DeregisterInstance
forall x. Rep DeregisterInstance x -> DeregisterInstance
forall x. DeregisterInstance -> Rep DeregisterInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterInstance x -> DeregisterInstance
$cfrom :: forall x. DeregisterInstance -> Rep DeregisterInstance x
Prelude.Generic)
newDeregisterInstance ::
Prelude.Text ->
Prelude.Text ->
DeregisterInstance
newDeregisterInstance :: Text -> Text -> DeregisterInstance
newDeregisterInstance Text
pServiceId_ Text
pInstanceId_ =
DeregisterInstance' :: Text -> Text -> DeregisterInstance
DeregisterInstance'
{ $sel:serviceId:DeregisterInstance' :: Text
serviceId = Text
pServiceId_,
$sel:instanceId:DeregisterInstance' :: Text
instanceId = Text
pInstanceId_
}
deregisterInstance_serviceId :: Lens.Lens' DeregisterInstance Prelude.Text
deregisterInstance_serviceId :: (Text -> f Text) -> DeregisterInstance -> f DeregisterInstance
deregisterInstance_serviceId = (DeregisterInstance -> Text)
-> (DeregisterInstance -> Text -> DeregisterInstance)
-> Lens DeregisterInstance DeregisterInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterInstance' {Text
serviceId :: Text
$sel:serviceId:DeregisterInstance' :: DeregisterInstance -> Text
serviceId} -> Text
serviceId) (\s :: DeregisterInstance
s@DeregisterInstance' {} Text
a -> DeregisterInstance
s {$sel:serviceId:DeregisterInstance' :: Text
serviceId = Text
a} :: DeregisterInstance)
deregisterInstance_instanceId :: Lens.Lens' DeregisterInstance Prelude.Text
deregisterInstance_instanceId :: (Text -> f Text) -> DeregisterInstance -> f DeregisterInstance
deregisterInstance_instanceId = (DeregisterInstance -> Text)
-> (DeregisterInstance -> Text -> DeregisterInstance)
-> Lens DeregisterInstance DeregisterInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterInstance' {Text
instanceId :: Text
$sel:instanceId:DeregisterInstance' :: DeregisterInstance -> Text
instanceId} -> Text
instanceId) (\s :: DeregisterInstance
s@DeregisterInstance' {} Text
a -> DeregisterInstance
s {$sel:instanceId:DeregisterInstance' :: Text
instanceId = Text
a} :: DeregisterInstance)
instance Core.AWSRequest DeregisterInstance where
type
AWSResponse DeregisterInstance =
DeregisterInstanceResponse
request :: DeregisterInstance -> Request DeregisterInstance
request = Service -> DeregisterInstance -> Request DeregisterInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeregisterInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeregisterInstance))
-> Logger
-> Service
-> Proxy DeregisterInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterInstance)))
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 -> DeregisterInstanceResponse
DeregisterInstanceResponse'
(Maybe Text -> Int -> DeregisterInstanceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeregisterInstanceResponse)
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
"OperationId")
Either String (Int -> DeregisterInstanceResponse)
-> Either String Int -> Either String DeregisterInstanceResponse
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 DeregisterInstance
instance Prelude.NFData DeregisterInstance
instance Core.ToHeaders DeregisterInstance where
toHeaders :: DeregisterInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeregisterInstance -> 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
"Route53AutoNaming_v20170314.DeregisterInstance" ::
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 DeregisterInstance where
toJSON :: DeregisterInstance -> Value
toJSON DeregisterInstance' {Text
instanceId :: Text
serviceId :: Text
$sel:instanceId:DeregisterInstance' :: DeregisterInstance -> Text
$sel:serviceId:DeregisterInstance' :: DeregisterInstance -> 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
"ServiceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId)
]
)
instance Core.ToPath DeregisterInstance where
toPath :: DeregisterInstance -> ByteString
toPath = ByteString -> DeregisterInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeregisterInstance where
toQuery :: DeregisterInstance -> QueryString
toQuery = QueryString -> DeregisterInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeregisterInstanceResponse = DeregisterInstanceResponse'
{
DeregisterInstanceResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
DeregisterInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool
(DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool)
-> (DeregisterInstanceResponse
-> DeregisterInstanceResponse -> Bool)
-> Eq DeregisterInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool
$c/= :: DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool
== :: DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool
$c== :: DeregisterInstanceResponse -> DeregisterInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterInstanceResponse]
ReadPrec DeregisterInstanceResponse
Int -> ReadS DeregisterInstanceResponse
ReadS [DeregisterInstanceResponse]
(Int -> ReadS DeregisterInstanceResponse)
-> ReadS [DeregisterInstanceResponse]
-> ReadPrec DeregisterInstanceResponse
-> ReadPrec [DeregisterInstanceResponse]
-> Read DeregisterInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterInstanceResponse]
$creadListPrec :: ReadPrec [DeregisterInstanceResponse]
readPrec :: ReadPrec DeregisterInstanceResponse
$creadPrec :: ReadPrec DeregisterInstanceResponse
readList :: ReadS [DeregisterInstanceResponse]
$creadList :: ReadS [DeregisterInstanceResponse]
readsPrec :: Int -> ReadS DeregisterInstanceResponse
$creadsPrec :: Int -> ReadS DeregisterInstanceResponse
Prelude.Read, Int -> DeregisterInstanceResponse -> ShowS
[DeregisterInstanceResponse] -> ShowS
DeregisterInstanceResponse -> String
(Int -> DeregisterInstanceResponse -> ShowS)
-> (DeregisterInstanceResponse -> String)
-> ([DeregisterInstanceResponse] -> ShowS)
-> Show DeregisterInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterInstanceResponse] -> ShowS
$cshowList :: [DeregisterInstanceResponse] -> ShowS
show :: DeregisterInstanceResponse -> String
$cshow :: DeregisterInstanceResponse -> String
showsPrec :: Int -> DeregisterInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeregisterInstanceResponse -> ShowS
Prelude.Show, (forall x.
DeregisterInstanceResponse -> Rep DeregisterInstanceResponse x)
-> (forall x.
Rep DeregisterInstanceResponse x -> DeregisterInstanceResponse)
-> Generic DeregisterInstanceResponse
forall x.
Rep DeregisterInstanceResponse x -> DeregisterInstanceResponse
forall x.
DeregisterInstanceResponse -> Rep DeregisterInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterInstanceResponse x -> DeregisterInstanceResponse
$cfrom :: forall x.
DeregisterInstanceResponse -> Rep DeregisterInstanceResponse x
Prelude.Generic)
newDeregisterInstanceResponse ::
Prelude.Int ->
DeregisterInstanceResponse
newDeregisterInstanceResponse :: Int -> DeregisterInstanceResponse
newDeregisterInstanceResponse Int
pHttpStatus_ =
DeregisterInstanceResponse' :: Maybe Text -> Int -> DeregisterInstanceResponse
DeregisterInstanceResponse'
{ $sel:operationId:DeregisterInstanceResponse' :: Maybe Text
operationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeregisterInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deregisterInstanceResponse_operationId :: Lens.Lens' DeregisterInstanceResponse (Prelude.Maybe Prelude.Text)
deregisterInstanceResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> DeregisterInstanceResponse -> f DeregisterInstanceResponse
deregisterInstanceResponse_operationId = (DeregisterInstanceResponse -> Maybe Text)
-> (DeregisterInstanceResponse
-> Maybe Text -> DeregisterInstanceResponse)
-> Lens
DeregisterInstanceResponse
DeregisterInstanceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterInstanceResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:DeregisterInstanceResponse' :: DeregisterInstanceResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: DeregisterInstanceResponse
s@DeregisterInstanceResponse' {} Maybe Text
a -> DeregisterInstanceResponse
s {$sel:operationId:DeregisterInstanceResponse' :: Maybe Text
operationId = Maybe Text
a} :: DeregisterInstanceResponse)
deregisterInstanceResponse_httpStatus :: Lens.Lens' DeregisterInstanceResponse Prelude.Int
deregisterInstanceResponse_httpStatus :: (Int -> f Int)
-> DeregisterInstanceResponse -> f DeregisterInstanceResponse
deregisterInstanceResponse_httpStatus = (DeregisterInstanceResponse -> Int)
-> (DeregisterInstanceResponse
-> Int -> DeregisterInstanceResponse)
-> Lens
DeregisterInstanceResponse DeregisterInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeregisterInstanceResponse' :: DeregisterInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeregisterInstanceResponse
s@DeregisterInstanceResponse' {} Int
a -> DeregisterInstanceResponse
s {$sel:httpStatus:DeregisterInstanceResponse' :: Int
httpStatus = Int
a} :: DeregisterInstanceResponse)
instance Prelude.NFData DeregisterInstanceResponse