{-# 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.GetStaticIps
(
GetStaticIps (..),
newGetStaticIps,
getStaticIps_pageToken,
GetStaticIpsResponse (..),
newGetStaticIpsResponse,
getStaticIpsResponse_nextPageToken,
getStaticIpsResponse_staticIps,
getStaticIpsResponse_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 GetStaticIps = GetStaticIps'
{
GetStaticIps -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (GetStaticIps -> GetStaticIps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStaticIps -> GetStaticIps -> Bool
$c/= :: GetStaticIps -> GetStaticIps -> Bool
== :: GetStaticIps -> GetStaticIps -> Bool
$c== :: GetStaticIps -> GetStaticIps -> Bool
Prelude.Eq, ReadPrec [GetStaticIps]
ReadPrec GetStaticIps
Int -> ReadS GetStaticIps
ReadS [GetStaticIps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStaticIps]
$creadListPrec :: ReadPrec [GetStaticIps]
readPrec :: ReadPrec GetStaticIps
$creadPrec :: ReadPrec GetStaticIps
readList :: ReadS [GetStaticIps]
$creadList :: ReadS [GetStaticIps]
readsPrec :: Int -> ReadS GetStaticIps
$creadsPrec :: Int -> ReadS GetStaticIps
Prelude.Read, Int -> GetStaticIps -> ShowS
[GetStaticIps] -> ShowS
GetStaticIps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStaticIps] -> ShowS
$cshowList :: [GetStaticIps] -> ShowS
show :: GetStaticIps -> String
$cshow :: GetStaticIps -> String
showsPrec :: Int -> GetStaticIps -> ShowS
$cshowsPrec :: Int -> GetStaticIps -> ShowS
Prelude.Show, forall x. Rep GetStaticIps x -> GetStaticIps
forall x. GetStaticIps -> Rep GetStaticIps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStaticIps x -> GetStaticIps
$cfrom :: forall x. GetStaticIps -> Rep GetStaticIps x
Prelude.Generic)
newGetStaticIps ::
GetStaticIps
newGetStaticIps :: GetStaticIps
newGetStaticIps =
GetStaticIps' {$sel:pageToken:GetStaticIps' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing}
getStaticIps_pageToken :: Lens.Lens' GetStaticIps (Prelude.Maybe Prelude.Text)
getStaticIps_pageToken :: Lens' GetStaticIps (Maybe Text)
getStaticIps_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIps' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetStaticIps' :: GetStaticIps -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetStaticIps
s@GetStaticIps' {} Maybe Text
a -> GetStaticIps
s {$sel:pageToken:GetStaticIps' :: Maybe Text
pageToken = Maybe Text
a} :: GetStaticIps)
instance Core.AWSPager GetStaticIps where
page :: GetStaticIps -> AWSResponse GetStaticIps -> Maybe GetStaticIps
page GetStaticIps
rq AWSResponse GetStaticIps
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetStaticIps
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetStaticIpsResponse (Maybe Text)
getStaticIpsResponse_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 GetStaticIps
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetStaticIpsResponse (Maybe [StaticIp])
getStaticIpsResponse_staticIps
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.$ GetStaticIps
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetStaticIps (Maybe Text)
getStaticIps_pageToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetStaticIps
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetStaticIpsResponse (Maybe Text)
getStaticIpsResponse_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 GetStaticIps where
type AWSResponse GetStaticIps = GetStaticIpsResponse
request :: (Service -> Service) -> GetStaticIps -> Request GetStaticIps
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 GetStaticIps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStaticIps)))
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 Text -> Maybe [StaticIp] -> Int -> GetStaticIpsResponse
GetStaticIpsResponse'
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
"nextPageToken")
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
"staticIps" 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 GetStaticIps where
hashWithSalt :: Int -> GetStaticIps -> Int
hashWithSalt Int
_salt GetStaticIps' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetStaticIps' :: GetStaticIps -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
instance Prelude.NFData GetStaticIps where
rnf :: GetStaticIps -> ()
rnf GetStaticIps' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetStaticIps' :: GetStaticIps -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
instance Data.ToHeaders GetStaticIps where
toHeaders :: GetStaticIps -> 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.GetStaticIps" ::
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 GetStaticIps where
toJSON :: GetStaticIps -> Value
toJSON GetStaticIps' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetStaticIps' :: GetStaticIps -> 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 GetStaticIps where
toPath :: GetStaticIps -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetStaticIps where
toQuery :: GetStaticIps -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetStaticIpsResponse = GetStaticIpsResponse'
{
GetStaticIpsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetStaticIpsResponse -> Maybe [StaticIp]
staticIps :: Prelude.Maybe [StaticIp],
GetStaticIpsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStaticIpsResponse -> GetStaticIpsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStaticIpsResponse -> GetStaticIpsResponse -> Bool
$c/= :: GetStaticIpsResponse -> GetStaticIpsResponse -> Bool
== :: GetStaticIpsResponse -> GetStaticIpsResponse -> Bool
$c== :: GetStaticIpsResponse -> GetStaticIpsResponse -> Bool
Prelude.Eq, ReadPrec [GetStaticIpsResponse]
ReadPrec GetStaticIpsResponse
Int -> ReadS GetStaticIpsResponse
ReadS [GetStaticIpsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStaticIpsResponse]
$creadListPrec :: ReadPrec [GetStaticIpsResponse]
readPrec :: ReadPrec GetStaticIpsResponse
$creadPrec :: ReadPrec GetStaticIpsResponse
readList :: ReadS [GetStaticIpsResponse]
$creadList :: ReadS [GetStaticIpsResponse]
readsPrec :: Int -> ReadS GetStaticIpsResponse
$creadsPrec :: Int -> ReadS GetStaticIpsResponse
Prelude.Read, Int -> GetStaticIpsResponse -> ShowS
[GetStaticIpsResponse] -> ShowS
GetStaticIpsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStaticIpsResponse] -> ShowS
$cshowList :: [GetStaticIpsResponse] -> ShowS
show :: GetStaticIpsResponse -> String
$cshow :: GetStaticIpsResponse -> String
showsPrec :: Int -> GetStaticIpsResponse -> ShowS
$cshowsPrec :: Int -> GetStaticIpsResponse -> ShowS
Prelude.Show, forall x. Rep GetStaticIpsResponse x -> GetStaticIpsResponse
forall x. GetStaticIpsResponse -> Rep GetStaticIpsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStaticIpsResponse x -> GetStaticIpsResponse
$cfrom :: forall x. GetStaticIpsResponse -> Rep GetStaticIpsResponse x
Prelude.Generic)
newGetStaticIpsResponse ::
Prelude.Int ->
GetStaticIpsResponse
newGetStaticIpsResponse :: Int -> GetStaticIpsResponse
newGetStaticIpsResponse Int
pHttpStatus_ =
GetStaticIpsResponse'
{ $sel:nextPageToken:GetStaticIpsResponse' :: Maybe Text
nextPageToken =
forall a. Maybe a
Prelude.Nothing,
$sel:staticIps:GetStaticIpsResponse' :: Maybe [StaticIp]
staticIps = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStaticIpsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStaticIpsResponse_nextPageToken :: Lens.Lens' GetStaticIpsResponse (Prelude.Maybe Prelude.Text)
getStaticIpsResponse_nextPageToken :: Lens' GetStaticIpsResponse (Maybe Text)
getStaticIpsResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIpsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetStaticIpsResponse' :: GetStaticIpsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetStaticIpsResponse
s@GetStaticIpsResponse' {} Maybe Text
a -> GetStaticIpsResponse
s {$sel:nextPageToken:GetStaticIpsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetStaticIpsResponse)
getStaticIpsResponse_staticIps :: Lens.Lens' GetStaticIpsResponse (Prelude.Maybe [StaticIp])
getStaticIpsResponse_staticIps :: Lens' GetStaticIpsResponse (Maybe [StaticIp])
getStaticIpsResponse_staticIps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIpsResponse' {Maybe [StaticIp]
staticIps :: Maybe [StaticIp]
$sel:staticIps:GetStaticIpsResponse' :: GetStaticIpsResponse -> Maybe [StaticIp]
staticIps} -> Maybe [StaticIp]
staticIps) (\s :: GetStaticIpsResponse
s@GetStaticIpsResponse' {} Maybe [StaticIp]
a -> GetStaticIpsResponse
s {$sel:staticIps:GetStaticIpsResponse' :: Maybe [StaticIp]
staticIps = Maybe [StaticIp]
a} :: GetStaticIpsResponse) 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
getStaticIpsResponse_httpStatus :: Lens.Lens' GetStaticIpsResponse Prelude.Int
getStaticIpsResponse_httpStatus :: Lens' GetStaticIpsResponse Int
getStaticIpsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStaticIpsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStaticIpsResponse' :: GetStaticIpsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStaticIpsResponse
s@GetStaticIpsResponse' {} Int
a -> GetStaticIpsResponse
s {$sel:httpStatus:GetStaticIpsResponse' :: Int
httpStatus = Int
a} :: GetStaticIpsResponse)
instance Prelude.NFData GetStaticIpsResponse where
rnf :: GetStaticIpsResponse -> ()
rnf GetStaticIpsResponse' {Int
Maybe [StaticIp]
Maybe Text
httpStatus :: Int
staticIps :: Maybe [StaticIp]
nextPageToken :: Maybe Text
$sel:httpStatus:GetStaticIpsResponse' :: GetStaticIpsResponse -> Int
$sel:staticIps:GetStaticIpsResponse' :: GetStaticIpsResponse -> Maybe [StaticIp]
$sel:nextPageToken:GetStaticIpsResponse' :: GetStaticIpsResponse -> Maybe Text
..} =
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 Maybe [StaticIp]
staticIps
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus