{-# 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.DeleteInstance
(
DeleteInstance (..),
newDeleteInstance,
deleteInstance_forceDeleteAddOns,
deleteInstance_instanceName,
DeleteInstanceResponse (..),
newDeleteInstanceResponse,
deleteInstanceResponse_operations,
deleteInstanceResponse_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 DeleteInstance = DeleteInstance'
{
DeleteInstance -> Maybe Bool
forceDeleteAddOns :: Prelude.Maybe Prelude.Bool,
DeleteInstance -> Text
instanceName :: Prelude.Text
}
deriving (DeleteInstance -> DeleteInstance -> Bool
(DeleteInstance -> DeleteInstance -> Bool)
-> (DeleteInstance -> DeleteInstance -> Bool) -> Eq DeleteInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInstance -> DeleteInstance -> Bool
$c/= :: DeleteInstance -> DeleteInstance -> Bool
== :: DeleteInstance -> DeleteInstance -> Bool
$c== :: DeleteInstance -> DeleteInstance -> Bool
Prelude.Eq, ReadPrec [DeleteInstance]
ReadPrec DeleteInstance
Int -> ReadS DeleteInstance
ReadS [DeleteInstance]
(Int -> ReadS DeleteInstance)
-> ReadS [DeleteInstance]
-> ReadPrec DeleteInstance
-> ReadPrec [DeleteInstance]
-> Read DeleteInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInstance]
$creadListPrec :: ReadPrec [DeleteInstance]
readPrec :: ReadPrec DeleteInstance
$creadPrec :: ReadPrec DeleteInstance
readList :: ReadS [DeleteInstance]
$creadList :: ReadS [DeleteInstance]
readsPrec :: Int -> ReadS DeleteInstance
$creadsPrec :: Int -> ReadS DeleteInstance
Prelude.Read, Int -> DeleteInstance -> ShowS
[DeleteInstance] -> ShowS
DeleteInstance -> String
(Int -> DeleteInstance -> ShowS)
-> (DeleteInstance -> String)
-> ([DeleteInstance] -> ShowS)
-> Show DeleteInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInstance] -> ShowS
$cshowList :: [DeleteInstance] -> ShowS
show :: DeleteInstance -> String
$cshow :: DeleteInstance -> String
showsPrec :: Int -> DeleteInstance -> ShowS
$cshowsPrec :: Int -> DeleteInstance -> ShowS
Prelude.Show, (forall x. DeleteInstance -> Rep DeleteInstance x)
-> (forall x. Rep DeleteInstance x -> DeleteInstance)
-> Generic DeleteInstance
forall x. Rep DeleteInstance x -> DeleteInstance
forall x. DeleteInstance -> Rep DeleteInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteInstance x -> DeleteInstance
$cfrom :: forall x. DeleteInstance -> Rep DeleteInstance x
Prelude.Generic)
newDeleteInstance ::
Prelude.Text ->
DeleteInstance
newDeleteInstance :: Text -> DeleteInstance
newDeleteInstance Text
pInstanceName_ =
DeleteInstance' :: Maybe Bool -> Text -> DeleteInstance
DeleteInstance'
{ $sel:forceDeleteAddOns:DeleteInstance' :: Maybe Bool
forceDeleteAddOns =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:instanceName:DeleteInstance' :: Text
instanceName = Text
pInstanceName_
}
deleteInstance_forceDeleteAddOns :: Lens.Lens' DeleteInstance (Prelude.Maybe Prelude.Bool)
deleteInstance_forceDeleteAddOns :: (Maybe Bool -> f (Maybe Bool))
-> DeleteInstance -> f DeleteInstance
deleteInstance_forceDeleteAddOns = (DeleteInstance -> Maybe Bool)
-> (DeleteInstance -> Maybe Bool -> DeleteInstance)
-> Lens DeleteInstance DeleteInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstance' {Maybe Bool
forceDeleteAddOns :: Maybe Bool
$sel:forceDeleteAddOns:DeleteInstance' :: DeleteInstance -> Maybe Bool
forceDeleteAddOns} -> Maybe Bool
forceDeleteAddOns) (\s :: DeleteInstance
s@DeleteInstance' {} Maybe Bool
a -> DeleteInstance
s {$sel:forceDeleteAddOns:DeleteInstance' :: Maybe Bool
forceDeleteAddOns = Maybe Bool
a} :: DeleteInstance)
deleteInstance_instanceName :: Lens.Lens' DeleteInstance Prelude.Text
deleteInstance_instanceName :: (Text -> f Text) -> DeleteInstance -> f DeleteInstance
deleteInstance_instanceName = (DeleteInstance -> Text)
-> (DeleteInstance -> Text -> DeleteInstance)
-> Lens DeleteInstance DeleteInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstance' {Text
instanceName :: Text
$sel:instanceName:DeleteInstance' :: DeleteInstance -> Text
instanceName} -> Text
instanceName) (\s :: DeleteInstance
s@DeleteInstance' {} Text
a -> DeleteInstance
s {$sel:instanceName:DeleteInstance' :: Text
instanceName = Text
a} :: DeleteInstance)
instance Core.AWSRequest DeleteInstance where
type
AWSResponse DeleteInstance =
DeleteInstanceResponse
request :: DeleteInstance -> Request DeleteInstance
request = Service -> DeleteInstance -> Request DeleteInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteInstance))
-> Logger
-> Service
-> Proxy DeleteInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteInstance)))
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 -> DeleteInstanceResponse
DeleteInstanceResponse'
(Maybe [Operation] -> Int -> DeleteInstanceResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> DeleteInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DeleteInstanceResponse)
-> Either String Int -> Either String DeleteInstanceResponse
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 DeleteInstance
instance Prelude.NFData DeleteInstance
instance Core.ToHeaders DeleteInstance where
toHeaders :: DeleteInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteInstance -> 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.DeleteInstance" ::
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 DeleteInstance where
toJSON :: DeleteInstance -> Value
toJSON DeleteInstance' {Maybe Bool
Text
instanceName :: Text
forceDeleteAddOns :: Maybe Bool
$sel:instanceName:DeleteInstance' :: DeleteInstance -> Text
$sel:forceDeleteAddOns:DeleteInstance' :: DeleteInstance -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"forceDeleteAddOns" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceDeleteAddOns,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceName)
]
)
instance Core.ToPath DeleteInstance where
toPath :: DeleteInstance -> ByteString
toPath = ByteString -> DeleteInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteInstance where
toQuery :: DeleteInstance -> QueryString
toQuery = QueryString -> DeleteInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteInstanceResponse = DeleteInstanceResponse'
{
DeleteInstanceResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DeleteInstanceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteInstanceResponse -> DeleteInstanceResponse -> Bool
(DeleteInstanceResponse -> DeleteInstanceResponse -> Bool)
-> (DeleteInstanceResponse -> DeleteInstanceResponse -> Bool)
-> Eq DeleteInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInstanceResponse -> DeleteInstanceResponse -> Bool
$c/= :: DeleteInstanceResponse -> DeleteInstanceResponse -> Bool
== :: DeleteInstanceResponse -> DeleteInstanceResponse -> Bool
$c== :: DeleteInstanceResponse -> DeleteInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteInstanceResponse]
ReadPrec DeleteInstanceResponse
Int -> ReadS DeleteInstanceResponse
ReadS [DeleteInstanceResponse]
(Int -> ReadS DeleteInstanceResponse)
-> ReadS [DeleteInstanceResponse]
-> ReadPrec DeleteInstanceResponse
-> ReadPrec [DeleteInstanceResponse]
-> Read DeleteInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInstanceResponse]
$creadListPrec :: ReadPrec [DeleteInstanceResponse]
readPrec :: ReadPrec DeleteInstanceResponse
$creadPrec :: ReadPrec DeleteInstanceResponse
readList :: ReadS [DeleteInstanceResponse]
$creadList :: ReadS [DeleteInstanceResponse]
readsPrec :: Int -> ReadS DeleteInstanceResponse
$creadsPrec :: Int -> ReadS DeleteInstanceResponse
Prelude.Read, Int -> DeleteInstanceResponse -> ShowS
[DeleteInstanceResponse] -> ShowS
DeleteInstanceResponse -> String
(Int -> DeleteInstanceResponse -> ShowS)
-> (DeleteInstanceResponse -> String)
-> ([DeleteInstanceResponse] -> ShowS)
-> Show DeleteInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInstanceResponse] -> ShowS
$cshowList :: [DeleteInstanceResponse] -> ShowS
show :: DeleteInstanceResponse -> String
$cshow :: DeleteInstanceResponse -> String
showsPrec :: Int -> DeleteInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeleteInstanceResponse -> ShowS
Prelude.Show, (forall x. DeleteInstanceResponse -> Rep DeleteInstanceResponse x)
-> (forall x.
Rep DeleteInstanceResponse x -> DeleteInstanceResponse)
-> Generic DeleteInstanceResponse
forall x. Rep DeleteInstanceResponse x -> DeleteInstanceResponse
forall x. DeleteInstanceResponse -> Rep DeleteInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteInstanceResponse x -> DeleteInstanceResponse
$cfrom :: forall x. DeleteInstanceResponse -> Rep DeleteInstanceResponse x
Prelude.Generic)
newDeleteInstanceResponse ::
Prelude.Int ->
DeleteInstanceResponse
newDeleteInstanceResponse :: Int -> DeleteInstanceResponse
newDeleteInstanceResponse Int
pHttpStatus_ =
DeleteInstanceResponse' :: Maybe [Operation] -> Int -> DeleteInstanceResponse
DeleteInstanceResponse'
{ $sel:operations:DeleteInstanceResponse' :: Maybe [Operation]
operations =
Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteInstanceResponse_operations :: Lens.Lens' DeleteInstanceResponse (Prelude.Maybe [Operation])
deleteInstanceResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteInstanceResponse -> f DeleteInstanceResponse
deleteInstanceResponse_operations = (DeleteInstanceResponse -> Maybe [Operation])
-> (DeleteInstanceResponse
-> Maybe [Operation] -> DeleteInstanceResponse)
-> Lens
DeleteInstanceResponse
DeleteInstanceResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstanceResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DeleteInstanceResponse' :: DeleteInstanceResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DeleteInstanceResponse
s@DeleteInstanceResponse' {} Maybe [Operation]
a -> DeleteInstanceResponse
s {$sel:operations:DeleteInstanceResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DeleteInstanceResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteInstanceResponse -> f DeleteInstanceResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteInstanceResponse
-> f DeleteInstanceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
deleteInstanceResponse_httpStatus :: Lens.Lens' DeleteInstanceResponse Prelude.Int
deleteInstanceResponse_httpStatus :: (Int -> f Int)
-> DeleteInstanceResponse -> f DeleteInstanceResponse
deleteInstanceResponse_httpStatus = (DeleteInstanceResponse -> Int)
-> (DeleteInstanceResponse -> Int -> DeleteInstanceResponse)
-> Lens DeleteInstanceResponse DeleteInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteInstanceResponse' :: DeleteInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteInstanceResponse
s@DeleteInstanceResponse' {} Int
a -> DeleteInstanceResponse
s {$sel:httpStatus:DeleteInstanceResponse' :: Int
httpStatus = Int
a} :: DeleteInstanceResponse)
instance Prelude.NFData DeleteInstanceResponse