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