{-# 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.Nimble.ListEulas
(
ListEulas (..),
newListEulas,
listEulas_nextToken,
listEulas_eulaIds,
ListEulasResponse (..),
newListEulasResponse,
listEulasResponse_eulas,
listEulasResponse_nextToken,
listEulasResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListEulas = ListEulas'
{
ListEulas -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEulas -> Maybe [Text]
eulaIds :: Prelude.Maybe [Prelude.Text]
}
deriving (ListEulas -> ListEulas -> Bool
(ListEulas -> ListEulas -> Bool)
-> (ListEulas -> ListEulas -> Bool) -> Eq ListEulas
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEulas -> ListEulas -> Bool
$c/= :: ListEulas -> ListEulas -> Bool
== :: ListEulas -> ListEulas -> Bool
$c== :: ListEulas -> ListEulas -> Bool
Prelude.Eq, ReadPrec [ListEulas]
ReadPrec ListEulas
Int -> ReadS ListEulas
ReadS [ListEulas]
(Int -> ReadS ListEulas)
-> ReadS [ListEulas]
-> ReadPrec ListEulas
-> ReadPrec [ListEulas]
-> Read ListEulas
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEulas]
$creadListPrec :: ReadPrec [ListEulas]
readPrec :: ReadPrec ListEulas
$creadPrec :: ReadPrec ListEulas
readList :: ReadS [ListEulas]
$creadList :: ReadS [ListEulas]
readsPrec :: Int -> ReadS ListEulas
$creadsPrec :: Int -> ReadS ListEulas
Prelude.Read, Int -> ListEulas -> ShowS
[ListEulas] -> ShowS
ListEulas -> String
(Int -> ListEulas -> ShowS)
-> (ListEulas -> String)
-> ([ListEulas] -> ShowS)
-> Show ListEulas
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEulas] -> ShowS
$cshowList :: [ListEulas] -> ShowS
show :: ListEulas -> String
$cshow :: ListEulas -> String
showsPrec :: Int -> ListEulas -> ShowS
$cshowsPrec :: Int -> ListEulas -> ShowS
Prelude.Show, (forall x. ListEulas -> Rep ListEulas x)
-> (forall x. Rep ListEulas x -> ListEulas) -> Generic ListEulas
forall x. Rep ListEulas x -> ListEulas
forall x. ListEulas -> Rep ListEulas x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEulas x -> ListEulas
$cfrom :: forall x. ListEulas -> Rep ListEulas x
Prelude.Generic)
newListEulas ::
ListEulas
newListEulas :: ListEulas
newListEulas =
ListEulas' :: Maybe Text -> Maybe [Text] -> ListEulas
ListEulas'
{ $sel:nextToken:ListEulas' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eulaIds:ListEulas' :: Maybe [Text]
eulaIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
listEulas_nextToken :: Lens.Lens' ListEulas (Prelude.Maybe Prelude.Text)
listEulas_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListEulas -> f ListEulas
listEulas_nextToken = (ListEulas -> Maybe Text)
-> (ListEulas -> Maybe Text -> ListEulas)
-> Lens ListEulas ListEulas (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEulas' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEulas' :: ListEulas -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEulas
s@ListEulas' {} Maybe Text
a -> ListEulas
s {$sel:nextToken:ListEulas' :: Maybe Text
nextToken = Maybe Text
a} :: ListEulas)
listEulas_eulaIds :: Lens.Lens' ListEulas (Prelude.Maybe [Prelude.Text])
listEulas_eulaIds :: (Maybe [Text] -> f (Maybe [Text])) -> ListEulas -> f ListEulas
listEulas_eulaIds = (ListEulas -> Maybe [Text])
-> (ListEulas -> Maybe [Text] -> ListEulas)
-> Lens ListEulas ListEulas (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEulas' {Maybe [Text]
eulaIds :: Maybe [Text]
$sel:eulaIds:ListEulas' :: ListEulas -> Maybe [Text]
eulaIds} -> Maybe [Text]
eulaIds) (\s :: ListEulas
s@ListEulas' {} Maybe [Text]
a -> ListEulas
s {$sel:eulaIds:ListEulas' :: Maybe [Text]
eulaIds = Maybe [Text]
a} :: ListEulas) ((Maybe [Text] -> f (Maybe [Text])) -> ListEulas -> f ListEulas)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListEulas
-> f ListEulas
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
instance Core.AWSPager ListEulas where
page :: ListEulas -> AWSResponse ListEulas -> Maybe ListEulas
page ListEulas
rq AWSResponse ListEulas
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListEulas
ListEulasResponse
rs
ListEulasResponse
-> Getting (First Text) ListEulasResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEulasResponse -> Const (First Text) ListEulasResponse
Lens' ListEulasResponse (Maybe Text)
listEulasResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListEulasResponse -> Const (First Text) ListEulasResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEulasResponse 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 ListEulas
forall a. Maybe a
Prelude.Nothing
| Maybe [Eula] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListEulas
ListEulasResponse
rs
ListEulasResponse
-> Getting (First [Eula]) ListEulasResponse [Eula] -> Maybe [Eula]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Eula] -> Const (First [Eula]) (Maybe [Eula]))
-> ListEulasResponse -> Const (First [Eula]) ListEulasResponse
Lens' ListEulasResponse (Maybe [Eula])
listEulasResponse_eulas ((Maybe [Eula] -> Const (First [Eula]) (Maybe [Eula]))
-> ListEulasResponse -> Const (First [Eula]) ListEulasResponse)
-> (([Eula] -> Const (First [Eula]) [Eula])
-> Maybe [Eula] -> Const (First [Eula]) (Maybe [Eula]))
-> Getting (First [Eula]) ListEulasResponse [Eula]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Eula] -> Const (First [Eula]) [Eula])
-> Maybe [Eula] -> Const (First [Eula]) (Maybe [Eula])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListEulas
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListEulas -> Maybe ListEulas
forall a. a -> Maybe a
Prelude.Just (ListEulas -> Maybe ListEulas) -> ListEulas -> Maybe ListEulas
forall a b. (a -> b) -> a -> b
Prelude.$
ListEulas
rq
ListEulas -> (ListEulas -> ListEulas) -> ListEulas
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEulas -> Identity ListEulas
Lens ListEulas ListEulas (Maybe Text) (Maybe Text)
listEulas_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListEulas -> Identity ListEulas)
-> Maybe Text -> ListEulas -> ListEulas
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEulas
ListEulasResponse
rs
ListEulasResponse
-> Getting (First Text) ListEulasResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEulasResponse -> Const (First Text) ListEulasResponse
Lens' ListEulasResponse (Maybe Text)
listEulasResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListEulasResponse -> Const (First Text) ListEulasResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEulasResponse 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 ListEulas where
type AWSResponse ListEulas = ListEulasResponse
request :: ListEulas -> Request ListEulas
request = Service -> ListEulas -> Request ListEulas
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListEulas
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEulas)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListEulas))
-> Logger
-> Service
-> Proxy ListEulas
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEulas)))
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 [Eula] -> Maybe Text -> Int -> ListEulasResponse
ListEulasResponse'
(Maybe [Eula] -> Maybe Text -> Int -> ListEulasResponse)
-> Either String (Maybe [Eula])
-> Either String (Maybe Text -> Int -> ListEulasResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Eula]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"eulas" Either String (Maybe (Maybe [Eula]))
-> Maybe [Eula] -> Either String (Maybe [Eula])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Eula]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListEulasResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListEulasResponse)
forall (f :: * -> *) a b. Applicative f => 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
"nextToken")
Either String (Int -> ListEulasResponse)
-> Either String Int -> Either String ListEulasResponse
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 ListEulas
instance Prelude.NFData ListEulas
instance Core.ToHeaders ListEulas where
toHeaders :: ListEulas -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListEulas -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListEulas where
toPath :: ListEulas -> ByteString
toPath = ByteString -> ListEulas -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-08-01/eulas"
instance Core.ToQuery ListEulas where
toQuery :: ListEulas -> QueryString
toQuery ListEulas' {Maybe [Text]
Maybe Text
eulaIds :: Maybe [Text]
nextToken :: Maybe Text
$sel:eulaIds:ListEulas' :: ListEulas -> Maybe [Text]
$sel:nextToken:ListEulas' :: ListEulas -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"eulaIds"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
eulaIds)
]
data ListEulasResponse = ListEulasResponse'
{
ListEulasResponse -> Maybe [Eula]
eulas :: Prelude.Maybe [Eula],
ListEulasResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEulasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListEulasResponse -> ListEulasResponse -> Bool
(ListEulasResponse -> ListEulasResponse -> Bool)
-> (ListEulasResponse -> ListEulasResponse -> Bool)
-> Eq ListEulasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEulasResponse -> ListEulasResponse -> Bool
$c/= :: ListEulasResponse -> ListEulasResponse -> Bool
== :: ListEulasResponse -> ListEulasResponse -> Bool
$c== :: ListEulasResponse -> ListEulasResponse -> Bool
Prelude.Eq, ReadPrec [ListEulasResponse]
ReadPrec ListEulasResponse
Int -> ReadS ListEulasResponse
ReadS [ListEulasResponse]
(Int -> ReadS ListEulasResponse)
-> ReadS [ListEulasResponse]
-> ReadPrec ListEulasResponse
-> ReadPrec [ListEulasResponse]
-> Read ListEulasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEulasResponse]
$creadListPrec :: ReadPrec [ListEulasResponse]
readPrec :: ReadPrec ListEulasResponse
$creadPrec :: ReadPrec ListEulasResponse
readList :: ReadS [ListEulasResponse]
$creadList :: ReadS [ListEulasResponse]
readsPrec :: Int -> ReadS ListEulasResponse
$creadsPrec :: Int -> ReadS ListEulasResponse
Prelude.Read, Int -> ListEulasResponse -> ShowS
[ListEulasResponse] -> ShowS
ListEulasResponse -> String
(Int -> ListEulasResponse -> ShowS)
-> (ListEulasResponse -> String)
-> ([ListEulasResponse] -> ShowS)
-> Show ListEulasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEulasResponse] -> ShowS
$cshowList :: [ListEulasResponse] -> ShowS
show :: ListEulasResponse -> String
$cshow :: ListEulasResponse -> String
showsPrec :: Int -> ListEulasResponse -> ShowS
$cshowsPrec :: Int -> ListEulasResponse -> ShowS
Prelude.Show, (forall x. ListEulasResponse -> Rep ListEulasResponse x)
-> (forall x. Rep ListEulasResponse x -> ListEulasResponse)
-> Generic ListEulasResponse
forall x. Rep ListEulasResponse x -> ListEulasResponse
forall x. ListEulasResponse -> Rep ListEulasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEulasResponse x -> ListEulasResponse
$cfrom :: forall x. ListEulasResponse -> Rep ListEulasResponse x
Prelude.Generic)
newListEulasResponse ::
Prelude.Int ->
ListEulasResponse
newListEulasResponse :: Int -> ListEulasResponse
newListEulasResponse Int
pHttpStatus_ =
ListEulasResponse' :: Maybe [Eula] -> Maybe Text -> Int -> ListEulasResponse
ListEulasResponse'
{ $sel:eulas:ListEulasResponse' :: Maybe [Eula]
eulas = Maybe [Eula]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEulasResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEulasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listEulasResponse_eulas :: Lens.Lens' ListEulasResponse (Prelude.Maybe [Eula])
listEulasResponse_eulas :: (Maybe [Eula] -> f (Maybe [Eula]))
-> ListEulasResponse -> f ListEulasResponse
listEulasResponse_eulas = (ListEulasResponse -> Maybe [Eula])
-> (ListEulasResponse -> Maybe [Eula] -> ListEulasResponse)
-> Lens' ListEulasResponse (Maybe [Eula])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEulasResponse' {Maybe [Eula]
eulas :: Maybe [Eula]
$sel:eulas:ListEulasResponse' :: ListEulasResponse -> Maybe [Eula]
eulas} -> Maybe [Eula]
eulas) (\s :: ListEulasResponse
s@ListEulasResponse' {} Maybe [Eula]
a -> ListEulasResponse
s {$sel:eulas:ListEulasResponse' :: Maybe [Eula]
eulas = Maybe [Eula]
a} :: ListEulasResponse) ((Maybe [Eula] -> f (Maybe [Eula]))
-> ListEulasResponse -> f ListEulasResponse)
-> ((Maybe [Eula] -> f (Maybe [Eula]))
-> Maybe [Eula] -> f (Maybe [Eula]))
-> (Maybe [Eula] -> f (Maybe [Eula]))
-> ListEulasResponse
-> f ListEulasResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Eula] [Eula] [Eula] [Eula]
-> Iso (Maybe [Eula]) (Maybe [Eula]) (Maybe [Eula]) (Maybe [Eula])
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 [Eula] [Eula] [Eula] [Eula]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listEulasResponse_nextToken :: Lens.Lens' ListEulasResponse (Prelude.Maybe Prelude.Text)
listEulasResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEulasResponse -> f ListEulasResponse
listEulasResponse_nextToken = (ListEulasResponse -> Maybe Text)
-> (ListEulasResponse -> Maybe Text -> ListEulasResponse)
-> Lens' ListEulasResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEulasResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEulasResponse' :: ListEulasResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEulasResponse
s@ListEulasResponse' {} Maybe Text
a -> ListEulasResponse
s {$sel:nextToken:ListEulasResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEulasResponse)
listEulasResponse_httpStatus :: Lens.Lens' ListEulasResponse Prelude.Int
listEulasResponse_httpStatus :: (Int -> f Int) -> ListEulasResponse -> f ListEulasResponse
listEulasResponse_httpStatus = (ListEulasResponse -> Int)
-> (ListEulasResponse -> Int -> ListEulasResponse)
-> Lens ListEulasResponse ListEulasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEulasResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEulasResponse' :: ListEulasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEulasResponse
s@ListEulasResponse' {} Int
a -> ListEulasResponse
s {$sel:httpStatus:ListEulasResponse' :: Int
httpStatus = Int
a} :: ListEulasResponse)
instance Prelude.NFData ListEulasResponse