{-# 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.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 GetBranch = GetBranch'
{
GetBranch -> Text
appId :: Prelude.Text,
GetBranch -> Text
branchName :: Prelude.Text
}
deriving (GetBranch -> GetBranch -> Bool
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]
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
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. 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'
{ $sel:appId:GetBranch' :: Text
appId = Text
pAppId_,
$sel:branchName:GetBranch' :: Text
branchName = Text
pBranchName_
}
getBranch_appId :: Lens.Lens' GetBranch Prelude.Text
getBranch_appId :: Lens' GetBranch Text
getBranch_appId = 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 :: Lens' GetBranch Text
getBranch_branchName = 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 :: (Service -> Service) -> GetBranch -> Request GetBranch
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 GetBranch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBranch)))
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 ->
Int -> Branch -> GetBranchResponse
GetBranchResponse'
forall (f :: * -> *) a b. Functor 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 a
Data..:> Key
"branch")
)
instance Prelude.Hashable GetBranch where
hashWithSalt :: Int -> GetBranch -> Int
hashWithSalt Int
_salt GetBranch' {Text
branchName :: Text
appId :: Text
$sel:branchName:GetBranch' :: GetBranch -> Text
$sel:appId:GetBranch' :: GetBranch -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branchName
instance Prelude.NFData GetBranch where
rnf :: GetBranch -> ()
rnf GetBranch' {Text
branchName :: Text
appId :: Text
$sel:branchName:GetBranch' :: GetBranch -> Text
$sel:appId:GetBranch' :: GetBranch -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
appId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
branchName
instance Data.ToHeaders GetBranch where
toHeaders :: GetBranch -> 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 GetBranch where
toPath :: GetBranch -> ByteString
toPath GetBranch' {Text
branchName :: Text
appId :: Text
$sel:branchName:GetBranch' :: GetBranch -> Text
$sel:appId:GetBranch' :: GetBranch -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/apps/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
appId,
ByteString
"/branches/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
branchName
]
instance Data.ToQuery GetBranch where
toQuery :: GetBranch -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetBranchResponse = GetBranchResponse'
{
GetBranchResponse -> Int
httpStatus :: Prelude.Int,
GetBranchResponse -> Branch
branch :: Branch
}
deriving (GetBranchResponse -> GetBranchResponse -> Bool
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
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. 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'
{ $sel:httpStatus:GetBranchResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:branch:GetBranchResponse' :: Branch
branch = Branch
pBranch_
}
getBranchResponse_httpStatus :: Lens.Lens' GetBranchResponse Prelude.Int
getBranchResponse_httpStatus :: Lens' GetBranchResponse Int
getBranchResponse_httpStatus = 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 :: Lens' GetBranchResponse Branch
getBranchResponse_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 where
rnf :: GetBranchResponse -> ()
rnf GetBranchResponse' {Int
Branch
branch :: Branch
httpStatus :: Int
$sel:branch:GetBranchResponse' :: GetBranchResponse -> Branch
$sel:httpStatus:GetBranchResponse' :: GetBranchResponse -> Int
..} =
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 Branch
branch