{-# 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.SSMIncidents.ListResponsePlans
(
ListResponsePlans (..),
newListResponsePlans,
listResponsePlans_maxResults,
listResponsePlans_nextToken,
ListResponsePlansResponse (..),
newListResponsePlansResponse,
listResponsePlansResponse_nextToken,
listResponsePlansResponse_httpStatus,
listResponsePlansResponse_responsePlanSummaries,
)
where
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
import Amazonka.SSMIncidents.Types
data ListResponsePlans = ListResponsePlans'
{
ListResponsePlans -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListResponsePlans -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListResponsePlans -> ListResponsePlans -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResponsePlans -> ListResponsePlans -> Bool
$c/= :: ListResponsePlans -> ListResponsePlans -> Bool
== :: ListResponsePlans -> ListResponsePlans -> Bool
$c== :: ListResponsePlans -> ListResponsePlans -> Bool
Prelude.Eq, ReadPrec [ListResponsePlans]
ReadPrec ListResponsePlans
Int -> ReadS ListResponsePlans
ReadS [ListResponsePlans]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResponsePlans]
$creadListPrec :: ReadPrec [ListResponsePlans]
readPrec :: ReadPrec ListResponsePlans
$creadPrec :: ReadPrec ListResponsePlans
readList :: ReadS [ListResponsePlans]
$creadList :: ReadS [ListResponsePlans]
readsPrec :: Int -> ReadS ListResponsePlans
$creadsPrec :: Int -> ReadS ListResponsePlans
Prelude.Read, Int -> ListResponsePlans -> ShowS
[ListResponsePlans] -> ShowS
ListResponsePlans -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResponsePlans] -> ShowS
$cshowList :: [ListResponsePlans] -> ShowS
show :: ListResponsePlans -> String
$cshow :: ListResponsePlans -> String
showsPrec :: Int -> ListResponsePlans -> ShowS
$cshowsPrec :: Int -> ListResponsePlans -> ShowS
Prelude.Show, forall x. Rep ListResponsePlans x -> ListResponsePlans
forall x. ListResponsePlans -> Rep ListResponsePlans x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResponsePlans x -> ListResponsePlans
$cfrom :: forall x. ListResponsePlans -> Rep ListResponsePlans x
Prelude.Generic)
newListResponsePlans ::
ListResponsePlans
newListResponsePlans :: ListResponsePlans
newListResponsePlans =
ListResponsePlans'
{ $sel:maxResults:ListResponsePlans' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListResponsePlans' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listResponsePlans_maxResults :: Lens.Lens' ListResponsePlans (Prelude.Maybe Prelude.Natural)
listResponsePlans_maxResults :: Lens' ListResponsePlans (Maybe Natural)
listResponsePlans_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResponsePlans' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResponsePlans' :: ListResponsePlans -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResponsePlans
s@ListResponsePlans' {} Maybe Natural
a -> ListResponsePlans
s {$sel:maxResults:ListResponsePlans' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResponsePlans)
listResponsePlans_nextToken :: Lens.Lens' ListResponsePlans (Prelude.Maybe Prelude.Text)
listResponsePlans_nextToken :: Lens' ListResponsePlans (Maybe Text)
listResponsePlans_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResponsePlans' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResponsePlans' :: ListResponsePlans -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResponsePlans
s@ListResponsePlans' {} Maybe Text
a -> ListResponsePlans
s {$sel:nextToken:ListResponsePlans' :: Maybe Text
nextToken = Maybe Text
a} :: ListResponsePlans)
instance Core.AWSPager ListResponsePlans where
page :: ListResponsePlans
-> AWSResponse ListResponsePlans -> Maybe ListResponsePlans
page ListResponsePlans
rq AWSResponse ListResponsePlans
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListResponsePlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListResponsePlansResponse (Maybe Text)
listResponsePlansResponse_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 ListResponsePlans
rs
forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListResponsePlansResponse [ResponsePlanSummary]
listResponsePlansResponse_responsePlanSummaries
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListResponsePlans
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListResponsePlans (Maybe Text)
listResponsePlans_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListResponsePlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListResponsePlansResponse (Maybe Text)
listResponsePlansResponse_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 ListResponsePlans where
type
AWSResponse ListResponsePlans =
ListResponsePlansResponse
request :: (Service -> Service)
-> ListResponsePlans -> Request ListResponsePlans
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 ListResponsePlans
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListResponsePlans)))
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
-> Int -> [ResponsePlanSummary] -> ListResponsePlansResponse
ListResponsePlansResponse'
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
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
"responsePlanSummaries"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListResponsePlans where
hashWithSalt :: Int -> ListResponsePlans -> Int
hashWithSalt Int
_salt ListResponsePlans' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListResponsePlans' :: ListResponsePlans -> Maybe Text
$sel:maxResults:ListResponsePlans' :: ListResponsePlans -> Maybe Natural
..} =
Int
_salt
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 ListResponsePlans where
rnf :: ListResponsePlans -> ()
rnf ListResponsePlans' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListResponsePlans' :: ListResponsePlans -> Maybe Text
$sel:maxResults:ListResponsePlans' :: ListResponsePlans -> Maybe Natural
..} =
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 ListResponsePlans where
toHeaders :: ListResponsePlans -> 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 ListResponsePlans where
toJSON :: ListResponsePlans -> Value
toJSON ListResponsePlans' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListResponsePlans' :: ListResponsePlans -> Maybe Text
$sel:maxResults:ListResponsePlans' :: ListResponsePlans -> Maybe Natural
..} =
[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 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 ListResponsePlans where
toPath :: ListResponsePlans -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/listResponsePlans"
instance Data.ToQuery ListResponsePlans where
toQuery :: ListResponsePlans -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListResponsePlansResponse = ListResponsePlansResponse'
{
ListResponsePlansResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListResponsePlansResponse -> Int
httpStatus :: Prelude.Int,
ListResponsePlansResponse -> [ResponsePlanSummary]
responsePlanSummaries :: [ResponsePlanSummary]
}
deriving (ListResponsePlansResponse -> ListResponsePlansResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResponsePlansResponse -> ListResponsePlansResponse -> Bool
$c/= :: ListResponsePlansResponse -> ListResponsePlansResponse -> Bool
== :: ListResponsePlansResponse -> ListResponsePlansResponse -> Bool
$c== :: ListResponsePlansResponse -> ListResponsePlansResponse -> Bool
Prelude.Eq, ReadPrec [ListResponsePlansResponse]
ReadPrec ListResponsePlansResponse
Int -> ReadS ListResponsePlansResponse
ReadS [ListResponsePlansResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResponsePlansResponse]
$creadListPrec :: ReadPrec [ListResponsePlansResponse]
readPrec :: ReadPrec ListResponsePlansResponse
$creadPrec :: ReadPrec ListResponsePlansResponse
readList :: ReadS [ListResponsePlansResponse]
$creadList :: ReadS [ListResponsePlansResponse]
readsPrec :: Int -> ReadS ListResponsePlansResponse
$creadsPrec :: Int -> ReadS ListResponsePlansResponse
Prelude.Read, Int -> ListResponsePlansResponse -> ShowS
[ListResponsePlansResponse] -> ShowS
ListResponsePlansResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResponsePlansResponse] -> ShowS
$cshowList :: [ListResponsePlansResponse] -> ShowS
show :: ListResponsePlansResponse -> String
$cshow :: ListResponsePlansResponse -> String
showsPrec :: Int -> ListResponsePlansResponse -> ShowS
$cshowsPrec :: Int -> ListResponsePlansResponse -> ShowS
Prelude.Show, forall x.
Rep ListResponsePlansResponse x -> ListResponsePlansResponse
forall x.
ListResponsePlansResponse -> Rep ListResponsePlansResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResponsePlansResponse x -> ListResponsePlansResponse
$cfrom :: forall x.
ListResponsePlansResponse -> Rep ListResponsePlansResponse x
Prelude.Generic)
newListResponsePlansResponse ::
Prelude.Int ->
ListResponsePlansResponse
newListResponsePlansResponse :: Int -> ListResponsePlansResponse
newListResponsePlansResponse Int
pHttpStatus_ =
ListResponsePlansResponse'
{ $sel:nextToken:ListResponsePlansResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListResponsePlansResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:responsePlanSummaries:ListResponsePlansResponse' :: [ResponsePlanSummary]
responsePlanSummaries = forall a. Monoid a => a
Prelude.mempty
}
listResponsePlansResponse_nextToken :: Lens.Lens' ListResponsePlansResponse (Prelude.Maybe Prelude.Text)
listResponsePlansResponse_nextToken :: Lens' ListResponsePlansResponse (Maybe Text)
listResponsePlansResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResponsePlansResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResponsePlansResponse' :: ListResponsePlansResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResponsePlansResponse
s@ListResponsePlansResponse' {} Maybe Text
a -> ListResponsePlansResponse
s {$sel:nextToken:ListResponsePlansResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResponsePlansResponse)
listResponsePlansResponse_httpStatus :: Lens.Lens' ListResponsePlansResponse Prelude.Int
listResponsePlansResponse_httpStatus :: Lens' ListResponsePlansResponse Int
listResponsePlansResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResponsePlansResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListResponsePlansResponse' :: ListResponsePlansResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListResponsePlansResponse
s@ListResponsePlansResponse' {} Int
a -> ListResponsePlansResponse
s {$sel:httpStatus:ListResponsePlansResponse' :: Int
httpStatus = Int
a} :: ListResponsePlansResponse)
listResponsePlansResponse_responsePlanSummaries :: Lens.Lens' ListResponsePlansResponse [ResponsePlanSummary]
listResponsePlansResponse_responsePlanSummaries :: Lens' ListResponsePlansResponse [ResponsePlanSummary]
listResponsePlansResponse_responsePlanSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResponsePlansResponse' {[ResponsePlanSummary]
responsePlanSummaries :: [ResponsePlanSummary]
$sel:responsePlanSummaries:ListResponsePlansResponse' :: ListResponsePlansResponse -> [ResponsePlanSummary]
responsePlanSummaries} -> [ResponsePlanSummary]
responsePlanSummaries) (\s :: ListResponsePlansResponse
s@ListResponsePlansResponse' {} [ResponsePlanSummary]
a -> ListResponsePlansResponse
s {$sel:responsePlanSummaries:ListResponsePlansResponse' :: [ResponsePlanSummary]
responsePlanSummaries = [ResponsePlanSummary]
a} :: ListResponsePlansResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListResponsePlansResponse where
rnf :: ListResponsePlansResponse -> ()
rnf ListResponsePlansResponse' {Int
[ResponsePlanSummary]
Maybe Text
responsePlanSummaries :: [ResponsePlanSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:responsePlanSummaries:ListResponsePlansResponse' :: ListResponsePlansResponse -> [ResponsePlanSummary]
$sel:httpStatus:ListResponsePlansResponse' :: ListResponsePlansResponse -> Int
$sel:nextToken:ListResponsePlansResponse' :: ListResponsePlansResponse -> 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 Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ResponsePlanSummary]
responsePlanSummaries