{-# 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.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 ExportSnapshot = ExportSnapshot'
{
ExportSnapshot -> Text
sourceSnapshotName :: Prelude.Text
}
deriving (ExportSnapshot -> ExportSnapshot -> Bool
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]
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
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. 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'
{ $sel:sourceSnapshotName:ExportSnapshot' :: Text
sourceSnapshotName =
Text
pSourceSnapshotName_
}
exportSnapshot_sourceSnapshotName :: Lens.Lens' ExportSnapshot Prelude.Text
exportSnapshot_sourceSnapshotName :: Lens' ExportSnapshot Text
exportSnapshot_sourceSnapshotName = 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 :: (Service -> Service) -> ExportSnapshot -> Request ExportSnapshot
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 ExportSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ExportSnapshot)))
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 -> ExportSnapshotResponse
ExportSnapshotResponse'
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 ExportSnapshot where
hashWithSalt :: Int -> ExportSnapshot -> Int
hashWithSalt Int
_salt ExportSnapshot' {Text
sourceSnapshotName :: Text
$sel:sourceSnapshotName:ExportSnapshot' :: ExportSnapshot -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceSnapshotName
instance Prelude.NFData ExportSnapshot where
rnf :: ExportSnapshot -> ()
rnf ExportSnapshot' {Text
sourceSnapshotName :: Text
$sel:sourceSnapshotName:ExportSnapshot' :: ExportSnapshot -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
sourceSnapshotName
instance Data.ToHeaders ExportSnapshot where
toHeaders :: ExportSnapshot -> 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.ExportSnapshot" ::
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 ExportSnapshot where
toJSON :: ExportSnapshot -> Value
toJSON ExportSnapshot' {Text
sourceSnapshotName :: Text
$sel:sourceSnapshotName:ExportSnapshot' :: ExportSnapshot -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"sourceSnapshotName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceSnapshotName)
]
)
instance Data.ToPath ExportSnapshot where
toPath :: ExportSnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ExportSnapshot where
toQuery :: ExportSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:operations:ExportSnapshotResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ExportSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
exportSnapshotResponse_operations :: Lens.Lens' ExportSnapshotResponse (Prelude.Maybe [Operation])
exportSnapshotResponse_operations :: Lens' ExportSnapshotResponse (Maybe [Operation])
exportSnapshotResponse_operations = 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) 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
exportSnapshotResponse_httpStatus :: Lens.Lens' ExportSnapshotResponse Prelude.Int
exportSnapshotResponse_httpStatus :: Lens' ExportSnapshotResponse Int
exportSnapshotResponse_httpStatus = 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 where
rnf :: ExportSnapshotResponse -> ()
rnf ExportSnapshotResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:ExportSnapshotResponse' :: ExportSnapshotResponse -> Int
$sel:operations:ExportSnapshotResponse' :: ExportSnapshotResponse -> 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