{-# 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.ApiGatewayV2.GetDeployments
(
GetDeployments (..),
newGetDeployments,
getDeployments_maxResults,
getDeployments_nextToken,
getDeployments_apiId,
GetDeploymentsResponse (..),
newGetDeploymentsResponse,
getDeploymentsResponse_items,
getDeploymentsResponse_nextToken,
getDeploymentsResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.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 GetDeployments = GetDeployments'
{
GetDeployments -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
GetDeployments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDeployments -> Text
apiId :: Prelude.Text
}
deriving (GetDeployments -> GetDeployments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeployments -> GetDeployments -> Bool
$c/= :: GetDeployments -> GetDeployments -> Bool
== :: GetDeployments -> GetDeployments -> Bool
$c== :: GetDeployments -> GetDeployments -> Bool
Prelude.Eq, ReadPrec [GetDeployments]
ReadPrec GetDeployments
Int -> ReadS GetDeployments
ReadS [GetDeployments]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeployments]
$creadListPrec :: ReadPrec [GetDeployments]
readPrec :: ReadPrec GetDeployments
$creadPrec :: ReadPrec GetDeployments
readList :: ReadS [GetDeployments]
$creadList :: ReadS [GetDeployments]
readsPrec :: Int -> ReadS GetDeployments
$creadsPrec :: Int -> ReadS GetDeployments
Prelude.Read, Int -> GetDeployments -> ShowS
[GetDeployments] -> ShowS
GetDeployments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeployments] -> ShowS
$cshowList :: [GetDeployments] -> ShowS
show :: GetDeployments -> String
$cshow :: GetDeployments -> String
showsPrec :: Int -> GetDeployments -> ShowS
$cshowsPrec :: Int -> GetDeployments -> ShowS
Prelude.Show, forall x. Rep GetDeployments x -> GetDeployments
forall x. GetDeployments -> Rep GetDeployments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeployments x -> GetDeployments
$cfrom :: forall x. GetDeployments -> Rep GetDeployments x
Prelude.Generic)
newGetDeployments ::
Prelude.Text ->
GetDeployments
newGetDeployments :: Text -> GetDeployments
newGetDeployments Text
pApiId_ =
GetDeployments'
{ $sel:maxResults:GetDeployments' :: Maybe Text
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDeployments' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:apiId:GetDeployments' :: Text
apiId = Text
pApiId_
}
getDeployments_maxResults :: Lens.Lens' GetDeployments (Prelude.Maybe Prelude.Text)
getDeployments_maxResults :: Lens' GetDeployments (Maybe Text)
getDeployments_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeployments' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:GetDeployments' :: GetDeployments -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: GetDeployments
s@GetDeployments' {} Maybe Text
a -> GetDeployments
s {$sel:maxResults:GetDeployments' :: Maybe Text
maxResults = Maybe Text
a} :: GetDeployments)
getDeployments_nextToken :: Lens.Lens' GetDeployments (Prelude.Maybe Prelude.Text)
getDeployments_nextToken :: Lens' GetDeployments (Maybe Text)
getDeployments_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeployments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDeployments' :: GetDeployments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDeployments
s@GetDeployments' {} Maybe Text
a -> GetDeployments
s {$sel:nextToken:GetDeployments' :: Maybe Text
nextToken = Maybe Text
a} :: GetDeployments)
getDeployments_apiId :: Lens.Lens' GetDeployments Prelude.Text
getDeployments_apiId :: Lens' GetDeployments Text
getDeployments_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeployments' {Text
apiId :: Text
$sel:apiId:GetDeployments' :: GetDeployments -> Text
apiId} -> Text
apiId) (\s :: GetDeployments
s@GetDeployments' {} Text
a -> GetDeployments
s {$sel:apiId:GetDeployments' :: Text
apiId = Text
a} :: GetDeployments)
instance Core.AWSPager GetDeployments where
page :: GetDeployments
-> AWSResponse GetDeployments -> Maybe GetDeployments
page GetDeployments
rq AWSResponse GetDeployments
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetDeployments
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDeploymentsResponse (Maybe Text)
getDeploymentsResponse_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 GetDeployments
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDeploymentsResponse (Maybe [Deployment])
getDeploymentsResponse_items
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.$ GetDeployments
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetDeployments (Maybe Text)
getDeployments_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetDeployments
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDeploymentsResponse (Maybe Text)
getDeploymentsResponse_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 GetDeployments where
type
AWSResponse GetDeployments =
GetDeploymentsResponse
request :: (Service -> Service) -> GetDeployments -> Request GetDeployments
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDeployments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDeployments)))
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 [Deployment] -> Maybe Text -> Int -> GetDeploymentsResponse
GetDeploymentsResponse'
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
"items" 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.<*> (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))
)
instance Prelude.Hashable GetDeployments where
hashWithSalt :: Int -> GetDeployments -> Int
hashWithSalt Int
_salt GetDeployments' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetDeployments' :: GetDeployments -> Text
$sel:nextToken:GetDeployments' :: GetDeployments -> Maybe Text
$sel:maxResults:GetDeployments' :: GetDeployments -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
instance Prelude.NFData GetDeployments where
rnf :: GetDeployments -> ()
rnf GetDeployments' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetDeployments' :: GetDeployments -> Text
$sel:nextToken:GetDeployments' :: GetDeployments -> Maybe Text
$sel:maxResults:GetDeployments' :: GetDeployments -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
apiId
instance Data.ToHeaders GetDeployments where
toHeaders :: GetDeployments -> 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.ToPath GetDeployments where
toPath :: GetDeployments -> ByteString
toPath GetDeployments' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetDeployments' :: GetDeployments -> Text
$sel:nextToken:GetDeployments' :: GetDeployments -> Maybe Text
$sel:maxResults:GetDeployments' :: GetDeployments -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/deployments"]
instance Data.ToQuery GetDeployments where
toQuery :: GetDeployments -> QueryString
toQuery GetDeployments' {Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Text
$sel:apiId:GetDeployments' :: GetDeployments -> Text
$sel:nextToken:GetDeployments' :: GetDeployments -> Maybe Text
$sel:maxResults:GetDeployments' :: GetDeployments -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data GetDeploymentsResponse = GetDeploymentsResponse'
{
GetDeploymentsResponse -> Maybe [Deployment]
items :: Prelude.Maybe [Deployment],
GetDeploymentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDeploymentsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDeploymentsResponse -> GetDeploymentsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeploymentsResponse -> GetDeploymentsResponse -> Bool
$c/= :: GetDeploymentsResponse -> GetDeploymentsResponse -> Bool
== :: GetDeploymentsResponse -> GetDeploymentsResponse -> Bool
$c== :: GetDeploymentsResponse -> GetDeploymentsResponse -> Bool
Prelude.Eq, ReadPrec [GetDeploymentsResponse]
ReadPrec GetDeploymentsResponse
Int -> ReadS GetDeploymentsResponse
ReadS [GetDeploymentsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeploymentsResponse]
$creadListPrec :: ReadPrec [GetDeploymentsResponse]
readPrec :: ReadPrec GetDeploymentsResponse
$creadPrec :: ReadPrec GetDeploymentsResponse
readList :: ReadS [GetDeploymentsResponse]
$creadList :: ReadS [GetDeploymentsResponse]
readsPrec :: Int -> ReadS GetDeploymentsResponse
$creadsPrec :: Int -> ReadS GetDeploymentsResponse
Prelude.Read, Int -> GetDeploymentsResponse -> ShowS
[GetDeploymentsResponse] -> ShowS
GetDeploymentsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeploymentsResponse] -> ShowS
$cshowList :: [GetDeploymentsResponse] -> ShowS
show :: GetDeploymentsResponse -> String
$cshow :: GetDeploymentsResponse -> String
showsPrec :: Int -> GetDeploymentsResponse -> ShowS
$cshowsPrec :: Int -> GetDeploymentsResponse -> ShowS
Prelude.Show, forall x. Rep GetDeploymentsResponse x -> GetDeploymentsResponse
forall x. GetDeploymentsResponse -> Rep GetDeploymentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeploymentsResponse x -> GetDeploymentsResponse
$cfrom :: forall x. GetDeploymentsResponse -> Rep GetDeploymentsResponse x
Prelude.Generic)
newGetDeploymentsResponse ::
Prelude.Int ->
GetDeploymentsResponse
newGetDeploymentsResponse :: Int -> GetDeploymentsResponse
newGetDeploymentsResponse Int
pHttpStatus_ =
GetDeploymentsResponse'
{ $sel:items:GetDeploymentsResponse' :: Maybe [Deployment]
items = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDeploymentsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDeploymentsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDeploymentsResponse_items :: Lens.Lens' GetDeploymentsResponse (Prelude.Maybe [Deployment])
getDeploymentsResponse_items :: Lens' GetDeploymentsResponse (Maybe [Deployment])
getDeploymentsResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentsResponse' {Maybe [Deployment]
items :: Maybe [Deployment]
$sel:items:GetDeploymentsResponse' :: GetDeploymentsResponse -> Maybe [Deployment]
items} -> Maybe [Deployment]
items) (\s :: GetDeploymentsResponse
s@GetDeploymentsResponse' {} Maybe [Deployment]
a -> GetDeploymentsResponse
s {$sel:items:GetDeploymentsResponse' :: Maybe [Deployment]
items = Maybe [Deployment]
a} :: GetDeploymentsResponse) 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
getDeploymentsResponse_nextToken :: Lens.Lens' GetDeploymentsResponse (Prelude.Maybe Prelude.Text)
getDeploymentsResponse_nextToken :: Lens' GetDeploymentsResponse (Maybe Text)
getDeploymentsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDeploymentsResponse' :: GetDeploymentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDeploymentsResponse
s@GetDeploymentsResponse' {} Maybe Text
a -> GetDeploymentsResponse
s {$sel:nextToken:GetDeploymentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetDeploymentsResponse)
getDeploymentsResponse_httpStatus :: Lens.Lens' GetDeploymentsResponse Prelude.Int
getDeploymentsResponse_httpStatus :: Lens' GetDeploymentsResponse Int
getDeploymentsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDeploymentsResponse' :: GetDeploymentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDeploymentsResponse
s@GetDeploymentsResponse' {} Int
a -> GetDeploymentsResponse
s {$sel:httpStatus:GetDeploymentsResponse' :: Int
httpStatus = Int
a} :: GetDeploymentsResponse)
instance Prelude.NFData GetDeploymentsResponse where
rnf :: GetDeploymentsResponse -> ()
rnf GetDeploymentsResponse' {Int
Maybe [Deployment]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
items :: Maybe [Deployment]
$sel:httpStatus:GetDeploymentsResponse' :: GetDeploymentsResponse -> Int
$sel:nextToken:GetDeploymentsResponse' :: GetDeploymentsResponse -> Maybe Text
$sel:items:GetDeploymentsResponse' :: GetDeploymentsResponse -> Maybe [Deployment]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Deployment]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` 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