{-# 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.Amplify.ListBranches
(
ListBranches (..),
newListBranches,
listBranches_nextToken,
listBranches_maxResults,
listBranches_appId,
ListBranchesResponse (..),
newListBranchesResponse,
listBranchesResponse_nextToken,
listBranchesResponse_httpStatus,
listBranchesResponse_branches,
)
where
import Amazonka.Amplify.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListBranches = ListBranches'
{
ListBranches -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBranches -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListBranches -> Text
appId :: Prelude.Text
}
deriving (ListBranches -> ListBranches -> Bool
(ListBranches -> ListBranches -> Bool)
-> (ListBranches -> ListBranches -> Bool) -> Eq ListBranches
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBranches -> ListBranches -> Bool
$c/= :: ListBranches -> ListBranches -> Bool
== :: ListBranches -> ListBranches -> Bool
$c== :: ListBranches -> ListBranches -> Bool
Prelude.Eq, ReadPrec [ListBranches]
ReadPrec ListBranches
Int -> ReadS ListBranches
ReadS [ListBranches]
(Int -> ReadS ListBranches)
-> ReadS [ListBranches]
-> ReadPrec ListBranches
-> ReadPrec [ListBranches]
-> Read ListBranches
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBranches]
$creadListPrec :: ReadPrec [ListBranches]
readPrec :: ReadPrec ListBranches
$creadPrec :: ReadPrec ListBranches
readList :: ReadS [ListBranches]
$creadList :: ReadS [ListBranches]
readsPrec :: Int -> ReadS ListBranches
$creadsPrec :: Int -> ReadS ListBranches
Prelude.Read, Int -> ListBranches -> ShowS
[ListBranches] -> ShowS
ListBranches -> String
(Int -> ListBranches -> ShowS)
-> (ListBranches -> String)
-> ([ListBranches] -> ShowS)
-> Show ListBranches
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBranches] -> ShowS
$cshowList :: [ListBranches] -> ShowS
show :: ListBranches -> String
$cshow :: ListBranches -> String
showsPrec :: Int -> ListBranches -> ShowS
$cshowsPrec :: Int -> ListBranches -> ShowS
Prelude.Show, (forall x. ListBranches -> Rep ListBranches x)
-> (forall x. Rep ListBranches x -> ListBranches)
-> Generic ListBranches
forall x. Rep ListBranches x -> ListBranches
forall x. ListBranches -> Rep ListBranches x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBranches x -> ListBranches
$cfrom :: forall x. ListBranches -> Rep ListBranches x
Prelude.Generic)
newListBranches ::
Prelude.Text ->
ListBranches
newListBranches :: Text -> ListBranches
newListBranches Text
pAppId_ =
ListBranches' :: Maybe Text -> Maybe Natural -> Text -> ListBranches
ListBranches'
{ $sel:nextToken:ListBranches' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListBranches' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:appId:ListBranches' :: Text
appId = Text
pAppId_
}
listBranches_nextToken :: Lens.Lens' ListBranches (Prelude.Maybe Prelude.Text)
listBranches_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListBranches -> f ListBranches
listBranches_nextToken = (ListBranches -> Maybe Text)
-> (ListBranches -> Maybe Text -> ListBranches)
-> Lens ListBranches ListBranches (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBranches
s@ListBranches' {} Maybe Text
a -> ListBranches
s {$sel:nextToken:ListBranches' :: Maybe Text
nextToken = Maybe Text
a} :: ListBranches)
listBranches_maxResults :: Lens.Lens' ListBranches (Prelude.Maybe Prelude.Natural)
listBranches_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListBranches -> f ListBranches
listBranches_maxResults = (ListBranches -> Maybe Natural)
-> (ListBranches -> Maybe Natural -> ListBranches)
-> Lens ListBranches ListBranches (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBranches
s@ListBranches' {} Maybe Natural
a -> ListBranches
s {$sel:maxResults:ListBranches' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBranches)
listBranches_appId :: Lens.Lens' ListBranches Prelude.Text
listBranches_appId :: (Text -> f Text) -> ListBranches -> f ListBranches
listBranches_appId = (ListBranches -> Text)
-> (ListBranches -> Text -> ListBranches)
-> Lens ListBranches ListBranches Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Text
appId :: Text
$sel:appId:ListBranches' :: ListBranches -> Text
appId} -> Text
appId) (\s :: ListBranches
s@ListBranches' {} Text
a -> ListBranches
s {$sel:appId:ListBranches' :: Text
appId = Text
a} :: ListBranches)
instance Core.AWSPager ListBranches where
page :: ListBranches -> AWSResponse ListBranches -> Maybe ListBranches
page ListBranches
rq AWSResponse ListBranches
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBranches
ListBranchesResponse
rs
ListBranchesResponse
-> Getting (First Text) ListBranchesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBranchesResponse -> Const (First Text) ListBranchesResponse
Lens' ListBranchesResponse (Maybe Text)
listBranchesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListBranchesResponse -> Const (First Text) ListBranchesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBranchesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListBranches
forall a. Maybe a
Prelude.Nothing
| [Branch] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListBranches
ListBranchesResponse
rs ListBranchesResponse
-> Getting [Branch] ListBranchesResponse [Branch] -> [Branch]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Branch] ListBranchesResponse [Branch]
Lens' ListBranchesResponse [Branch]
listBranchesResponse_branches) =
Maybe ListBranches
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListBranches -> Maybe ListBranches
forall a. a -> Maybe a
Prelude.Just (ListBranches -> Maybe ListBranches)
-> ListBranches -> Maybe ListBranches
forall a b. (a -> b) -> a -> b
Prelude.$
ListBranches
rq
ListBranches -> (ListBranches -> ListBranches) -> ListBranches
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListBranches -> Identity ListBranches
Lens ListBranches ListBranches (Maybe Text) (Maybe Text)
listBranches_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListBranches -> Identity ListBranches)
-> Maybe Text -> ListBranches -> ListBranches
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBranches
ListBranchesResponse
rs
ListBranchesResponse
-> Getting (First Text) ListBranchesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBranchesResponse -> Const (First Text) ListBranchesResponse
Lens' ListBranchesResponse (Maybe Text)
listBranchesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListBranchesResponse -> Const (First Text) ListBranchesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBranchesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListBranches where
type AWSResponse ListBranches = ListBranchesResponse
request :: ListBranches -> Request ListBranches
request = Service -> ListBranches -> Request ListBranches
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListBranches
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBranches)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListBranches))
-> Logger
-> Service
-> Proxy ListBranches
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBranches)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> [Branch] -> ListBranchesResponse
ListBranchesResponse'
(Maybe Text -> Int -> [Branch] -> ListBranchesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Branch] -> ListBranchesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Int -> [Branch] -> ListBranchesResponse)
-> Either String Int
-> Either String ([Branch] -> ListBranchesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String ([Branch] -> ListBranchesResponse)
-> Either String [Branch] -> Either String ListBranchesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Branch])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"branches" Either String (Maybe [Branch])
-> [Branch] -> Either String [Branch]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Branch]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListBranches
instance Prelude.NFData ListBranches
instance Core.ToHeaders ListBranches where
toHeaders :: ListBranches -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListBranches -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath ListBranches where
toPath :: ListBranches -> ByteString
toPath ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/apps/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId, ByteString
"/branches"]
instance Core.ToQuery ListBranches where
toQuery :: ListBranches -> QueryString
toQuery ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListBranchesResponse = ListBranchesResponse'
{
ListBranchesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBranchesResponse -> Int
httpStatus :: Prelude.Int,
ListBranchesResponse -> [Branch]
branches :: [Branch]
}
deriving (ListBranchesResponse -> ListBranchesResponse -> Bool
(ListBranchesResponse -> ListBranchesResponse -> Bool)
-> (ListBranchesResponse -> ListBranchesResponse -> Bool)
-> Eq ListBranchesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBranchesResponse -> ListBranchesResponse -> Bool
$c/= :: ListBranchesResponse -> ListBranchesResponse -> Bool
== :: ListBranchesResponse -> ListBranchesResponse -> Bool
$c== :: ListBranchesResponse -> ListBranchesResponse -> Bool
Prelude.Eq, Int -> ListBranchesResponse -> ShowS
[ListBranchesResponse] -> ShowS
ListBranchesResponse -> String
(Int -> ListBranchesResponse -> ShowS)
-> (ListBranchesResponse -> String)
-> ([ListBranchesResponse] -> ShowS)
-> Show ListBranchesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBranchesResponse] -> ShowS
$cshowList :: [ListBranchesResponse] -> ShowS
show :: ListBranchesResponse -> String
$cshow :: ListBranchesResponse -> String
showsPrec :: Int -> ListBranchesResponse -> ShowS
$cshowsPrec :: Int -> ListBranchesResponse -> ShowS
Prelude.Show, (forall x. ListBranchesResponse -> Rep ListBranchesResponse x)
-> (forall x. Rep ListBranchesResponse x -> ListBranchesResponse)
-> Generic ListBranchesResponse
forall x. Rep ListBranchesResponse x -> ListBranchesResponse
forall x. ListBranchesResponse -> Rep ListBranchesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBranchesResponse x -> ListBranchesResponse
$cfrom :: forall x. ListBranchesResponse -> Rep ListBranchesResponse x
Prelude.Generic)
newListBranchesResponse ::
Prelude.Int ->
ListBranchesResponse
newListBranchesResponse :: Int -> ListBranchesResponse
newListBranchesResponse Int
pHttpStatus_ =
ListBranchesResponse' :: Maybe Text -> Int -> [Branch] -> ListBranchesResponse
ListBranchesResponse'
{ $sel:nextToken:ListBranchesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBranchesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:branches:ListBranchesResponse' :: [Branch]
branches = [Branch]
forall a. Monoid a => a
Prelude.mempty
}
listBranchesResponse_nextToken :: Lens.Lens' ListBranchesResponse (Prelude.Maybe Prelude.Text)
listBranchesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBranchesResponse -> f ListBranchesResponse
listBranchesResponse_nextToken = (ListBranchesResponse -> Maybe Text)
-> (ListBranchesResponse -> Maybe Text -> ListBranchesResponse)
-> Lens' ListBranchesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBranchesResponse' :: ListBranchesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} Maybe Text
a -> ListBranchesResponse
s {$sel:nextToken:ListBranchesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBranchesResponse)
listBranchesResponse_httpStatus :: Lens.Lens' ListBranchesResponse Prelude.Int
listBranchesResponse_httpStatus :: (Int -> f Int) -> ListBranchesResponse -> f ListBranchesResponse
listBranchesResponse_httpStatus = (ListBranchesResponse -> Int)
-> (ListBranchesResponse -> Int -> ListBranchesResponse)
-> Lens ListBranchesResponse ListBranchesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListBranchesResponse' :: ListBranchesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} Int
a -> ListBranchesResponse
s {$sel:httpStatus:ListBranchesResponse' :: Int
httpStatus = Int
a} :: ListBranchesResponse)
listBranchesResponse_branches :: Lens.Lens' ListBranchesResponse [Branch]
listBranchesResponse_branches :: ([Branch] -> f [Branch])
-> ListBranchesResponse -> f ListBranchesResponse
listBranchesResponse_branches = (ListBranchesResponse -> [Branch])
-> (ListBranchesResponse -> [Branch] -> ListBranchesResponse)
-> Lens' ListBranchesResponse [Branch]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {[Branch]
branches :: [Branch]
$sel:branches:ListBranchesResponse' :: ListBranchesResponse -> [Branch]
branches} -> [Branch]
branches) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} [Branch]
a -> ListBranchesResponse
s {$sel:branches:ListBranchesResponse' :: [Branch]
branches = [Branch]
a} :: ListBranchesResponse) (([Branch] -> f [Branch])
-> ListBranchesResponse -> f ListBranchesResponse)
-> (([Branch] -> f [Branch]) -> [Branch] -> f [Branch])
-> ([Branch] -> f [Branch])
-> ListBranchesResponse
-> f ListBranchesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Branch] -> f [Branch]) -> [Branch] -> f [Branch]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListBranchesResponse