{-# 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.GetBranch
(
GetBranch (..),
newGetBranch,
getBranch_appId,
getBranch_branchName,
GetBranchResponse (..),
newGetBranchResponse,
getBranchResponse_httpStatus,
getBranchResponse_branch,
)
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 GetBranch = GetBranch'
{
GetBranch -> Text
appId :: Prelude.Text,
GetBranch -> Text
branchName :: Prelude.Text
}
deriving (GetBranch -> GetBranch -> Bool
(GetBranch -> GetBranch -> Bool)
-> (GetBranch -> GetBranch -> Bool) -> Eq GetBranch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBranch -> GetBranch -> Bool
$c/= :: GetBranch -> GetBranch -> Bool
== :: GetBranch -> GetBranch -> Bool
$c== :: GetBranch -> GetBranch -> Bool
Prelude.Eq, ReadPrec [GetBranch]
ReadPrec GetBranch
Int -> ReadS GetBranch
ReadS [GetBranch]
(Int -> ReadS GetBranch)
-> ReadS [GetBranch]
-> ReadPrec GetBranch
-> ReadPrec [GetBranch]
-> Read GetBranch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBranch]
$creadListPrec :: ReadPrec [GetBranch]
readPrec :: ReadPrec GetBranch
$creadPrec :: ReadPrec GetBranch
readList :: ReadS [GetBranch]
$creadList :: ReadS [GetBranch]
readsPrec :: Int -> ReadS GetBranch
$creadsPrec :: Int -> ReadS GetBranch
Prelude.Read, Int -> GetBranch -> ShowS
[GetBranch] -> ShowS
GetBranch -> String
(Int -> GetBranch -> ShowS)
-> (GetBranch -> String)
-> ([GetBranch] -> ShowS)
-> Show GetBranch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBranch] -> ShowS
$cshowList :: [GetBranch] -> ShowS
show :: GetBranch -> String
$cshow :: GetBranch -> String
showsPrec :: Int -> GetBranch -> ShowS
$cshowsPrec :: Int -> GetBranch -> ShowS
Prelude.Show, (forall x. GetBranch -> Rep GetBranch x)
-> (forall x. Rep GetBranch x -> GetBranch) -> Generic GetBranch
forall x. Rep GetBranch x -> GetBranch
forall x. GetBranch -> Rep GetBranch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBranch x -> GetBranch
$cfrom :: forall x. GetBranch -> Rep GetBranch x
Prelude.Generic)
newGetBranch ::
Prelude.Text ->
Prelude.Text ->
GetBranch
newGetBranch :: Text -> Text -> GetBranch
newGetBranch Text
pAppId_ Text
pBranchName_ =
GetBranch' :: Text -> Text -> GetBranch
GetBranch'
{ $sel:appId:GetBranch' :: Text
appId = Text
pAppId_,
$sel:branchName:GetBranch' :: Text
branchName = Text
pBranchName_
}
getBranch_appId :: Lens.Lens' GetBranch Prelude.Text
getBranch_appId :: (Text -> f Text) -> GetBranch -> f GetBranch
getBranch_appId = (GetBranch -> Text)
-> (GetBranch -> Text -> GetBranch)
-> Lens GetBranch GetBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBranch' {Text
appId :: Text
$sel:appId:GetBranch' :: GetBranch -> Text
appId} -> Text
appId) (\s :: GetBranch
s@GetBranch' {} Text
a -> GetBranch
s {$sel:appId:GetBranch' :: Text
appId = Text
a} :: GetBranch)
getBranch_branchName :: Lens.Lens' GetBranch Prelude.Text
getBranch_branchName :: (Text -> f Text) -> GetBranch -> f GetBranch
getBranch_branchName = (GetBranch -> Text)
-> (GetBranch -> Text -> GetBranch)
-> Lens GetBranch GetBranch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBranch' {Text
branchName :: Text
$sel:branchName:GetBranch' :: GetBranch -> Text
branchName} -> Text
branchName) (\s :: GetBranch
s@GetBranch' {} Text
a -> GetBranch
s {$sel:branchName:GetBranch' :: Text
branchName = Text
a} :: GetBranch)
instance Core.AWSRequest GetBranch where
type AWSResponse GetBranch = GetBranchResponse
request :: GetBranch -> Request GetBranch
request = Service -> GetBranch -> Request GetBranch
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBranch)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBranch))
-> Logger
-> Service
-> Proxy GetBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBranch)))
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 ->
Int -> Branch -> GetBranchResponse
GetBranchResponse'
(Int -> Branch -> GetBranchResponse)
-> Either String Int -> Either String (Branch -> GetBranchResponse)
forall (f :: * -> *) a b. Functor 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 -> GetBranchResponse)
-> Either String Branch -> Either String GetBranchResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Branch
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"branch")
)
instance Prelude.Hashable GetBranch
instance Prelude.NFData GetBranch
instance Core.ToHeaders GetBranch where
toHeaders :: GetBranch -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBranch -> 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 GetBranch where
toPath :: GetBranch -> ByteString
toPath GetBranch' {Text
branchName :: Text
appId :: Text
$sel:branchName:GetBranch' :: GetBranch -> Text
$sel:appId:GetBranch' :: GetBranch -> 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/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
branchName
]
instance Core.ToQuery GetBranch where
toQuery :: GetBranch -> QueryString
toQuery = QueryString -> GetBranch -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBranchResponse = GetBranchResponse'
{
GetBranchResponse -> Int
httpStatus :: Prelude.Int,
GetBranchResponse -> Branch
branch :: Branch
}
deriving (GetBranchResponse -> GetBranchResponse -> Bool
(GetBranchResponse -> GetBranchResponse -> Bool)
-> (GetBranchResponse -> GetBranchResponse -> Bool)
-> Eq GetBranchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBranchResponse -> GetBranchResponse -> Bool
$c/= :: GetBranchResponse -> GetBranchResponse -> Bool
== :: GetBranchResponse -> GetBranchResponse -> Bool
$c== :: GetBranchResponse -> GetBranchResponse -> Bool
Prelude.Eq, Int -> GetBranchResponse -> ShowS
[GetBranchResponse] -> ShowS
GetBranchResponse -> String
(Int -> GetBranchResponse -> ShowS)
-> (GetBranchResponse -> String)
-> ([GetBranchResponse] -> ShowS)
-> Show GetBranchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBranchResponse] -> ShowS
$cshowList :: [GetBranchResponse] -> ShowS
show :: GetBranchResponse -> String
$cshow :: GetBranchResponse -> String
showsPrec :: Int -> GetBranchResponse -> ShowS
$cshowsPrec :: Int -> GetBranchResponse -> ShowS
Prelude.Show, (forall x. GetBranchResponse -> Rep GetBranchResponse x)
-> (forall x. Rep GetBranchResponse x -> GetBranchResponse)
-> Generic GetBranchResponse
forall x. Rep GetBranchResponse x -> GetBranchResponse
forall x. GetBranchResponse -> Rep GetBranchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBranchResponse x -> GetBranchResponse
$cfrom :: forall x. GetBranchResponse -> Rep GetBranchResponse x
Prelude.Generic)
newGetBranchResponse ::
Prelude.Int ->
Branch ->
GetBranchResponse
newGetBranchResponse :: Int -> Branch -> GetBranchResponse
newGetBranchResponse Int
pHttpStatus_ Branch
pBranch_ =
GetBranchResponse' :: Int -> Branch -> GetBranchResponse
GetBranchResponse'
{ $sel:httpStatus:GetBranchResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:branch:GetBranchResponse' :: Branch
branch = Branch
pBranch_
}
getBranchResponse_httpStatus :: Lens.Lens' GetBranchResponse Prelude.Int
getBranchResponse_httpStatus :: (Int -> f Int) -> GetBranchResponse -> f GetBranchResponse
getBranchResponse_httpStatus = (GetBranchResponse -> Int)
-> (GetBranchResponse -> Int -> GetBranchResponse)
-> Lens GetBranchResponse GetBranchResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBranchResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBranchResponse' :: GetBranchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBranchResponse
s@GetBranchResponse' {} Int
a -> GetBranchResponse
s {$sel:httpStatus:GetBranchResponse' :: Int
httpStatus = Int
a} :: GetBranchResponse)
getBranchResponse_branch :: Lens.Lens' GetBranchResponse Branch
getBranchResponse_branch :: (Branch -> f Branch) -> GetBranchResponse -> f GetBranchResponse
getBranchResponse_branch = (GetBranchResponse -> Branch)
-> (GetBranchResponse -> Branch -> GetBranchResponse)
-> Lens GetBranchResponse GetBranchResponse Branch Branch
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBranchResponse' {Branch
branch :: Branch
$sel:branch:GetBranchResponse' :: GetBranchResponse -> Branch
branch} -> Branch
branch) (\s :: GetBranchResponse
s@GetBranchResponse' {} Branch
a -> GetBranchResponse
s {$sel:branch:GetBranchResponse' :: Branch
branch = Branch
a} :: GetBranchResponse)
instance Prelude.NFData GetBranchResponse