{-# 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.GetInstanceSnapshots
(
GetInstanceSnapshots (..),
newGetInstanceSnapshots,
getInstanceSnapshots_pageToken,
GetInstanceSnapshotsResponse (..),
newGetInstanceSnapshotsResponse,
getInstanceSnapshotsResponse_instanceSnapshots,
getInstanceSnapshotsResponse_nextPageToken,
getInstanceSnapshotsResponse_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 GetInstanceSnapshots = GetInstanceSnapshots'
{
GetInstanceSnapshots -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (GetInstanceSnapshots -> GetInstanceSnapshots -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceSnapshots -> GetInstanceSnapshots -> Bool
$c/= :: GetInstanceSnapshots -> GetInstanceSnapshots -> Bool
== :: GetInstanceSnapshots -> GetInstanceSnapshots -> Bool
$c== :: GetInstanceSnapshots -> GetInstanceSnapshots -> Bool
Prelude.Eq, ReadPrec [GetInstanceSnapshots]
ReadPrec GetInstanceSnapshots
Int -> ReadS GetInstanceSnapshots
ReadS [GetInstanceSnapshots]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceSnapshots]
$creadListPrec :: ReadPrec [GetInstanceSnapshots]
readPrec :: ReadPrec GetInstanceSnapshots
$creadPrec :: ReadPrec GetInstanceSnapshots
readList :: ReadS [GetInstanceSnapshots]
$creadList :: ReadS [GetInstanceSnapshots]
readsPrec :: Int -> ReadS GetInstanceSnapshots
$creadsPrec :: Int -> ReadS GetInstanceSnapshots
Prelude.Read, Int -> GetInstanceSnapshots -> ShowS
[GetInstanceSnapshots] -> ShowS
GetInstanceSnapshots -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceSnapshots] -> ShowS
$cshowList :: [GetInstanceSnapshots] -> ShowS
show :: GetInstanceSnapshots -> String
$cshow :: GetInstanceSnapshots -> String
showsPrec :: Int -> GetInstanceSnapshots -> ShowS
$cshowsPrec :: Int -> GetInstanceSnapshots -> ShowS
Prelude.Show, forall x. Rep GetInstanceSnapshots x -> GetInstanceSnapshots
forall x. GetInstanceSnapshots -> Rep GetInstanceSnapshots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInstanceSnapshots x -> GetInstanceSnapshots
$cfrom :: forall x. GetInstanceSnapshots -> Rep GetInstanceSnapshots x
Prelude.Generic)
newGetInstanceSnapshots ::
GetInstanceSnapshots
newGetInstanceSnapshots :: GetInstanceSnapshots
newGetInstanceSnapshots =
GetInstanceSnapshots' {$sel:pageToken:GetInstanceSnapshots' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing}
getInstanceSnapshots_pageToken :: Lens.Lens' GetInstanceSnapshots (Prelude.Maybe Prelude.Text)
getInstanceSnapshots_pageToken :: Lens' GetInstanceSnapshots (Maybe Text)
getInstanceSnapshots_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceSnapshots' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetInstanceSnapshots' :: GetInstanceSnapshots -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetInstanceSnapshots
s@GetInstanceSnapshots' {} Maybe Text
a -> GetInstanceSnapshots
s {$sel:pageToken:GetInstanceSnapshots' :: Maybe Text
pageToken = Maybe Text
a} :: GetInstanceSnapshots)
instance Core.AWSPager GetInstanceSnapshots where
page :: GetInstanceSnapshots
-> AWSResponse GetInstanceSnapshots -> Maybe GetInstanceSnapshots
page GetInstanceSnapshots
rq AWSResponse GetInstanceSnapshots
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetInstanceSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetInstanceSnapshotsResponse (Maybe Text)
getInstanceSnapshotsResponse_nextPageToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetInstanceSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetInstanceSnapshotsResponse (Maybe [InstanceSnapshot])
getInstanceSnapshotsResponse_instanceSnapshots
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetInstanceSnapshots
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetInstanceSnapshots (Maybe Text)
getInstanceSnapshots_pageToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetInstanceSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetInstanceSnapshotsResponse (Maybe Text)
getInstanceSnapshotsResponse_nextPageToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetInstanceSnapshots where
type
AWSResponse GetInstanceSnapshots =
GetInstanceSnapshotsResponse
request :: (Service -> Service)
-> GetInstanceSnapshots -> Request GetInstanceSnapshots
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 GetInstanceSnapshots
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceSnapshots)))
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 [InstanceSnapshot]
-> Maybe Text -> Int -> GetInstanceSnapshotsResponse
GetInstanceSnapshotsResponse'
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
"instanceSnapshots"
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextPageToken")
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 GetInstanceSnapshots where
hashWithSalt :: Int -> GetInstanceSnapshots -> Int
hashWithSalt Int
_salt GetInstanceSnapshots' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetInstanceSnapshots' :: GetInstanceSnapshots -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
instance Prelude.NFData GetInstanceSnapshots where
rnf :: GetInstanceSnapshots -> ()
rnf GetInstanceSnapshots' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetInstanceSnapshots' :: GetInstanceSnapshots -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
instance Data.ToHeaders GetInstanceSnapshots where
toHeaders :: GetInstanceSnapshots -> 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.GetInstanceSnapshots" ::
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 GetInstanceSnapshots where
toJSON :: GetInstanceSnapshots -> Value
toJSON GetInstanceSnapshots' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetInstanceSnapshots' :: GetInstanceSnapshots -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"pageToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken]
)
instance Data.ToPath GetInstanceSnapshots where
toPath :: GetInstanceSnapshots -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetInstanceSnapshots where
toQuery :: GetInstanceSnapshots -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetInstanceSnapshotsResponse = GetInstanceSnapshotsResponse'
{
GetInstanceSnapshotsResponse -> Maybe [InstanceSnapshot]
instanceSnapshots :: Prelude.Maybe [InstanceSnapshot],
GetInstanceSnapshotsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetInstanceSnapshotsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInstanceSnapshotsResponse
-> GetInstanceSnapshotsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceSnapshotsResponse
-> GetInstanceSnapshotsResponse -> Bool
$c/= :: GetInstanceSnapshotsResponse
-> GetInstanceSnapshotsResponse -> Bool
== :: GetInstanceSnapshotsResponse
-> GetInstanceSnapshotsResponse -> Bool
$c== :: GetInstanceSnapshotsResponse
-> GetInstanceSnapshotsResponse -> Bool
Prelude.Eq, ReadPrec [GetInstanceSnapshotsResponse]
ReadPrec GetInstanceSnapshotsResponse
Int -> ReadS GetInstanceSnapshotsResponse
ReadS [GetInstanceSnapshotsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceSnapshotsResponse]
$creadListPrec :: ReadPrec [GetInstanceSnapshotsResponse]
readPrec :: ReadPrec GetInstanceSnapshotsResponse
$creadPrec :: ReadPrec GetInstanceSnapshotsResponse
readList :: ReadS [GetInstanceSnapshotsResponse]
$creadList :: ReadS [GetInstanceSnapshotsResponse]
readsPrec :: Int -> ReadS GetInstanceSnapshotsResponse
$creadsPrec :: Int -> ReadS GetInstanceSnapshotsResponse
Prelude.Read, Int -> GetInstanceSnapshotsResponse -> ShowS
[GetInstanceSnapshotsResponse] -> ShowS
GetInstanceSnapshotsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceSnapshotsResponse] -> ShowS
$cshowList :: [GetInstanceSnapshotsResponse] -> ShowS
show :: GetInstanceSnapshotsResponse -> String
$cshow :: GetInstanceSnapshotsResponse -> String
showsPrec :: Int -> GetInstanceSnapshotsResponse -> ShowS
$cshowsPrec :: Int -> GetInstanceSnapshotsResponse -> ShowS
Prelude.Show, forall x.
Rep GetInstanceSnapshotsResponse x -> GetInstanceSnapshotsResponse
forall x.
GetInstanceSnapshotsResponse -> Rep GetInstanceSnapshotsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceSnapshotsResponse x -> GetInstanceSnapshotsResponse
$cfrom :: forall x.
GetInstanceSnapshotsResponse -> Rep GetInstanceSnapshotsResponse x
Prelude.Generic)
newGetInstanceSnapshotsResponse ::
Prelude.Int ->
GetInstanceSnapshotsResponse
newGetInstanceSnapshotsResponse :: Int -> GetInstanceSnapshotsResponse
newGetInstanceSnapshotsResponse Int
pHttpStatus_ =
GetInstanceSnapshotsResponse'
{ $sel:instanceSnapshots:GetInstanceSnapshotsResponse' :: Maybe [InstanceSnapshot]
instanceSnapshots =
forall a. Maybe a
Prelude.Nothing,
$sel:nextPageToken:GetInstanceSnapshotsResponse' :: Maybe Text
nextPageToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInstanceSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInstanceSnapshotsResponse_instanceSnapshots :: Lens.Lens' GetInstanceSnapshotsResponse (Prelude.Maybe [InstanceSnapshot])
getInstanceSnapshotsResponse_instanceSnapshots :: Lens' GetInstanceSnapshotsResponse (Maybe [InstanceSnapshot])
getInstanceSnapshotsResponse_instanceSnapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceSnapshotsResponse' {Maybe [InstanceSnapshot]
instanceSnapshots :: Maybe [InstanceSnapshot]
$sel:instanceSnapshots:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Maybe [InstanceSnapshot]
instanceSnapshots} -> Maybe [InstanceSnapshot]
instanceSnapshots) (\s :: GetInstanceSnapshotsResponse
s@GetInstanceSnapshotsResponse' {} Maybe [InstanceSnapshot]
a -> GetInstanceSnapshotsResponse
s {$sel:instanceSnapshots:GetInstanceSnapshotsResponse' :: Maybe [InstanceSnapshot]
instanceSnapshots = Maybe [InstanceSnapshot]
a} :: GetInstanceSnapshotsResponse) 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
getInstanceSnapshotsResponse_nextPageToken :: Lens.Lens' GetInstanceSnapshotsResponse (Prelude.Maybe Prelude.Text)
getInstanceSnapshotsResponse_nextPageToken :: Lens' GetInstanceSnapshotsResponse (Maybe Text)
getInstanceSnapshotsResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceSnapshotsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetInstanceSnapshotsResponse
s@GetInstanceSnapshotsResponse' {} Maybe Text
a -> GetInstanceSnapshotsResponse
s {$sel:nextPageToken:GetInstanceSnapshotsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetInstanceSnapshotsResponse)
getInstanceSnapshotsResponse_httpStatus :: Lens.Lens' GetInstanceSnapshotsResponse Prelude.Int
getInstanceSnapshotsResponse_httpStatus :: Lens' GetInstanceSnapshotsResponse Int
getInstanceSnapshotsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceSnapshotsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInstanceSnapshotsResponse
s@GetInstanceSnapshotsResponse' {} Int
a -> GetInstanceSnapshotsResponse
s {$sel:httpStatus:GetInstanceSnapshotsResponse' :: Int
httpStatus = Int
a} :: GetInstanceSnapshotsResponse)
instance Prelude.NFData GetInstanceSnapshotsResponse where
rnf :: GetInstanceSnapshotsResponse -> ()
rnf GetInstanceSnapshotsResponse' {Int
Maybe [InstanceSnapshot]
Maybe Text
httpStatus :: Int
nextPageToken :: Maybe Text
instanceSnapshots :: Maybe [InstanceSnapshot]
$sel:httpStatus:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Int
$sel:nextPageToken:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Maybe Text
$sel:instanceSnapshots:GetInstanceSnapshotsResponse' :: GetInstanceSnapshotsResponse -> Maybe [InstanceSnapshot]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [InstanceSnapshot]
instanceSnapshots
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus