{-# 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.GetActiveNames
(
GetActiveNames (..),
newGetActiveNames,
getActiveNames_pageToken,
GetActiveNamesResponse (..),
newGetActiveNamesResponse,
getActiveNamesResponse_nextPageToken,
getActiveNamesResponse_activeNames,
getActiveNamesResponse_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 GetActiveNames = GetActiveNames'
{
GetActiveNames -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (GetActiveNames -> GetActiveNames -> Bool
(GetActiveNames -> GetActiveNames -> Bool)
-> (GetActiveNames -> GetActiveNames -> Bool) -> Eq GetActiveNames
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetActiveNames -> GetActiveNames -> Bool
$c/= :: GetActiveNames -> GetActiveNames -> Bool
== :: GetActiveNames -> GetActiveNames -> Bool
$c== :: GetActiveNames -> GetActiveNames -> Bool
Prelude.Eq, ReadPrec [GetActiveNames]
ReadPrec GetActiveNames
Int -> ReadS GetActiveNames
ReadS [GetActiveNames]
(Int -> ReadS GetActiveNames)
-> ReadS [GetActiveNames]
-> ReadPrec GetActiveNames
-> ReadPrec [GetActiveNames]
-> Read GetActiveNames
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetActiveNames]
$creadListPrec :: ReadPrec [GetActiveNames]
readPrec :: ReadPrec GetActiveNames
$creadPrec :: ReadPrec GetActiveNames
readList :: ReadS [GetActiveNames]
$creadList :: ReadS [GetActiveNames]
readsPrec :: Int -> ReadS GetActiveNames
$creadsPrec :: Int -> ReadS GetActiveNames
Prelude.Read, Int -> GetActiveNames -> ShowS
[GetActiveNames] -> ShowS
GetActiveNames -> String
(Int -> GetActiveNames -> ShowS)
-> (GetActiveNames -> String)
-> ([GetActiveNames] -> ShowS)
-> Show GetActiveNames
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetActiveNames] -> ShowS
$cshowList :: [GetActiveNames] -> ShowS
show :: GetActiveNames -> String
$cshow :: GetActiveNames -> String
showsPrec :: Int -> GetActiveNames -> ShowS
$cshowsPrec :: Int -> GetActiveNames -> ShowS
Prelude.Show, (forall x. GetActiveNames -> Rep GetActiveNames x)
-> (forall x. Rep GetActiveNames x -> GetActiveNames)
-> Generic GetActiveNames
forall x. Rep GetActiveNames x -> GetActiveNames
forall x. GetActiveNames -> Rep GetActiveNames x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetActiveNames x -> GetActiveNames
$cfrom :: forall x. GetActiveNames -> Rep GetActiveNames x
Prelude.Generic)
newGetActiveNames ::
GetActiveNames
newGetActiveNames :: GetActiveNames
newGetActiveNames =
GetActiveNames' :: Maybe Text -> GetActiveNames
GetActiveNames' {$sel:pageToken:GetActiveNames' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
getActiveNames_pageToken :: Lens.Lens' GetActiveNames (Prelude.Maybe Prelude.Text)
getActiveNames_pageToken :: (Maybe Text -> f (Maybe Text))
-> GetActiveNames -> f GetActiveNames
getActiveNames_pageToken = (GetActiveNames -> Maybe Text)
-> (GetActiveNames -> Maybe Text -> GetActiveNames)
-> Lens GetActiveNames GetActiveNames (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActiveNames' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetActiveNames' :: GetActiveNames -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetActiveNames
s@GetActiveNames' {} Maybe Text
a -> GetActiveNames
s {$sel:pageToken:GetActiveNames' :: Maybe Text
pageToken = Maybe Text
a} :: GetActiveNames)
instance Core.AWSPager GetActiveNames where
page :: GetActiveNames
-> AWSResponse GetActiveNames -> Maybe GetActiveNames
page GetActiveNames
rq AWSResponse GetActiveNames
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetActiveNames
GetActiveNamesResponse
rs
GetActiveNamesResponse
-> Getting (First Text) GetActiveNamesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetActiveNamesResponse
-> Const (First Text) GetActiveNamesResponse
Lens' GetActiveNamesResponse (Maybe Text)
getActiveNamesResponse_nextPageToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetActiveNamesResponse
-> Const (First Text) GetActiveNamesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetActiveNamesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetActiveNames
forall a. Maybe a
Prelude.Nothing
| Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetActiveNames
GetActiveNamesResponse
rs
GetActiveNamesResponse
-> Getting (First [Text]) GetActiveNamesResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetActiveNamesResponse
-> Const (First [Text]) GetActiveNamesResponse
Lens' GetActiveNamesResponse (Maybe [Text])
getActiveNamesResponse_activeNames
((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> GetActiveNamesResponse
-> Const (First [Text]) GetActiveNamesResponse)
-> (([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) GetActiveNamesResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetActiveNames
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetActiveNames -> Maybe GetActiveNames
forall a. a -> Maybe a
Prelude.Just (GetActiveNames -> Maybe GetActiveNames)
-> GetActiveNames -> Maybe GetActiveNames
forall a b. (a -> b) -> a -> b
Prelude.$
GetActiveNames
rq
GetActiveNames
-> (GetActiveNames -> GetActiveNames) -> GetActiveNames
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetActiveNames -> Identity GetActiveNames
Lens GetActiveNames GetActiveNames (Maybe Text) (Maybe Text)
getActiveNames_pageToken
((Maybe Text -> Identity (Maybe Text))
-> GetActiveNames -> Identity GetActiveNames)
-> Maybe Text -> GetActiveNames -> GetActiveNames
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetActiveNames
GetActiveNamesResponse
rs
GetActiveNamesResponse
-> Getting (First Text) GetActiveNamesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetActiveNamesResponse
-> Const (First Text) GetActiveNamesResponse
Lens' GetActiveNamesResponse (Maybe Text)
getActiveNamesResponse_nextPageToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> GetActiveNamesResponse
-> Const (First Text) GetActiveNamesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetActiveNamesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetActiveNames where
type
AWSResponse GetActiveNames =
GetActiveNamesResponse
request :: GetActiveNames -> Request GetActiveNames
request = Service -> GetActiveNames -> Request GetActiveNames
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetActiveNames
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetActiveNames)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetActiveNames))
-> Logger
-> Service
-> Proxy GetActiveNames
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetActiveNames)))
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 Text -> Maybe [Text] -> Int -> GetActiveNamesResponse
GetActiveNamesResponse'
(Maybe Text -> Maybe [Text] -> Int -> GetActiveNamesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> Int -> GetActiveNamesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextPageToken")
Either String (Maybe [Text] -> Int -> GetActiveNamesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> GetActiveNamesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"activeNames" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetActiveNamesResponse)
-> Either String Int -> Either String GetActiveNamesResponse
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 GetActiveNames
instance Prelude.NFData GetActiveNames
instance Core.ToHeaders GetActiveNames where
toHeaders :: GetActiveNames -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetActiveNames -> 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.GetActiveNames" ::
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 GetActiveNames where
toJSON :: GetActiveNames -> Value
toJSON GetActiveNames' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetActiveNames' :: GetActiveNames -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"pageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken]
)
instance Core.ToPath GetActiveNames where
toPath :: GetActiveNames -> ByteString
toPath = ByteString -> GetActiveNames -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetActiveNames where
toQuery :: GetActiveNames -> QueryString
toQuery = QueryString -> GetActiveNames -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetActiveNamesResponse = GetActiveNamesResponse'
{
GetActiveNamesResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
GetActiveNamesResponse -> Maybe [Text]
activeNames :: Prelude.Maybe [Prelude.Text],
GetActiveNamesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetActiveNamesResponse -> GetActiveNamesResponse -> Bool
(GetActiveNamesResponse -> GetActiveNamesResponse -> Bool)
-> (GetActiveNamesResponse -> GetActiveNamesResponse -> Bool)
-> Eq GetActiveNamesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetActiveNamesResponse -> GetActiveNamesResponse -> Bool
$c/= :: GetActiveNamesResponse -> GetActiveNamesResponse -> Bool
== :: GetActiveNamesResponse -> GetActiveNamesResponse -> Bool
$c== :: GetActiveNamesResponse -> GetActiveNamesResponse -> Bool
Prelude.Eq, ReadPrec [GetActiveNamesResponse]
ReadPrec GetActiveNamesResponse
Int -> ReadS GetActiveNamesResponse
ReadS [GetActiveNamesResponse]
(Int -> ReadS GetActiveNamesResponse)
-> ReadS [GetActiveNamesResponse]
-> ReadPrec GetActiveNamesResponse
-> ReadPrec [GetActiveNamesResponse]
-> Read GetActiveNamesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetActiveNamesResponse]
$creadListPrec :: ReadPrec [GetActiveNamesResponse]
readPrec :: ReadPrec GetActiveNamesResponse
$creadPrec :: ReadPrec GetActiveNamesResponse
readList :: ReadS [GetActiveNamesResponse]
$creadList :: ReadS [GetActiveNamesResponse]
readsPrec :: Int -> ReadS GetActiveNamesResponse
$creadsPrec :: Int -> ReadS GetActiveNamesResponse
Prelude.Read, Int -> GetActiveNamesResponse -> ShowS
[GetActiveNamesResponse] -> ShowS
GetActiveNamesResponse -> String
(Int -> GetActiveNamesResponse -> ShowS)
-> (GetActiveNamesResponse -> String)
-> ([GetActiveNamesResponse] -> ShowS)
-> Show GetActiveNamesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetActiveNamesResponse] -> ShowS
$cshowList :: [GetActiveNamesResponse] -> ShowS
show :: GetActiveNamesResponse -> String
$cshow :: GetActiveNamesResponse -> String
showsPrec :: Int -> GetActiveNamesResponse -> ShowS
$cshowsPrec :: Int -> GetActiveNamesResponse -> ShowS
Prelude.Show, (forall x. GetActiveNamesResponse -> Rep GetActiveNamesResponse x)
-> (forall x.
Rep GetActiveNamesResponse x -> GetActiveNamesResponse)
-> Generic GetActiveNamesResponse
forall x. Rep GetActiveNamesResponse x -> GetActiveNamesResponse
forall x. GetActiveNamesResponse -> Rep GetActiveNamesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetActiveNamesResponse x -> GetActiveNamesResponse
$cfrom :: forall x. GetActiveNamesResponse -> Rep GetActiveNamesResponse x
Prelude.Generic)
newGetActiveNamesResponse ::
Prelude.Int ->
GetActiveNamesResponse
newGetActiveNamesResponse :: Int -> GetActiveNamesResponse
newGetActiveNamesResponse Int
pHttpStatus_ =
GetActiveNamesResponse' :: Maybe Text -> Maybe [Text] -> Int -> GetActiveNamesResponse
GetActiveNamesResponse'
{ $sel:nextPageToken:GetActiveNamesResponse' :: Maybe Text
nextPageToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:activeNames:GetActiveNamesResponse' :: Maybe [Text]
activeNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetActiveNamesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getActiveNamesResponse_nextPageToken :: Lens.Lens' GetActiveNamesResponse (Prelude.Maybe Prelude.Text)
getActiveNamesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetActiveNamesResponse -> f GetActiveNamesResponse
getActiveNamesResponse_nextPageToken = (GetActiveNamesResponse -> Maybe Text)
-> (GetActiveNamesResponse -> Maybe Text -> GetActiveNamesResponse)
-> Lens' GetActiveNamesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActiveNamesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetActiveNamesResponse' :: GetActiveNamesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetActiveNamesResponse
s@GetActiveNamesResponse' {} Maybe Text
a -> GetActiveNamesResponse
s {$sel:nextPageToken:GetActiveNamesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetActiveNamesResponse)
getActiveNamesResponse_activeNames :: Lens.Lens' GetActiveNamesResponse (Prelude.Maybe [Prelude.Text])
getActiveNamesResponse_activeNames :: (Maybe [Text] -> f (Maybe [Text]))
-> GetActiveNamesResponse -> f GetActiveNamesResponse
getActiveNamesResponse_activeNames = (GetActiveNamesResponse -> Maybe [Text])
-> (GetActiveNamesResponse
-> Maybe [Text] -> GetActiveNamesResponse)
-> Lens' GetActiveNamesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActiveNamesResponse' {Maybe [Text]
activeNames :: Maybe [Text]
$sel:activeNames:GetActiveNamesResponse' :: GetActiveNamesResponse -> Maybe [Text]
activeNames} -> Maybe [Text]
activeNames) (\s :: GetActiveNamesResponse
s@GetActiveNamesResponse' {} Maybe [Text]
a -> GetActiveNamesResponse
s {$sel:activeNames:GetActiveNamesResponse' :: Maybe [Text]
activeNames = Maybe [Text]
a} :: GetActiveNamesResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> GetActiveNamesResponse -> f GetActiveNamesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetActiveNamesResponse
-> f GetActiveNamesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getActiveNamesResponse_httpStatus :: Lens.Lens' GetActiveNamesResponse Prelude.Int
getActiveNamesResponse_httpStatus :: (Int -> f Int)
-> GetActiveNamesResponse -> f GetActiveNamesResponse
getActiveNamesResponse_httpStatus = (GetActiveNamesResponse -> Int)
-> (GetActiveNamesResponse -> Int -> GetActiveNamesResponse)
-> Lens GetActiveNamesResponse GetActiveNamesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActiveNamesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetActiveNamesResponse' :: GetActiveNamesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetActiveNamesResponse
s@GetActiveNamesResponse' {} Int
a -> GetActiveNamesResponse
s {$sel:httpStatus:GetActiveNamesResponse' :: Int
httpStatus = Int
a} :: GetActiveNamesResponse)
instance Prelude.NFData GetActiveNamesResponse