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