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