{-# 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.MGN.ListWaves
(
ListWaves (..),
newListWaves,
listWaves_filters,
listWaves_maxResults,
listWaves_nextToken,
ListWavesResponse (..),
newListWavesResponse,
listWavesResponse_items,
listWavesResponse_nextToken,
listWavesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListWaves = ListWaves'
{
ListWaves -> Maybe ListWavesRequestFilters
filters :: Prelude.Maybe ListWavesRequestFilters,
ListWaves -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListWaves -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListWaves -> ListWaves -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWaves -> ListWaves -> Bool
$c/= :: ListWaves -> ListWaves -> Bool
== :: ListWaves -> ListWaves -> Bool
$c== :: ListWaves -> ListWaves -> Bool
Prelude.Eq, ReadPrec [ListWaves]
ReadPrec ListWaves
Int -> ReadS ListWaves
ReadS [ListWaves]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWaves]
$creadListPrec :: ReadPrec [ListWaves]
readPrec :: ReadPrec ListWaves
$creadPrec :: ReadPrec ListWaves
readList :: ReadS [ListWaves]
$creadList :: ReadS [ListWaves]
readsPrec :: Int -> ReadS ListWaves
$creadsPrec :: Int -> ReadS ListWaves
Prelude.Read, Int -> ListWaves -> ShowS
[ListWaves] -> ShowS
ListWaves -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWaves] -> ShowS
$cshowList :: [ListWaves] -> ShowS
show :: ListWaves -> String
$cshow :: ListWaves -> String
showsPrec :: Int -> ListWaves -> ShowS
$cshowsPrec :: Int -> ListWaves -> ShowS
Prelude.Show, forall x. Rep ListWaves x -> ListWaves
forall x. ListWaves -> Rep ListWaves x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWaves x -> ListWaves
$cfrom :: forall x. ListWaves -> Rep ListWaves x
Prelude.Generic)
newListWaves ::
ListWaves
newListWaves :: ListWaves
newListWaves =
ListWaves'
{ $sel:filters:ListWaves' :: Maybe ListWavesRequestFilters
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListWaves' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWaves' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listWaves_filters :: Lens.Lens' ListWaves (Prelude.Maybe ListWavesRequestFilters)
listWaves_filters :: Lens' ListWaves (Maybe ListWavesRequestFilters)
listWaves_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWaves' {Maybe ListWavesRequestFilters
filters :: Maybe ListWavesRequestFilters
$sel:filters:ListWaves' :: ListWaves -> Maybe ListWavesRequestFilters
filters} -> Maybe ListWavesRequestFilters
filters) (\s :: ListWaves
s@ListWaves' {} Maybe ListWavesRequestFilters
a -> ListWaves
s {$sel:filters:ListWaves' :: Maybe ListWavesRequestFilters
filters = Maybe ListWavesRequestFilters
a} :: ListWaves)
listWaves_maxResults :: Lens.Lens' ListWaves (Prelude.Maybe Prelude.Natural)
listWaves_maxResults :: Lens' ListWaves (Maybe Natural)
listWaves_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWaves' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListWaves' :: ListWaves -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListWaves
s@ListWaves' {} Maybe Natural
a -> ListWaves
s {$sel:maxResults:ListWaves' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListWaves)
listWaves_nextToken :: Lens.Lens' ListWaves (Prelude.Maybe Prelude.Text)
listWaves_nextToken :: Lens' ListWaves (Maybe Text)
listWaves_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWaves' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWaves' :: ListWaves -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWaves
s@ListWaves' {} Maybe Text
a -> ListWaves
s {$sel:nextToken:ListWaves' :: Maybe Text
nextToken = Maybe Text
a} :: ListWaves)
instance Core.AWSPager ListWaves where
page :: ListWaves -> AWSResponse ListWaves -> Maybe ListWaves
page ListWaves
rq AWSResponse ListWaves
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListWaves
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWavesResponse (Maybe Text)
listWavesResponse_nextToken
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 ListWaves
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWavesResponse (Maybe [Wave])
listWavesResponse_items
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.$ ListWaves
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListWaves (Maybe Text)
listWaves_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWaves
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWavesResponse (Maybe Text)
listWavesResponse_nextToken
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 ListWaves where
type AWSResponse ListWaves = ListWavesResponse
request :: (Service -> Service) -> ListWaves -> Request ListWaves
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 ListWaves
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWaves)))
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 [Wave] -> Maybe Text -> Int -> ListWavesResponse
ListWavesResponse'
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
"items" 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
"nextToken")
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 ListWaves where
hashWithSalt :: Int -> ListWaves -> Int
hashWithSalt Int
_salt ListWaves' {Maybe Natural
Maybe Text
Maybe ListWavesRequestFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListWavesRequestFilters
$sel:nextToken:ListWaves' :: ListWaves -> Maybe Text
$sel:maxResults:ListWaves' :: ListWaves -> Maybe Natural
$sel:filters:ListWaves' :: ListWaves -> Maybe ListWavesRequestFilters
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ListWavesRequestFilters
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListWaves where
rnf :: ListWaves -> ()
rnf ListWaves' {Maybe Natural
Maybe Text
Maybe ListWavesRequestFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListWavesRequestFilters
$sel:nextToken:ListWaves' :: ListWaves -> Maybe Text
$sel:maxResults:ListWaves' :: ListWaves -> Maybe Natural
$sel:filters:ListWaves' :: ListWaves -> Maybe ListWavesRequestFilters
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ListWavesRequestFilters
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListWaves where
toHeaders :: ListWaves -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListWaves where
toJSON :: ListWaves -> Value
toJSON ListWaves' {Maybe Natural
Maybe Text
Maybe ListWavesRequestFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe ListWavesRequestFilters
$sel:nextToken:ListWaves' :: ListWaves -> Maybe Text
$sel:maxResults:ListWaves' :: ListWaves -> Maybe Natural
$sel:filters:ListWaves' :: ListWaves -> Maybe ListWavesRequestFilters
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"filters" 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 ListWavesRequestFilters
filters,
(Key
"maxResults" 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 Natural
maxResults,
(Key
"nextToken" 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
nextToken
]
)
instance Data.ToPath ListWaves where
toPath :: ListWaves -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ListWaves"
instance Data.ToQuery ListWaves where
toQuery :: ListWaves -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListWavesResponse = ListWavesResponse'
{
ListWavesResponse -> Maybe [Wave]
items :: Prelude.Maybe [Wave],
ListWavesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWavesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListWavesResponse -> ListWavesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWavesResponse -> ListWavesResponse -> Bool
$c/= :: ListWavesResponse -> ListWavesResponse -> Bool
== :: ListWavesResponse -> ListWavesResponse -> Bool
$c== :: ListWavesResponse -> ListWavesResponse -> Bool
Prelude.Eq, Int -> ListWavesResponse -> ShowS
[ListWavesResponse] -> ShowS
ListWavesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWavesResponse] -> ShowS
$cshowList :: [ListWavesResponse] -> ShowS
show :: ListWavesResponse -> String
$cshow :: ListWavesResponse -> String
showsPrec :: Int -> ListWavesResponse -> ShowS
$cshowsPrec :: Int -> ListWavesResponse -> ShowS
Prelude.Show, forall x. Rep ListWavesResponse x -> ListWavesResponse
forall x. ListWavesResponse -> Rep ListWavesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWavesResponse x -> ListWavesResponse
$cfrom :: forall x. ListWavesResponse -> Rep ListWavesResponse x
Prelude.Generic)
newListWavesResponse ::
Prelude.Int ->
ListWavesResponse
newListWavesResponse :: Int -> ListWavesResponse
newListWavesResponse Int
pHttpStatus_ =
ListWavesResponse'
{ $sel:items:ListWavesResponse' :: Maybe [Wave]
items = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWavesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWavesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listWavesResponse_items :: Lens.Lens' ListWavesResponse (Prelude.Maybe [Wave])
listWavesResponse_items :: Lens' ListWavesResponse (Maybe [Wave])
listWavesResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWavesResponse' {Maybe [Wave]
items :: Maybe [Wave]
$sel:items:ListWavesResponse' :: ListWavesResponse -> Maybe [Wave]
items} -> Maybe [Wave]
items) (\s :: ListWavesResponse
s@ListWavesResponse' {} Maybe [Wave]
a -> ListWavesResponse
s {$sel:items:ListWavesResponse' :: Maybe [Wave]
items = Maybe [Wave]
a} :: ListWavesResponse) 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
listWavesResponse_nextToken :: Lens.Lens' ListWavesResponse (Prelude.Maybe Prelude.Text)
listWavesResponse_nextToken :: Lens' ListWavesResponse (Maybe Text)
listWavesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWavesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWavesResponse' :: ListWavesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWavesResponse
s@ListWavesResponse' {} Maybe Text
a -> ListWavesResponse
s {$sel:nextToken:ListWavesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWavesResponse)
listWavesResponse_httpStatus :: Lens.Lens' ListWavesResponse Prelude.Int
listWavesResponse_httpStatus :: Lens' ListWavesResponse Int
listWavesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWavesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWavesResponse' :: ListWavesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWavesResponse
s@ListWavesResponse' {} Int
a -> ListWavesResponse
s {$sel:httpStatus:ListWavesResponse' :: Int
httpStatus = Int
a} :: ListWavesResponse)
instance Prelude.NFData ListWavesResponse where
rnf :: ListWavesResponse -> ()
rnf ListWavesResponse' {Int
Maybe [Wave]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
items :: Maybe [Wave]
$sel:httpStatus:ListWavesResponse' :: ListWavesResponse -> Int
$sel:nextToken:ListWavesResponse' :: ListWavesResponse -> Maybe Text
$sel:items:ListWavesResponse' :: ListWavesResponse -> Maybe [Wave]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Wave]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus