{-# 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.CodeCommit.GetBlob
(
GetBlob (..),
newGetBlob,
getBlob_repositoryName,
getBlob_blobId,
GetBlobResponse (..),
newGetBlobResponse,
getBlobResponse_httpStatus,
getBlobResponse_content,
)
where
import Amazonka.CodeCommit.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 GetBlob = GetBlob'
{
GetBlob -> Text
repositoryName :: Prelude.Text,
GetBlob -> Text
blobId :: Prelude.Text
}
deriving (GetBlob -> GetBlob -> Bool
(GetBlob -> GetBlob -> Bool)
-> (GetBlob -> GetBlob -> Bool) -> Eq GetBlob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBlob -> GetBlob -> Bool
$c/= :: GetBlob -> GetBlob -> Bool
== :: GetBlob -> GetBlob -> Bool
$c== :: GetBlob -> GetBlob -> Bool
Prelude.Eq, ReadPrec [GetBlob]
ReadPrec GetBlob
Int -> ReadS GetBlob
ReadS [GetBlob]
(Int -> ReadS GetBlob)
-> ReadS [GetBlob]
-> ReadPrec GetBlob
-> ReadPrec [GetBlob]
-> Read GetBlob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBlob]
$creadListPrec :: ReadPrec [GetBlob]
readPrec :: ReadPrec GetBlob
$creadPrec :: ReadPrec GetBlob
readList :: ReadS [GetBlob]
$creadList :: ReadS [GetBlob]
readsPrec :: Int -> ReadS GetBlob
$creadsPrec :: Int -> ReadS GetBlob
Prelude.Read, Int -> GetBlob -> ShowS
[GetBlob] -> ShowS
GetBlob -> String
(Int -> GetBlob -> ShowS)
-> (GetBlob -> String) -> ([GetBlob] -> ShowS) -> Show GetBlob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBlob] -> ShowS
$cshowList :: [GetBlob] -> ShowS
show :: GetBlob -> String
$cshow :: GetBlob -> String
showsPrec :: Int -> GetBlob -> ShowS
$cshowsPrec :: Int -> GetBlob -> ShowS
Prelude.Show, (forall x. GetBlob -> Rep GetBlob x)
-> (forall x. Rep GetBlob x -> GetBlob) -> Generic GetBlob
forall x. Rep GetBlob x -> GetBlob
forall x. GetBlob -> Rep GetBlob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBlob x -> GetBlob
$cfrom :: forall x. GetBlob -> Rep GetBlob x
Prelude.Generic)
newGetBlob ::
Prelude.Text ->
Prelude.Text ->
GetBlob
newGetBlob :: Text -> Text -> GetBlob
newGetBlob Text
pRepositoryName_ Text
pBlobId_ =
GetBlob' :: Text -> Text -> GetBlob
GetBlob'
{ $sel:repositoryName:GetBlob' :: Text
repositoryName = Text
pRepositoryName_,
$sel:blobId:GetBlob' :: Text
blobId = Text
pBlobId_
}
getBlob_repositoryName :: Lens.Lens' GetBlob Prelude.Text
getBlob_repositoryName :: (Text -> f Text) -> GetBlob -> f GetBlob
getBlob_repositoryName = (GetBlob -> Text)
-> (GetBlob -> Text -> GetBlob) -> Lens GetBlob GetBlob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlob' {Text
repositoryName :: Text
$sel:repositoryName:GetBlob' :: GetBlob -> Text
repositoryName} -> Text
repositoryName) (\s :: GetBlob
s@GetBlob' {} Text
a -> GetBlob
s {$sel:repositoryName:GetBlob' :: Text
repositoryName = Text
a} :: GetBlob)
getBlob_blobId :: Lens.Lens' GetBlob Prelude.Text
getBlob_blobId :: (Text -> f Text) -> GetBlob -> f GetBlob
getBlob_blobId = (GetBlob -> Text)
-> (GetBlob -> Text -> GetBlob) -> Lens GetBlob GetBlob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlob' {Text
blobId :: Text
$sel:blobId:GetBlob' :: GetBlob -> Text
blobId} -> Text
blobId) (\s :: GetBlob
s@GetBlob' {} Text
a -> GetBlob
s {$sel:blobId:GetBlob' :: Text
blobId = Text
a} :: GetBlob)
instance Core.AWSRequest GetBlob where
type AWSResponse GetBlob = GetBlobResponse
request :: GetBlob -> Request GetBlob
request = Service -> GetBlob -> Request GetBlob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetBlob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBlob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBlob))
-> Logger
-> Service
-> Proxy GetBlob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBlob)))
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 -> Base64 -> GetBlobResponse
GetBlobResponse'
(Int -> Base64 -> GetBlobResponse)
-> Either String Int -> Either String (Base64 -> GetBlobResponse)
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 (Base64 -> GetBlobResponse)
-> Either String Base64 -> Either String GetBlobResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Base64
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"content")
)
instance Prelude.Hashable GetBlob
instance Prelude.NFData GetBlob
instance Core.ToHeaders GetBlob where
toHeaders :: GetBlob -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBlob -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.GetBlob" ::
Prelude.ByteString
),
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.ToJSON GetBlob where
toJSON :: GetBlob -> Value
toJSON GetBlob' {Text
blobId :: Text
repositoryName :: Text
$sel:blobId:GetBlob' :: GetBlob -> Text
$sel:repositoryName:GetBlob' :: GetBlob -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"blobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
blobId)
]
)
instance Core.ToPath GetBlob where
toPath :: GetBlob -> ByteString
toPath = ByteString -> GetBlob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetBlob where
toQuery :: GetBlob -> QueryString
toQuery = QueryString -> GetBlob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBlobResponse = GetBlobResponse'
{
GetBlobResponse -> Int
httpStatus :: Prelude.Int,
GetBlobResponse -> Base64
content :: Core.Base64
}
deriving (GetBlobResponse -> GetBlobResponse -> Bool
(GetBlobResponse -> GetBlobResponse -> Bool)
-> (GetBlobResponse -> GetBlobResponse -> Bool)
-> Eq GetBlobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBlobResponse -> GetBlobResponse -> Bool
$c/= :: GetBlobResponse -> GetBlobResponse -> Bool
== :: GetBlobResponse -> GetBlobResponse -> Bool
$c== :: GetBlobResponse -> GetBlobResponse -> Bool
Prelude.Eq, ReadPrec [GetBlobResponse]
ReadPrec GetBlobResponse
Int -> ReadS GetBlobResponse
ReadS [GetBlobResponse]
(Int -> ReadS GetBlobResponse)
-> ReadS [GetBlobResponse]
-> ReadPrec GetBlobResponse
-> ReadPrec [GetBlobResponse]
-> Read GetBlobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBlobResponse]
$creadListPrec :: ReadPrec [GetBlobResponse]
readPrec :: ReadPrec GetBlobResponse
$creadPrec :: ReadPrec GetBlobResponse
readList :: ReadS [GetBlobResponse]
$creadList :: ReadS [GetBlobResponse]
readsPrec :: Int -> ReadS GetBlobResponse
$creadsPrec :: Int -> ReadS GetBlobResponse
Prelude.Read, Int -> GetBlobResponse -> ShowS
[GetBlobResponse] -> ShowS
GetBlobResponse -> String
(Int -> GetBlobResponse -> ShowS)
-> (GetBlobResponse -> String)
-> ([GetBlobResponse] -> ShowS)
-> Show GetBlobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBlobResponse] -> ShowS
$cshowList :: [GetBlobResponse] -> ShowS
show :: GetBlobResponse -> String
$cshow :: GetBlobResponse -> String
showsPrec :: Int -> GetBlobResponse -> ShowS
$cshowsPrec :: Int -> GetBlobResponse -> ShowS
Prelude.Show, (forall x. GetBlobResponse -> Rep GetBlobResponse x)
-> (forall x. Rep GetBlobResponse x -> GetBlobResponse)
-> Generic GetBlobResponse
forall x. Rep GetBlobResponse x -> GetBlobResponse
forall x. GetBlobResponse -> Rep GetBlobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBlobResponse x -> GetBlobResponse
$cfrom :: forall x. GetBlobResponse -> Rep GetBlobResponse x
Prelude.Generic)
newGetBlobResponse ::
Prelude.Int ->
Prelude.ByteString ->
GetBlobResponse
newGetBlobResponse :: Int -> ByteString -> GetBlobResponse
newGetBlobResponse Int
pHttpStatus_ ByteString
pContent_ =
GetBlobResponse' :: Int -> Base64 -> GetBlobResponse
GetBlobResponse'
{ $sel:httpStatus:GetBlobResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:content:GetBlobResponse' :: Base64
content = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pContent_
}
getBlobResponse_httpStatus :: Lens.Lens' GetBlobResponse Prelude.Int
getBlobResponse_httpStatus :: (Int -> f Int) -> GetBlobResponse -> f GetBlobResponse
getBlobResponse_httpStatus = (GetBlobResponse -> Int)
-> (GetBlobResponse -> Int -> GetBlobResponse)
-> Lens GetBlobResponse GetBlobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlobResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBlobResponse' :: GetBlobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBlobResponse
s@GetBlobResponse' {} Int
a -> GetBlobResponse
s {$sel:httpStatus:GetBlobResponse' :: Int
httpStatus = Int
a} :: GetBlobResponse)
getBlobResponse_content :: Lens.Lens' GetBlobResponse Prelude.ByteString
getBlobResponse_content :: (ByteString -> f ByteString)
-> GetBlobResponse -> f GetBlobResponse
getBlobResponse_content = (GetBlobResponse -> Base64)
-> (GetBlobResponse -> Base64 -> GetBlobResponse)
-> Lens GetBlobResponse GetBlobResponse Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBlobResponse' {Base64
content :: Base64
$sel:content:GetBlobResponse' :: GetBlobResponse -> Base64
content} -> Base64
content) (\s :: GetBlobResponse
s@GetBlobResponse' {} Base64
a -> GetBlobResponse
s {$sel:content:GetBlobResponse' :: Base64
content = Base64
a} :: GetBlobResponse) ((Base64 -> f Base64) -> GetBlobResponse -> f GetBlobResponse)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> GetBlobResponse
-> f GetBlobResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
instance Prelude.NFData GetBlobResponse