{-# 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.DeviceFarm.ListOfferings
(
ListOfferings (..),
newListOfferings,
listOfferings_nextToken,
ListOfferingsResponse (..),
newListOfferingsResponse,
listOfferingsResponse_nextToken,
listOfferingsResponse_offerings,
listOfferingsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListOfferings = ListOfferings'
{
ListOfferings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListOfferings -> ListOfferings -> Bool
(ListOfferings -> ListOfferings -> Bool)
-> (ListOfferings -> ListOfferings -> Bool) -> Eq ListOfferings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOfferings -> ListOfferings -> Bool
$c/= :: ListOfferings -> ListOfferings -> Bool
== :: ListOfferings -> ListOfferings -> Bool
$c== :: ListOfferings -> ListOfferings -> Bool
Prelude.Eq, ReadPrec [ListOfferings]
ReadPrec ListOfferings
Int -> ReadS ListOfferings
ReadS [ListOfferings]
(Int -> ReadS ListOfferings)
-> ReadS [ListOfferings]
-> ReadPrec ListOfferings
-> ReadPrec [ListOfferings]
-> Read ListOfferings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOfferings]
$creadListPrec :: ReadPrec [ListOfferings]
readPrec :: ReadPrec ListOfferings
$creadPrec :: ReadPrec ListOfferings
readList :: ReadS [ListOfferings]
$creadList :: ReadS [ListOfferings]
readsPrec :: Int -> ReadS ListOfferings
$creadsPrec :: Int -> ReadS ListOfferings
Prelude.Read, Int -> ListOfferings -> ShowS
[ListOfferings] -> ShowS
ListOfferings -> String
(Int -> ListOfferings -> ShowS)
-> (ListOfferings -> String)
-> ([ListOfferings] -> ShowS)
-> Show ListOfferings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOfferings] -> ShowS
$cshowList :: [ListOfferings] -> ShowS
show :: ListOfferings -> String
$cshow :: ListOfferings -> String
showsPrec :: Int -> ListOfferings -> ShowS
$cshowsPrec :: Int -> ListOfferings -> ShowS
Prelude.Show, (forall x. ListOfferings -> Rep ListOfferings x)
-> (forall x. Rep ListOfferings x -> ListOfferings)
-> Generic ListOfferings
forall x. Rep ListOfferings x -> ListOfferings
forall x. ListOfferings -> Rep ListOfferings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOfferings x -> ListOfferings
$cfrom :: forall x. ListOfferings -> Rep ListOfferings x
Prelude.Generic)
newListOfferings ::
ListOfferings
newListOfferings :: ListOfferings
newListOfferings =
ListOfferings' :: Maybe Text -> ListOfferings
ListOfferings' {$sel:nextToken:ListOfferings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
listOfferings_nextToken :: Lens.Lens' ListOfferings (Prelude.Maybe Prelude.Text)
listOfferings_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListOfferings -> f ListOfferings
listOfferings_nextToken = (ListOfferings -> Maybe Text)
-> (ListOfferings -> Maybe Text -> ListOfferings)
-> Lens ListOfferings ListOfferings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferings' :: ListOfferings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOfferings
s@ListOfferings' {} Maybe Text
a -> ListOfferings
s {$sel:nextToken:ListOfferings' :: Maybe Text
nextToken = Maybe Text
a} :: ListOfferings)
instance Core.AWSPager ListOfferings where
page :: ListOfferings -> AWSResponse ListOfferings -> Maybe ListOfferings
page ListOfferings
rq AWSResponse ListOfferings
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListOfferings
ListOfferingsResponse
rs
ListOfferingsResponse
-> Getting (First Text) ListOfferingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOfferingsResponse
-> Const (First Text) ListOfferingsResponse
Lens' ListOfferingsResponse (Maybe Text)
listOfferingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListOfferingsResponse
-> Const (First Text) ListOfferingsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOfferingsResponse 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 ListOfferings
forall a. Maybe a
Prelude.Nothing
| Maybe [Offering] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListOfferings
ListOfferingsResponse
rs
ListOfferingsResponse
-> Getting (First [Offering]) ListOfferingsResponse [Offering]
-> Maybe [Offering]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Offering] -> Const (First [Offering]) (Maybe [Offering]))
-> ListOfferingsResponse
-> Const (First [Offering]) ListOfferingsResponse
Lens' ListOfferingsResponse (Maybe [Offering])
listOfferingsResponse_offerings ((Maybe [Offering] -> Const (First [Offering]) (Maybe [Offering]))
-> ListOfferingsResponse
-> Const (First [Offering]) ListOfferingsResponse)
-> (([Offering] -> Const (First [Offering]) [Offering])
-> Maybe [Offering] -> Const (First [Offering]) (Maybe [Offering]))
-> Getting (First [Offering]) ListOfferingsResponse [Offering]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Offering] -> Const (First [Offering]) [Offering])
-> Maybe [Offering] -> Const (First [Offering]) (Maybe [Offering])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListOfferings
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListOfferings -> Maybe ListOfferings
forall a. a -> Maybe a
Prelude.Just (ListOfferings -> Maybe ListOfferings)
-> ListOfferings -> Maybe ListOfferings
forall a b. (a -> b) -> a -> b
Prelude.$
ListOfferings
rq
ListOfferings -> (ListOfferings -> ListOfferings) -> ListOfferings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListOfferings -> Identity ListOfferings
Lens ListOfferings ListOfferings (Maybe Text) (Maybe Text)
listOfferings_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListOfferings -> Identity ListOfferings)
-> Maybe Text -> ListOfferings -> ListOfferings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOfferings
ListOfferingsResponse
rs
ListOfferingsResponse
-> Getting (First Text) ListOfferingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOfferingsResponse
-> Const (First Text) ListOfferingsResponse
Lens' ListOfferingsResponse (Maybe Text)
listOfferingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListOfferingsResponse
-> Const (First Text) ListOfferingsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOfferingsResponse 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 ListOfferings where
type
AWSResponse ListOfferings =
ListOfferingsResponse
request :: ListOfferings -> Request ListOfferings
request = Service -> ListOfferings -> Request ListOfferings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListOfferings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListOfferings)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListOfferings))
-> Logger
-> Service
-> Proxy ListOfferings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListOfferings)))
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 [Offering] -> Int -> ListOfferingsResponse
ListOfferingsResponse'
(Maybe Text -> Maybe [Offering] -> Int -> ListOfferingsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Offering] -> Int -> ListOfferingsResponse)
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
"nextToken")
Either String (Maybe [Offering] -> Int -> ListOfferingsResponse)
-> Either String (Maybe [Offering])
-> Either String (Int -> ListOfferingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Offering]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"offerings" Either String (Maybe (Maybe [Offering]))
-> Maybe [Offering] -> Either String (Maybe [Offering])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Offering]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListOfferingsResponse)
-> Either String Int -> Either String ListOfferingsResponse
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 ListOfferings
instance Prelude.NFData ListOfferings
instance Core.ToHeaders ListOfferings where
toHeaders :: ListOfferings -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListOfferings -> 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
"DeviceFarm_20150623.ListOfferings" ::
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 ListOfferings where
toJSON :: ListOfferings -> Value
toJSON ListOfferings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferings' :: ListOfferings -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"nextToken" 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
nextToken]
)
instance Core.ToPath ListOfferings where
toPath :: ListOfferings -> ByteString
toPath = ByteString -> ListOfferings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListOfferings where
toQuery :: ListOfferings -> QueryString
toQuery = QueryString -> ListOfferings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListOfferingsResponse = ListOfferingsResponse'
{
ListOfferingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListOfferingsResponse -> Maybe [Offering]
offerings :: Prelude.Maybe [Offering],
ListOfferingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListOfferingsResponse -> ListOfferingsResponse -> Bool
(ListOfferingsResponse -> ListOfferingsResponse -> Bool)
-> (ListOfferingsResponse -> ListOfferingsResponse -> Bool)
-> Eq ListOfferingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOfferingsResponse -> ListOfferingsResponse -> Bool
$c/= :: ListOfferingsResponse -> ListOfferingsResponse -> Bool
== :: ListOfferingsResponse -> ListOfferingsResponse -> Bool
$c== :: ListOfferingsResponse -> ListOfferingsResponse -> Bool
Prelude.Eq, ReadPrec [ListOfferingsResponse]
ReadPrec ListOfferingsResponse
Int -> ReadS ListOfferingsResponse
ReadS [ListOfferingsResponse]
(Int -> ReadS ListOfferingsResponse)
-> ReadS [ListOfferingsResponse]
-> ReadPrec ListOfferingsResponse
-> ReadPrec [ListOfferingsResponse]
-> Read ListOfferingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOfferingsResponse]
$creadListPrec :: ReadPrec [ListOfferingsResponse]
readPrec :: ReadPrec ListOfferingsResponse
$creadPrec :: ReadPrec ListOfferingsResponse
readList :: ReadS [ListOfferingsResponse]
$creadList :: ReadS [ListOfferingsResponse]
readsPrec :: Int -> ReadS ListOfferingsResponse
$creadsPrec :: Int -> ReadS ListOfferingsResponse
Prelude.Read, Int -> ListOfferingsResponse -> ShowS
[ListOfferingsResponse] -> ShowS
ListOfferingsResponse -> String
(Int -> ListOfferingsResponse -> ShowS)
-> (ListOfferingsResponse -> String)
-> ([ListOfferingsResponse] -> ShowS)
-> Show ListOfferingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOfferingsResponse] -> ShowS
$cshowList :: [ListOfferingsResponse] -> ShowS
show :: ListOfferingsResponse -> String
$cshow :: ListOfferingsResponse -> String
showsPrec :: Int -> ListOfferingsResponse -> ShowS
$cshowsPrec :: Int -> ListOfferingsResponse -> ShowS
Prelude.Show, (forall x. ListOfferingsResponse -> Rep ListOfferingsResponse x)
-> (forall x. Rep ListOfferingsResponse x -> ListOfferingsResponse)
-> Generic ListOfferingsResponse
forall x. Rep ListOfferingsResponse x -> ListOfferingsResponse
forall x. ListOfferingsResponse -> Rep ListOfferingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOfferingsResponse x -> ListOfferingsResponse
$cfrom :: forall x. ListOfferingsResponse -> Rep ListOfferingsResponse x
Prelude.Generic)
newListOfferingsResponse ::
Prelude.Int ->
ListOfferingsResponse
newListOfferingsResponse :: Int -> ListOfferingsResponse
newListOfferingsResponse Int
pHttpStatus_ =
ListOfferingsResponse' :: Maybe Text -> Maybe [Offering] -> Int -> ListOfferingsResponse
ListOfferingsResponse'
{ $sel:nextToken:ListOfferingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:offerings:ListOfferingsResponse' :: Maybe [Offering]
offerings = Maybe [Offering]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListOfferingsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listOfferingsResponse_nextToken :: Lens.Lens' ListOfferingsResponse (Prelude.Maybe Prelude.Text)
listOfferingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOfferingsResponse -> f ListOfferingsResponse
listOfferingsResponse_nextToken = (ListOfferingsResponse -> Maybe Text)
-> (ListOfferingsResponse -> Maybe Text -> ListOfferingsResponse)
-> Lens' ListOfferingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingsResponse' :: ListOfferingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOfferingsResponse
s@ListOfferingsResponse' {} Maybe Text
a -> ListOfferingsResponse
s {$sel:nextToken:ListOfferingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOfferingsResponse)
listOfferingsResponse_offerings :: Lens.Lens' ListOfferingsResponse (Prelude.Maybe [Offering])
listOfferingsResponse_offerings :: (Maybe [Offering] -> f (Maybe [Offering]))
-> ListOfferingsResponse -> f ListOfferingsResponse
listOfferingsResponse_offerings = (ListOfferingsResponse -> Maybe [Offering])
-> (ListOfferingsResponse
-> Maybe [Offering] -> ListOfferingsResponse)
-> Lens' ListOfferingsResponse (Maybe [Offering])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingsResponse' {Maybe [Offering]
offerings :: Maybe [Offering]
$sel:offerings:ListOfferingsResponse' :: ListOfferingsResponse -> Maybe [Offering]
offerings} -> Maybe [Offering]
offerings) (\s :: ListOfferingsResponse
s@ListOfferingsResponse' {} Maybe [Offering]
a -> ListOfferingsResponse
s {$sel:offerings:ListOfferingsResponse' :: Maybe [Offering]
offerings = Maybe [Offering]
a} :: ListOfferingsResponse) ((Maybe [Offering] -> f (Maybe [Offering]))
-> ListOfferingsResponse -> f ListOfferingsResponse)
-> ((Maybe [Offering] -> f (Maybe [Offering]))
-> Maybe [Offering] -> f (Maybe [Offering]))
-> (Maybe [Offering] -> f (Maybe [Offering]))
-> ListOfferingsResponse
-> f ListOfferingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Offering] [Offering] [Offering] [Offering]
-> Iso
(Maybe [Offering])
(Maybe [Offering])
(Maybe [Offering])
(Maybe [Offering])
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 [Offering] [Offering] [Offering] [Offering]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listOfferingsResponse_httpStatus :: Lens.Lens' ListOfferingsResponse Prelude.Int
listOfferingsResponse_httpStatus :: (Int -> f Int) -> ListOfferingsResponse -> f ListOfferingsResponse
listOfferingsResponse_httpStatus = (ListOfferingsResponse -> Int)
-> (ListOfferingsResponse -> Int -> ListOfferingsResponse)
-> Lens ListOfferingsResponse ListOfferingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListOfferingsResponse' :: ListOfferingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListOfferingsResponse
s@ListOfferingsResponse' {} Int
a -> ListOfferingsResponse
s {$sel:httpStatus:ListOfferingsResponse' :: Int
httpStatus = Int
a} :: ListOfferingsResponse)
instance Prelude.NFData ListOfferingsResponse