{-# 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.ECR.GetDownloadURLForLayer
(
getDownloadURLForLayer
, GetDownloadURLForLayer
, gduflRegistryId
, gduflRepositoryName
, gduflLayerDigest
, getDownloadURLForLayerResponse
, GetDownloadURLForLayerResponse
, gduflrsLayerDigest
, gduflrsDownloadURL
, gduflrsResponseStatus
) where
import Network.AWS.ECR.Types
import Network.AWS.ECR.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetDownloadURLForLayer = GetDownloadURLForLayer'
{ _gduflRegistryId :: !(Maybe Text)
, _gduflRepositoryName :: !Text
, _gduflLayerDigest :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDownloadURLForLayer
:: Text
-> Text
-> GetDownloadURLForLayer
getDownloadURLForLayer pRepositoryName_ pLayerDigest_ =
GetDownloadURLForLayer'
{ _gduflRegistryId = Nothing
, _gduflRepositoryName = pRepositoryName_
, _gduflLayerDigest = pLayerDigest_
}
gduflRegistryId :: Lens' GetDownloadURLForLayer (Maybe Text)
gduflRegistryId = lens _gduflRegistryId (\ s a -> s{_gduflRegistryId = a});
gduflRepositoryName :: Lens' GetDownloadURLForLayer Text
gduflRepositoryName = lens _gduflRepositoryName (\ s a -> s{_gduflRepositoryName = a});
gduflLayerDigest :: Lens' GetDownloadURLForLayer Text
gduflLayerDigest = lens _gduflLayerDigest (\ s a -> s{_gduflLayerDigest = a});
instance AWSRequest GetDownloadURLForLayer where
type Rs GetDownloadURLForLayer =
GetDownloadURLForLayerResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
GetDownloadURLForLayerResponse' <$>
(x .?> "layerDigest") <*> (x .?> "downloadUrl") <*>
(pure (fromEnum s)))
instance Hashable GetDownloadURLForLayer
instance NFData GetDownloadURLForLayer
instance ToHeaders GetDownloadURLForLayer where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.GetDownloadUrlForLayer"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetDownloadURLForLayer where
toJSON GetDownloadURLForLayer'{..}
= object
(catMaybes
[("registryId" .=) <$> _gduflRegistryId,
Just ("repositoryName" .= _gduflRepositoryName),
Just ("layerDigest" .= _gduflLayerDigest)])
instance ToPath GetDownloadURLForLayer where
toPath = const "/"
instance ToQuery GetDownloadURLForLayer where
toQuery = const mempty
data GetDownloadURLForLayerResponse = GetDownloadURLForLayerResponse'
{ _gduflrsLayerDigest :: !(Maybe Text)
, _gduflrsDownloadURL :: !(Maybe Text)
, _gduflrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDownloadURLForLayerResponse
:: Int
-> GetDownloadURLForLayerResponse
getDownloadURLForLayerResponse pResponseStatus_ =
GetDownloadURLForLayerResponse'
{ _gduflrsLayerDigest = Nothing
, _gduflrsDownloadURL = Nothing
, _gduflrsResponseStatus = pResponseStatus_
}
gduflrsLayerDigest :: Lens' GetDownloadURLForLayerResponse (Maybe Text)
gduflrsLayerDigest = lens _gduflrsLayerDigest (\ s a -> s{_gduflrsLayerDigest = a});
gduflrsDownloadURL :: Lens' GetDownloadURLForLayerResponse (Maybe Text)
gduflrsDownloadURL = lens _gduflrsDownloadURL (\ s a -> s{_gduflrsDownloadURL = a});
gduflrsResponseStatus :: Lens' GetDownloadURLForLayerResponse Int
gduflrsResponseStatus = lens _gduflrsResponseStatus (\ s a -> s{_gduflrsResponseStatus = a});
instance NFData GetDownloadURLForLayerResponse