{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CodeCommit.GetBlob
(
getBlob
, GetBlob
, gRepositoryName
, gBlobId
, getBlobResponse
, GetBlobResponse
, gbrsResponseStatus
, gbrsContent
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetBlob = GetBlob'
{ _gRepositoryName :: !Text
, _gBlobId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBlob
:: Text
-> Text
-> GetBlob
getBlob pRepositoryName_ pBlobId_ =
GetBlob' {_gRepositoryName = pRepositoryName_, _gBlobId = pBlobId_}
gRepositoryName :: Lens' GetBlob Text
gRepositoryName = lens _gRepositoryName (\ s a -> s{_gRepositoryName = a})
gBlobId :: Lens' GetBlob Text
gBlobId = lens _gBlobId (\ s a -> s{_gBlobId = a})
instance AWSRequest GetBlob where
type Rs GetBlob = GetBlobResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
GetBlobResponse' <$>
(pure (fromEnum s)) <*> (x .:> "content"))
instance Hashable GetBlob where
instance NFData GetBlob where
instance ToHeaders GetBlob where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.GetBlob" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetBlob where
toJSON GetBlob'{..}
= object
(catMaybes
[Just ("repositoryName" .= _gRepositoryName),
Just ("blobId" .= _gBlobId)])
instance ToPath GetBlob where
toPath = const "/"
instance ToQuery GetBlob where
toQuery = const mempty
data GetBlobResponse = GetBlobResponse'
{ _gbrsResponseStatus :: !Int
, _gbrsContent :: !Base64
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBlobResponse
:: Int
-> ByteString
-> GetBlobResponse
getBlobResponse pResponseStatus_ pContent_ =
GetBlobResponse'
{_gbrsResponseStatus = pResponseStatus_, _gbrsContent = _Base64 # pContent_}
gbrsResponseStatus :: Lens' GetBlobResponse Int
gbrsResponseStatus = lens _gbrsResponseStatus (\ s a -> s{_gbrsResponseStatus = a})
gbrsContent :: Lens' GetBlobResponse ByteString
gbrsContent = lens _gbrsContent (\ s a -> s{_gbrsContent = a}) . _Base64
instance NFData GetBlobResponse where