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