{-# 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.Proton.ListEnvironmentTemplates
(
ListEnvironmentTemplates (..),
newListEnvironmentTemplates,
listEnvironmentTemplates_maxResults,
listEnvironmentTemplates_nextToken,
ListEnvironmentTemplatesResponse (..),
newListEnvironmentTemplatesResponse,
listEnvironmentTemplatesResponse_nextToken,
listEnvironmentTemplatesResponse_httpStatus,
listEnvironmentTemplatesResponse_templates,
)
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 Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListEnvironmentTemplates = ListEnvironmentTemplates'
{
ListEnvironmentTemplates -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListEnvironmentTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListEnvironmentTemplates -> ListEnvironmentTemplates -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentTemplates -> ListEnvironmentTemplates -> Bool
$c/= :: ListEnvironmentTemplates -> ListEnvironmentTemplates -> Bool
== :: ListEnvironmentTemplates -> ListEnvironmentTemplates -> Bool
$c== :: ListEnvironmentTemplates -> ListEnvironmentTemplates -> Bool
Prelude.Eq, ReadPrec [ListEnvironmentTemplates]
ReadPrec ListEnvironmentTemplates
Int -> ReadS ListEnvironmentTemplates
ReadS [ListEnvironmentTemplates]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEnvironmentTemplates]
$creadListPrec :: ReadPrec [ListEnvironmentTemplates]
readPrec :: ReadPrec ListEnvironmentTemplates
$creadPrec :: ReadPrec ListEnvironmentTemplates
readList :: ReadS [ListEnvironmentTemplates]
$creadList :: ReadS [ListEnvironmentTemplates]
readsPrec :: Int -> ReadS ListEnvironmentTemplates
$creadsPrec :: Int -> ReadS ListEnvironmentTemplates
Prelude.Read, Int -> ListEnvironmentTemplates -> ShowS
[ListEnvironmentTemplates] -> ShowS
ListEnvironmentTemplates -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentTemplates] -> ShowS
$cshowList :: [ListEnvironmentTemplates] -> ShowS
show :: ListEnvironmentTemplates -> String
$cshow :: ListEnvironmentTemplates -> String
showsPrec :: Int -> ListEnvironmentTemplates -> ShowS
$cshowsPrec :: Int -> ListEnvironmentTemplates -> ShowS
Prelude.Show, forall x.
Rep ListEnvironmentTemplates x -> ListEnvironmentTemplates
forall x.
ListEnvironmentTemplates -> Rep ListEnvironmentTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentTemplates x -> ListEnvironmentTemplates
$cfrom :: forall x.
ListEnvironmentTemplates -> Rep ListEnvironmentTemplates x
Prelude.Generic)
newListEnvironmentTemplates ::
ListEnvironmentTemplates
newListEnvironmentTemplates :: ListEnvironmentTemplates
newListEnvironmentTemplates =
ListEnvironmentTemplates'
{ $sel:maxResults:ListEnvironmentTemplates' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEnvironmentTemplates' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listEnvironmentTemplates_maxResults :: Lens.Lens' ListEnvironmentTemplates (Prelude.Maybe Prelude.Natural)
listEnvironmentTemplates_maxResults :: Lens' ListEnvironmentTemplates (Maybe Natural)
listEnvironmentTemplates_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplates' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEnvironmentTemplates
s@ListEnvironmentTemplates' {} Maybe Natural
a -> ListEnvironmentTemplates
s {$sel:maxResults:ListEnvironmentTemplates' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEnvironmentTemplates)
listEnvironmentTemplates_nextToken :: Lens.Lens' ListEnvironmentTemplates (Prelude.Maybe Prelude.Text)
listEnvironmentTemplates_nextToken :: Lens' ListEnvironmentTemplates (Maybe Text)
listEnvironmentTemplates_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentTemplates
s@ListEnvironmentTemplates' {} Maybe Text
a -> ListEnvironmentTemplates
s {$sel:nextToken:ListEnvironmentTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentTemplates)
instance Core.AWSPager ListEnvironmentTemplates where
page :: ListEnvironmentTemplates
-> AWSResponse ListEnvironmentTemplates
-> Maybe ListEnvironmentTemplates
page ListEnvironmentTemplates
rq AWSResponse ListEnvironmentTemplates
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListEnvironmentTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEnvironmentTemplatesResponse (Maybe Text)
listEnvironmentTemplatesResponse_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 ListEnvironmentTemplates
rs
forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListEnvironmentTemplatesResponse [EnvironmentTemplateSummary]
listEnvironmentTemplatesResponse_templates
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListEnvironmentTemplates
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListEnvironmentTemplates (Maybe Text)
listEnvironmentTemplates_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEnvironmentTemplates
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEnvironmentTemplatesResponse (Maybe Text)
listEnvironmentTemplatesResponse_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 ListEnvironmentTemplates where
type
AWSResponse ListEnvironmentTemplates =
ListEnvironmentTemplatesResponse
request :: (Service -> Service)
-> ListEnvironmentTemplates -> Request ListEnvironmentTemplates
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 ListEnvironmentTemplates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListEnvironmentTemplates)))
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
-> [EnvironmentTemplateSummary]
-> ListEnvironmentTemplatesResponse
ListEnvironmentTemplatesResponse'
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
"templates" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListEnvironmentTemplates where
hashWithSalt :: Int -> ListEnvironmentTemplates -> Int
hashWithSalt Int
_salt ListEnvironmentTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> Maybe Text
$sel:maxResults:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> 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 ListEnvironmentTemplates where
rnf :: ListEnvironmentTemplates -> ()
rnf ListEnvironmentTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> Maybe Text
$sel:maxResults:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> 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 ListEnvironmentTemplates where
toHeaders :: ListEnvironmentTemplates -> 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
"AwsProton20200720.ListEnvironmentTemplates" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListEnvironmentTemplates where
toJSON :: ListEnvironmentTemplates -> Value
toJSON ListEnvironmentTemplates' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> Maybe Text
$sel:maxResults:ListEnvironmentTemplates' :: ListEnvironmentTemplates -> 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 ListEnvironmentTemplates where
toPath :: ListEnvironmentTemplates -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListEnvironmentTemplates where
toQuery :: ListEnvironmentTemplates -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListEnvironmentTemplatesResponse = ListEnvironmentTemplatesResponse'
{
ListEnvironmentTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEnvironmentTemplatesResponse -> Int
httpStatus :: Prelude.Int,
ListEnvironmentTemplatesResponse -> [EnvironmentTemplateSummary]
templates :: [EnvironmentTemplateSummary]
}
deriving (ListEnvironmentTemplatesResponse
-> ListEnvironmentTemplatesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentTemplatesResponse
-> ListEnvironmentTemplatesResponse -> Bool
$c/= :: ListEnvironmentTemplatesResponse
-> ListEnvironmentTemplatesResponse -> Bool
== :: ListEnvironmentTemplatesResponse
-> ListEnvironmentTemplatesResponse -> Bool
$c== :: ListEnvironmentTemplatesResponse
-> ListEnvironmentTemplatesResponse -> Bool
Prelude.Eq, Int -> ListEnvironmentTemplatesResponse -> ShowS
[ListEnvironmentTemplatesResponse] -> ShowS
ListEnvironmentTemplatesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentTemplatesResponse] -> ShowS
$cshowList :: [ListEnvironmentTemplatesResponse] -> ShowS
show :: ListEnvironmentTemplatesResponse -> String
$cshow :: ListEnvironmentTemplatesResponse -> String
showsPrec :: Int -> ListEnvironmentTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListEnvironmentTemplatesResponse -> ShowS
Prelude.Show, forall x.
Rep ListEnvironmentTemplatesResponse x
-> ListEnvironmentTemplatesResponse
forall x.
ListEnvironmentTemplatesResponse
-> Rep ListEnvironmentTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentTemplatesResponse x
-> ListEnvironmentTemplatesResponse
$cfrom :: forall x.
ListEnvironmentTemplatesResponse
-> Rep ListEnvironmentTemplatesResponse x
Prelude.Generic)
newListEnvironmentTemplatesResponse ::
Prelude.Int ->
ListEnvironmentTemplatesResponse
newListEnvironmentTemplatesResponse :: Int -> ListEnvironmentTemplatesResponse
newListEnvironmentTemplatesResponse Int
pHttpStatus_ =
ListEnvironmentTemplatesResponse'
{ $sel:nextToken:ListEnvironmentTemplatesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEnvironmentTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:templates:ListEnvironmentTemplatesResponse' :: [EnvironmentTemplateSummary]
templates = forall a. Monoid a => a
Prelude.mempty
}
listEnvironmentTemplatesResponse_nextToken :: Lens.Lens' ListEnvironmentTemplatesResponse (Prelude.Maybe Prelude.Text)
listEnvironmentTemplatesResponse_nextToken :: Lens' ListEnvironmentTemplatesResponse (Maybe Text)
listEnvironmentTemplatesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentTemplatesResponse
s@ListEnvironmentTemplatesResponse' {} Maybe Text
a -> ListEnvironmentTemplatesResponse
s {$sel:nextToken:ListEnvironmentTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentTemplatesResponse)
listEnvironmentTemplatesResponse_httpStatus :: Lens.Lens' ListEnvironmentTemplatesResponse Prelude.Int
listEnvironmentTemplatesResponse_httpStatus :: Lens' ListEnvironmentTemplatesResponse Int
listEnvironmentTemplatesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEnvironmentTemplatesResponse
s@ListEnvironmentTemplatesResponse' {} Int
a -> ListEnvironmentTemplatesResponse
s {$sel:httpStatus:ListEnvironmentTemplatesResponse' :: Int
httpStatus = Int
a} :: ListEnvironmentTemplatesResponse)
listEnvironmentTemplatesResponse_templates :: Lens.Lens' ListEnvironmentTemplatesResponse [EnvironmentTemplateSummary]
listEnvironmentTemplatesResponse_templates :: Lens' ListEnvironmentTemplatesResponse [EnvironmentTemplateSummary]
listEnvironmentTemplatesResponse_templates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentTemplatesResponse' {[EnvironmentTemplateSummary]
templates :: [EnvironmentTemplateSummary]
$sel:templates:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> [EnvironmentTemplateSummary]
templates} -> [EnvironmentTemplateSummary]
templates) (\s :: ListEnvironmentTemplatesResponse
s@ListEnvironmentTemplatesResponse' {} [EnvironmentTemplateSummary]
a -> ListEnvironmentTemplatesResponse
s {$sel:templates:ListEnvironmentTemplatesResponse' :: [EnvironmentTemplateSummary]
templates = [EnvironmentTemplateSummary]
a} :: ListEnvironmentTemplatesResponse) 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
ListEnvironmentTemplatesResponse
where
rnf :: ListEnvironmentTemplatesResponse -> ()
rnf ListEnvironmentTemplatesResponse' {Int
[EnvironmentTemplateSummary]
Maybe Text
templates :: [EnvironmentTemplateSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:templates:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> [EnvironmentTemplateSummary]
$sel:httpStatus:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> Int
$sel:nextToken:ListEnvironmentTemplatesResponse' :: ListEnvironmentTemplatesResponse -> 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 [EnvironmentTemplateSummary]
templates