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