{-# 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.ListOfferingPromotions
(
ListOfferingPromotions (..),
newListOfferingPromotions,
listOfferingPromotions_nextToken,
ListOfferingPromotionsResponse (..),
newListOfferingPromotionsResponse,
listOfferingPromotionsResponse_nextToken,
listOfferingPromotionsResponse_offeringPromotions,
listOfferingPromotionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListOfferingPromotions = ListOfferingPromotions'
{
ListOfferingPromotions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListOfferingPromotions -> ListOfferingPromotions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOfferingPromotions -> ListOfferingPromotions -> Bool
$c/= :: ListOfferingPromotions -> ListOfferingPromotions -> Bool
== :: ListOfferingPromotions -> ListOfferingPromotions -> Bool
$c== :: ListOfferingPromotions -> ListOfferingPromotions -> Bool
Prelude.Eq, ReadPrec [ListOfferingPromotions]
ReadPrec ListOfferingPromotions
Int -> ReadS ListOfferingPromotions
ReadS [ListOfferingPromotions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOfferingPromotions]
$creadListPrec :: ReadPrec [ListOfferingPromotions]
readPrec :: ReadPrec ListOfferingPromotions
$creadPrec :: ReadPrec ListOfferingPromotions
readList :: ReadS [ListOfferingPromotions]
$creadList :: ReadS [ListOfferingPromotions]
readsPrec :: Int -> ReadS ListOfferingPromotions
$creadsPrec :: Int -> ReadS ListOfferingPromotions
Prelude.Read, Int -> ListOfferingPromotions -> ShowS
[ListOfferingPromotions] -> ShowS
ListOfferingPromotions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOfferingPromotions] -> ShowS
$cshowList :: [ListOfferingPromotions] -> ShowS
show :: ListOfferingPromotions -> String
$cshow :: ListOfferingPromotions -> String
showsPrec :: Int -> ListOfferingPromotions -> ShowS
$cshowsPrec :: Int -> ListOfferingPromotions -> ShowS
Prelude.Show, forall x. Rep ListOfferingPromotions x -> ListOfferingPromotions
forall x. ListOfferingPromotions -> Rep ListOfferingPromotions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOfferingPromotions x -> ListOfferingPromotions
$cfrom :: forall x. ListOfferingPromotions -> Rep ListOfferingPromotions x
Prelude.Generic)
newListOfferingPromotions ::
ListOfferingPromotions
newListOfferingPromotions :: ListOfferingPromotions
newListOfferingPromotions =
ListOfferingPromotions'
{ $sel:nextToken:ListOfferingPromotions' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing
}
listOfferingPromotions_nextToken :: Lens.Lens' ListOfferingPromotions (Prelude.Maybe Prelude.Text)
listOfferingPromotions_nextToken :: Lens' ListOfferingPromotions (Maybe Text)
listOfferingPromotions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingPromotions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingPromotions' :: ListOfferingPromotions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOfferingPromotions
s@ListOfferingPromotions' {} Maybe Text
a -> ListOfferingPromotions
s {$sel:nextToken:ListOfferingPromotions' :: Maybe Text
nextToken = Maybe Text
a} :: ListOfferingPromotions)
instance Core.AWSPager ListOfferingPromotions where
page :: ListOfferingPromotions
-> AWSResponse ListOfferingPromotions
-> Maybe ListOfferingPromotions
page ListOfferingPromotions
rq AWSResponse ListOfferingPromotions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListOfferingPromotions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOfferingPromotionsResponse (Maybe Text)
listOfferingPromotionsResponse_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 ListOfferingPromotions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOfferingPromotionsResponse (Maybe [OfferingPromotion])
listOfferingPromotionsResponse_offeringPromotions
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.$ ListOfferingPromotions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListOfferingPromotions (Maybe Text)
listOfferingPromotions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOfferingPromotions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOfferingPromotionsResponse (Maybe Text)
listOfferingPromotionsResponse_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 ListOfferingPromotions where
type
AWSResponse ListOfferingPromotions =
ListOfferingPromotionsResponse
request :: (Service -> Service)
-> ListOfferingPromotions -> Request ListOfferingPromotions
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 ListOfferingPromotions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListOfferingPromotions)))
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 [OfferingPromotion]
-> Int
-> ListOfferingPromotionsResponse
ListOfferingPromotionsResponse'
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
"nextToken")
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
"offeringPromotions"
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 ListOfferingPromotions where
hashWithSalt :: Int -> ListOfferingPromotions -> Int
hashWithSalt Int
_salt ListOfferingPromotions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingPromotions' :: ListOfferingPromotions -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListOfferingPromotions where
rnf :: ListOfferingPromotions -> ()
rnf ListOfferingPromotions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingPromotions' :: ListOfferingPromotions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListOfferingPromotions where
toHeaders :: ListOfferingPromotions -> 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
"DeviceFarm_20150623.ListOfferingPromotions" ::
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 ListOfferingPromotions where
toJSON :: ListOfferingPromotions -> Value
toJSON ListOfferingPromotions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingPromotions' :: ListOfferingPromotions -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(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 ListOfferingPromotions where
toPath :: ListOfferingPromotions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListOfferingPromotions where
toQuery :: ListOfferingPromotions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListOfferingPromotionsResponse = ListOfferingPromotionsResponse'
{
ListOfferingPromotionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListOfferingPromotionsResponse -> Maybe [OfferingPromotion]
offeringPromotions :: Prelude.Maybe [OfferingPromotion],
ListOfferingPromotionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListOfferingPromotionsResponse
-> ListOfferingPromotionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOfferingPromotionsResponse
-> ListOfferingPromotionsResponse -> Bool
$c/= :: ListOfferingPromotionsResponse
-> ListOfferingPromotionsResponse -> Bool
== :: ListOfferingPromotionsResponse
-> ListOfferingPromotionsResponse -> Bool
$c== :: ListOfferingPromotionsResponse
-> ListOfferingPromotionsResponse -> Bool
Prelude.Eq, ReadPrec [ListOfferingPromotionsResponse]
ReadPrec ListOfferingPromotionsResponse
Int -> ReadS ListOfferingPromotionsResponse
ReadS [ListOfferingPromotionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOfferingPromotionsResponse]
$creadListPrec :: ReadPrec [ListOfferingPromotionsResponse]
readPrec :: ReadPrec ListOfferingPromotionsResponse
$creadPrec :: ReadPrec ListOfferingPromotionsResponse
readList :: ReadS [ListOfferingPromotionsResponse]
$creadList :: ReadS [ListOfferingPromotionsResponse]
readsPrec :: Int -> ReadS ListOfferingPromotionsResponse
$creadsPrec :: Int -> ReadS ListOfferingPromotionsResponse
Prelude.Read, Int -> ListOfferingPromotionsResponse -> ShowS
[ListOfferingPromotionsResponse] -> ShowS
ListOfferingPromotionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOfferingPromotionsResponse] -> ShowS
$cshowList :: [ListOfferingPromotionsResponse] -> ShowS
show :: ListOfferingPromotionsResponse -> String
$cshow :: ListOfferingPromotionsResponse -> String
showsPrec :: Int -> ListOfferingPromotionsResponse -> ShowS
$cshowsPrec :: Int -> ListOfferingPromotionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListOfferingPromotionsResponse x
-> ListOfferingPromotionsResponse
forall x.
ListOfferingPromotionsResponse
-> Rep ListOfferingPromotionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOfferingPromotionsResponse x
-> ListOfferingPromotionsResponse
$cfrom :: forall x.
ListOfferingPromotionsResponse
-> Rep ListOfferingPromotionsResponse x
Prelude.Generic)
newListOfferingPromotionsResponse ::
Prelude.Int ->
ListOfferingPromotionsResponse
newListOfferingPromotionsResponse :: Int -> ListOfferingPromotionsResponse
newListOfferingPromotionsResponse Int
pHttpStatus_ =
ListOfferingPromotionsResponse'
{ $sel:nextToken:ListOfferingPromotionsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:offeringPromotions:ListOfferingPromotionsResponse' :: Maybe [OfferingPromotion]
offeringPromotions = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListOfferingPromotionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listOfferingPromotionsResponse_nextToken :: Lens.Lens' ListOfferingPromotionsResponse (Prelude.Maybe Prelude.Text)
listOfferingPromotionsResponse_nextToken :: Lens' ListOfferingPromotionsResponse (Maybe Text)
listOfferingPromotionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingPromotionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOfferingPromotionsResponse
s@ListOfferingPromotionsResponse' {} Maybe Text
a -> ListOfferingPromotionsResponse
s {$sel:nextToken:ListOfferingPromotionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOfferingPromotionsResponse)
listOfferingPromotionsResponse_offeringPromotions :: Lens.Lens' ListOfferingPromotionsResponse (Prelude.Maybe [OfferingPromotion])
listOfferingPromotionsResponse_offeringPromotions :: Lens' ListOfferingPromotionsResponse (Maybe [OfferingPromotion])
listOfferingPromotionsResponse_offeringPromotions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingPromotionsResponse' {Maybe [OfferingPromotion]
offeringPromotions :: Maybe [OfferingPromotion]
$sel:offeringPromotions:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Maybe [OfferingPromotion]
offeringPromotions} -> Maybe [OfferingPromotion]
offeringPromotions) (\s :: ListOfferingPromotionsResponse
s@ListOfferingPromotionsResponse' {} Maybe [OfferingPromotion]
a -> ListOfferingPromotionsResponse
s {$sel:offeringPromotions:ListOfferingPromotionsResponse' :: Maybe [OfferingPromotion]
offeringPromotions = Maybe [OfferingPromotion]
a} :: ListOfferingPromotionsResponse) 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
listOfferingPromotionsResponse_httpStatus :: Lens.Lens' ListOfferingPromotionsResponse Prelude.Int
listOfferingPromotionsResponse_httpStatus :: Lens' ListOfferingPromotionsResponse Int
listOfferingPromotionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOfferingPromotionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListOfferingPromotionsResponse
s@ListOfferingPromotionsResponse' {} Int
a -> ListOfferingPromotionsResponse
s {$sel:httpStatus:ListOfferingPromotionsResponse' :: Int
httpStatus = Int
a} :: ListOfferingPromotionsResponse)
instance
Prelude.NFData
ListOfferingPromotionsResponse
where
rnf :: ListOfferingPromotionsResponse -> ()
rnf ListOfferingPromotionsResponse' {Int
Maybe [OfferingPromotion]
Maybe Text
httpStatus :: Int
offeringPromotions :: Maybe [OfferingPromotion]
nextToken :: Maybe Text
$sel:httpStatus:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Int
$sel:offeringPromotions:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Maybe [OfferingPromotion]
$sel:nextToken:ListOfferingPromotionsResponse' :: ListOfferingPromotionsResponse -> Maybe Text
..} =
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 Maybe [OfferingPromotion]
offeringPromotions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus