{-# 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.DetachDisk
(
DetachDisk (..),
newDetachDisk,
detachDisk_diskName,
DetachDiskResponse (..),
newDetachDiskResponse,
detachDiskResponse_operations,
detachDiskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DetachDisk = DetachDisk'
{
DetachDisk -> Text
diskName :: Prelude.Text
}
deriving (DetachDisk -> DetachDisk -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachDisk -> DetachDisk -> Bool
$c/= :: DetachDisk -> DetachDisk -> Bool
== :: DetachDisk -> DetachDisk -> Bool
$c== :: DetachDisk -> DetachDisk -> Bool
Prelude.Eq, ReadPrec [DetachDisk]
ReadPrec DetachDisk
Int -> ReadS DetachDisk
ReadS [DetachDisk]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachDisk]
$creadListPrec :: ReadPrec [DetachDisk]
readPrec :: ReadPrec DetachDisk
$creadPrec :: ReadPrec DetachDisk
readList :: ReadS [DetachDisk]
$creadList :: ReadS [DetachDisk]
readsPrec :: Int -> ReadS DetachDisk
$creadsPrec :: Int -> ReadS DetachDisk
Prelude.Read, Int -> DetachDisk -> ShowS
[DetachDisk] -> ShowS
DetachDisk -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachDisk] -> ShowS
$cshowList :: [DetachDisk] -> ShowS
show :: DetachDisk -> String
$cshow :: DetachDisk -> String
showsPrec :: Int -> DetachDisk -> ShowS
$cshowsPrec :: Int -> DetachDisk -> ShowS
Prelude.Show, forall x. Rep DetachDisk x -> DetachDisk
forall x. DetachDisk -> Rep DetachDisk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachDisk x -> DetachDisk
$cfrom :: forall x. DetachDisk -> Rep DetachDisk x
Prelude.Generic)
newDetachDisk ::
Prelude.Text ->
DetachDisk
newDetachDisk :: Text -> DetachDisk
newDetachDisk Text
pDiskName_ =
DetachDisk' {$sel:diskName:DetachDisk' :: Text
diskName = Text
pDiskName_}
detachDisk_diskName :: Lens.Lens' DetachDisk Prelude.Text
detachDisk_diskName :: Lens' DetachDisk Text
detachDisk_diskName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachDisk' {Text
diskName :: Text
$sel:diskName:DetachDisk' :: DetachDisk -> Text
diskName} -> Text
diskName) (\s :: DetachDisk
s@DetachDisk' {} Text
a -> DetachDisk
s {$sel:diskName:DetachDisk' :: Text
diskName = Text
a} :: DetachDisk)
instance Core.AWSRequest DetachDisk where
type AWSResponse DetachDisk = DetachDiskResponse
request :: (Service -> Service) -> DetachDisk -> Request DetachDisk
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DetachDisk
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetachDisk)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> DetachDiskResponse
DetachDiskResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DetachDisk where
hashWithSalt :: Int -> DetachDisk -> Int
hashWithSalt Int
_salt DetachDisk' {Text
diskName :: Text
$sel:diskName:DetachDisk' :: DetachDisk -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
diskName
instance Prelude.NFData DetachDisk where
rnf :: DetachDisk -> ()
rnf DetachDisk' {Text
diskName :: Text
$sel:diskName:DetachDisk' :: DetachDisk -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
diskName
instance Data.ToHeaders DetachDisk where
toHeaders :: DetachDisk -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.DetachDisk" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DetachDisk where
toJSON :: DetachDisk -> Value
toJSON DetachDisk' {Text
diskName :: Text
$sel:diskName:DetachDisk' :: DetachDisk -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"diskName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
diskName)]
)
instance Data.ToPath DetachDisk where
toPath :: DetachDisk -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DetachDisk where
toQuery :: DetachDisk -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DetachDiskResponse = DetachDiskResponse'
{
DetachDiskResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DetachDiskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetachDiskResponse -> DetachDiskResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachDiskResponse -> DetachDiskResponse -> Bool
$c/= :: DetachDiskResponse -> DetachDiskResponse -> Bool
== :: DetachDiskResponse -> DetachDiskResponse -> Bool
$c== :: DetachDiskResponse -> DetachDiskResponse -> Bool
Prelude.Eq, ReadPrec [DetachDiskResponse]
ReadPrec DetachDiskResponse
Int -> ReadS DetachDiskResponse
ReadS [DetachDiskResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachDiskResponse]
$creadListPrec :: ReadPrec [DetachDiskResponse]
readPrec :: ReadPrec DetachDiskResponse
$creadPrec :: ReadPrec DetachDiskResponse
readList :: ReadS [DetachDiskResponse]
$creadList :: ReadS [DetachDiskResponse]
readsPrec :: Int -> ReadS DetachDiskResponse
$creadsPrec :: Int -> ReadS DetachDiskResponse
Prelude.Read, Int -> DetachDiskResponse -> ShowS
[DetachDiskResponse] -> ShowS
DetachDiskResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachDiskResponse] -> ShowS
$cshowList :: [DetachDiskResponse] -> ShowS
show :: DetachDiskResponse -> String
$cshow :: DetachDiskResponse -> String
showsPrec :: Int -> DetachDiskResponse -> ShowS
$cshowsPrec :: Int -> DetachDiskResponse -> ShowS
Prelude.Show, forall x. Rep DetachDiskResponse x -> DetachDiskResponse
forall x. DetachDiskResponse -> Rep DetachDiskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachDiskResponse x -> DetachDiskResponse
$cfrom :: forall x. DetachDiskResponse -> Rep DetachDiskResponse x
Prelude.Generic)
newDetachDiskResponse ::
Prelude.Int ->
DetachDiskResponse
newDetachDiskResponse :: Int -> DetachDiskResponse
newDetachDiskResponse Int
pHttpStatus_ =
DetachDiskResponse'
{ $sel:operations:DetachDiskResponse' :: Maybe [Operation]
operations = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetachDiskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detachDiskResponse_operations :: Lens.Lens' DetachDiskResponse (Prelude.Maybe [Operation])
detachDiskResponse_operations :: Lens' DetachDiskResponse (Maybe [Operation])
detachDiskResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachDiskResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DetachDiskResponse' :: DetachDiskResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DetachDiskResponse
s@DetachDiskResponse' {} Maybe [Operation]
a -> DetachDiskResponse
s {$sel:operations:DetachDiskResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DetachDiskResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
detachDiskResponse_httpStatus :: Lens.Lens' DetachDiskResponse Prelude.Int
detachDiskResponse_httpStatus :: Lens' DetachDiskResponse Int
detachDiskResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachDiskResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetachDiskResponse' :: DetachDiskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetachDiskResponse
s@DetachDiskResponse' {} Int
a -> DetachDiskResponse
s {$sel:httpStatus:DetachDiskResponse' :: Int
httpStatus = Int
a} :: DetachDiskResponse)
instance Prelude.NFData DetachDiskResponse where
rnf :: DetachDiskResponse -> ()
rnf DetachDiskResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:DetachDiskResponse' :: DetachDiskResponse -> Int
$sel:operations:DetachDiskResponse' :: DetachDiskResponse -> Maybe [Operation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus