{-# 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.DeleteDisk
(
DeleteDisk (..),
newDeleteDisk,
deleteDisk_forceDeleteAddOns,
deleteDisk_diskName,
DeleteDiskResponse (..),
newDeleteDiskResponse,
deleteDiskResponse_operations,
deleteDiskResponse_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 DeleteDisk = DeleteDisk'
{
DeleteDisk -> Maybe Bool
forceDeleteAddOns :: Prelude.Maybe Prelude.Bool,
DeleteDisk -> Text
diskName :: Prelude.Text
}
deriving (DeleteDisk -> DeleteDisk -> Bool
(DeleteDisk -> DeleteDisk -> Bool)
-> (DeleteDisk -> DeleteDisk -> Bool) -> Eq DeleteDisk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDisk -> DeleteDisk -> Bool
$c/= :: DeleteDisk -> DeleteDisk -> Bool
== :: DeleteDisk -> DeleteDisk -> Bool
$c== :: DeleteDisk -> DeleteDisk -> Bool
Prelude.Eq, ReadPrec [DeleteDisk]
ReadPrec DeleteDisk
Int -> ReadS DeleteDisk
ReadS [DeleteDisk]
(Int -> ReadS DeleteDisk)
-> ReadS [DeleteDisk]
-> ReadPrec DeleteDisk
-> ReadPrec [DeleteDisk]
-> Read DeleteDisk
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDisk]
$creadListPrec :: ReadPrec [DeleteDisk]
readPrec :: ReadPrec DeleteDisk
$creadPrec :: ReadPrec DeleteDisk
readList :: ReadS [DeleteDisk]
$creadList :: ReadS [DeleteDisk]
readsPrec :: Int -> ReadS DeleteDisk
$creadsPrec :: Int -> ReadS DeleteDisk
Prelude.Read, Int -> DeleteDisk -> ShowS
[DeleteDisk] -> ShowS
DeleteDisk -> String
(Int -> DeleteDisk -> ShowS)
-> (DeleteDisk -> String)
-> ([DeleteDisk] -> ShowS)
-> Show DeleteDisk
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDisk] -> ShowS
$cshowList :: [DeleteDisk] -> ShowS
show :: DeleteDisk -> String
$cshow :: DeleteDisk -> String
showsPrec :: Int -> DeleteDisk -> ShowS
$cshowsPrec :: Int -> DeleteDisk -> ShowS
Prelude.Show, (forall x. DeleteDisk -> Rep DeleteDisk x)
-> (forall x. Rep DeleteDisk x -> DeleteDisk) -> Generic DeleteDisk
forall x. Rep DeleteDisk x -> DeleteDisk
forall x. DeleteDisk -> Rep DeleteDisk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDisk x -> DeleteDisk
$cfrom :: forall x. DeleteDisk -> Rep DeleteDisk x
Prelude.Generic)
newDeleteDisk ::
Prelude.Text ->
DeleteDisk
newDeleteDisk :: Text -> DeleteDisk
newDeleteDisk Text
pDiskName_ =
DeleteDisk' :: Maybe Bool -> Text -> DeleteDisk
DeleteDisk'
{ $sel:forceDeleteAddOns:DeleteDisk' :: Maybe Bool
forceDeleteAddOns = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:diskName:DeleteDisk' :: Text
diskName = Text
pDiskName_
}
deleteDisk_forceDeleteAddOns :: Lens.Lens' DeleteDisk (Prelude.Maybe Prelude.Bool)
deleteDisk_forceDeleteAddOns :: (Maybe Bool -> f (Maybe Bool)) -> DeleteDisk -> f DeleteDisk
deleteDisk_forceDeleteAddOns = (DeleteDisk -> Maybe Bool)
-> (DeleteDisk -> Maybe Bool -> DeleteDisk)
-> Lens DeleteDisk DeleteDisk (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDisk' {Maybe Bool
forceDeleteAddOns :: Maybe Bool
$sel:forceDeleteAddOns:DeleteDisk' :: DeleteDisk -> Maybe Bool
forceDeleteAddOns} -> Maybe Bool
forceDeleteAddOns) (\s :: DeleteDisk
s@DeleteDisk' {} Maybe Bool
a -> DeleteDisk
s {$sel:forceDeleteAddOns:DeleteDisk' :: Maybe Bool
forceDeleteAddOns = Maybe Bool
a} :: DeleteDisk)
deleteDisk_diskName :: Lens.Lens' DeleteDisk Prelude.Text
deleteDisk_diskName :: (Text -> f Text) -> DeleteDisk -> f DeleteDisk
deleteDisk_diskName = (DeleteDisk -> Text)
-> (DeleteDisk -> Text -> DeleteDisk)
-> Lens DeleteDisk DeleteDisk Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDisk' {Text
diskName :: Text
$sel:diskName:DeleteDisk' :: DeleteDisk -> Text
diskName} -> Text
diskName) (\s :: DeleteDisk
s@DeleteDisk' {} Text
a -> DeleteDisk
s {$sel:diskName:DeleteDisk' :: Text
diskName = Text
a} :: DeleteDisk)
instance Core.AWSRequest DeleteDisk where
type AWSResponse DeleteDisk = DeleteDiskResponse
request :: DeleteDisk -> Request DeleteDisk
request = Service -> DeleteDisk -> Request DeleteDisk
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDisk
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDisk)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteDisk))
-> Logger
-> Service
-> Proxy DeleteDisk
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDisk)))
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 -> DeleteDiskResponse
DeleteDiskResponse'
(Maybe [Operation] -> Int -> DeleteDiskResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> DeleteDiskResponse)
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 -> DeleteDiskResponse)
-> Either String Int -> Either String DeleteDiskResponse
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 DeleteDisk
instance Prelude.NFData DeleteDisk
instance Core.ToHeaders DeleteDisk where
toHeaders :: DeleteDisk -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteDisk -> 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.DeleteDisk" ::
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 DeleteDisk where
toJSON :: DeleteDisk -> Value
toJSON DeleteDisk' {Maybe Bool
Text
diskName :: Text
forceDeleteAddOns :: Maybe Bool
$sel:diskName:DeleteDisk' :: DeleteDisk -> Text
$sel:forceDeleteAddOns:DeleteDisk' :: DeleteDisk -> 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
"diskName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
diskName)
]
)
instance Core.ToPath DeleteDisk where
toPath :: DeleteDisk -> ByteString
toPath = ByteString -> DeleteDisk -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDisk where
toQuery :: DeleteDisk -> QueryString
toQuery = QueryString -> DeleteDisk -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteDiskResponse = DeleteDiskResponse'
{
DeleteDiskResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DeleteDiskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDiskResponse -> DeleteDiskResponse -> Bool
(DeleteDiskResponse -> DeleteDiskResponse -> Bool)
-> (DeleteDiskResponse -> DeleteDiskResponse -> Bool)
-> Eq DeleteDiskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDiskResponse -> DeleteDiskResponse -> Bool
$c/= :: DeleteDiskResponse -> DeleteDiskResponse -> Bool
== :: DeleteDiskResponse -> DeleteDiskResponse -> Bool
$c== :: DeleteDiskResponse -> DeleteDiskResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDiskResponse]
ReadPrec DeleteDiskResponse
Int -> ReadS DeleteDiskResponse
ReadS [DeleteDiskResponse]
(Int -> ReadS DeleteDiskResponse)
-> ReadS [DeleteDiskResponse]
-> ReadPrec DeleteDiskResponse
-> ReadPrec [DeleteDiskResponse]
-> Read DeleteDiskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDiskResponse]
$creadListPrec :: ReadPrec [DeleteDiskResponse]
readPrec :: ReadPrec DeleteDiskResponse
$creadPrec :: ReadPrec DeleteDiskResponse
readList :: ReadS [DeleteDiskResponse]
$creadList :: ReadS [DeleteDiskResponse]
readsPrec :: Int -> ReadS DeleteDiskResponse
$creadsPrec :: Int -> ReadS DeleteDiskResponse
Prelude.Read, Int -> DeleteDiskResponse -> ShowS
[DeleteDiskResponse] -> ShowS
DeleteDiskResponse -> String
(Int -> DeleteDiskResponse -> ShowS)
-> (DeleteDiskResponse -> String)
-> ([DeleteDiskResponse] -> ShowS)
-> Show DeleteDiskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDiskResponse] -> ShowS
$cshowList :: [DeleteDiskResponse] -> ShowS
show :: DeleteDiskResponse -> String
$cshow :: DeleteDiskResponse -> String
showsPrec :: Int -> DeleteDiskResponse -> ShowS
$cshowsPrec :: Int -> DeleteDiskResponse -> ShowS
Prelude.Show, (forall x. DeleteDiskResponse -> Rep DeleteDiskResponse x)
-> (forall x. Rep DeleteDiskResponse x -> DeleteDiskResponse)
-> Generic DeleteDiskResponse
forall x. Rep DeleteDiskResponse x -> DeleteDiskResponse
forall x. DeleteDiskResponse -> Rep DeleteDiskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDiskResponse x -> DeleteDiskResponse
$cfrom :: forall x. DeleteDiskResponse -> Rep DeleteDiskResponse x
Prelude.Generic)
newDeleteDiskResponse ::
Prelude.Int ->
DeleteDiskResponse
newDeleteDiskResponse :: Int -> DeleteDiskResponse
newDeleteDiskResponse Int
pHttpStatus_ =
DeleteDiskResponse' :: Maybe [Operation] -> Int -> DeleteDiskResponse
DeleteDiskResponse'
{ $sel:operations:DeleteDiskResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteDiskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteDiskResponse_operations :: Lens.Lens' DeleteDiskResponse (Prelude.Maybe [Operation])
deleteDiskResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteDiskResponse -> f DeleteDiskResponse
deleteDiskResponse_operations = (DeleteDiskResponse -> Maybe [Operation])
-> (DeleteDiskResponse -> Maybe [Operation] -> DeleteDiskResponse)
-> Lens
DeleteDiskResponse
DeleteDiskResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDiskResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DeleteDiskResponse' :: DeleteDiskResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DeleteDiskResponse
s@DeleteDiskResponse' {} Maybe [Operation]
a -> DeleteDiskResponse
s {$sel:operations:DeleteDiskResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DeleteDiskResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteDiskResponse -> f DeleteDiskResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> DeleteDiskResponse
-> f DeleteDiskResponse
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
deleteDiskResponse_httpStatus :: Lens.Lens' DeleteDiskResponse Prelude.Int
deleteDiskResponse_httpStatus :: (Int -> f Int) -> DeleteDiskResponse -> f DeleteDiskResponse
deleteDiskResponse_httpStatus = (DeleteDiskResponse -> Int)
-> (DeleteDiskResponse -> Int -> DeleteDiskResponse)
-> Lens DeleteDiskResponse DeleteDiskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDiskResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDiskResponse' :: DeleteDiskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDiskResponse
s@DeleteDiskResponse' {} Int
a -> DeleteDiskResponse
s {$sel:httpStatus:DeleteDiskResponse' :: Int
httpStatus = Int
a} :: DeleteDiskResponse)
instance Prelude.NFData DeleteDiskResponse