{-# 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.CompleteLayerUpload
(
completeLayerUpload
, CompleteLayerUpload
, cluRegistryId
, cluRepositoryName
, cluUploadId
, cluLayerDigests
, completeLayerUploadResponse
, CompleteLayerUploadResponse
, clursRegistryId
, clursLayerDigest
, clursRepositoryName
, clursUploadId
, clursResponseStatus
) 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 CompleteLayerUpload = CompleteLayerUpload'
{ _cluRegistryId :: !(Maybe Text)
, _cluRepositoryName :: !Text
, _cluUploadId :: !Text
, _cluLayerDigests :: !(List1 Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
completeLayerUpload
:: Text
-> Text
-> NonEmpty Text
-> CompleteLayerUpload
completeLayerUpload pRepositoryName_ pUploadId_ pLayerDigests_ =
CompleteLayerUpload'
{ _cluRegistryId = Nothing
, _cluRepositoryName = pRepositoryName_
, _cluUploadId = pUploadId_
, _cluLayerDigests = _List1 # pLayerDigests_
}
cluRegistryId :: Lens' CompleteLayerUpload (Maybe Text)
cluRegistryId = lens _cluRegistryId (\ s a -> s{_cluRegistryId = a});
cluRepositoryName :: Lens' CompleteLayerUpload Text
cluRepositoryName = lens _cluRepositoryName (\ s a -> s{_cluRepositoryName = a});
cluUploadId :: Lens' CompleteLayerUpload Text
cluUploadId = lens _cluUploadId (\ s a -> s{_cluUploadId = a});
cluLayerDigests :: Lens' CompleteLayerUpload (NonEmpty Text)
cluLayerDigests = lens _cluLayerDigests (\ s a -> s{_cluLayerDigests = a}) . _List1;
instance AWSRequest CompleteLayerUpload where
type Rs CompleteLayerUpload =
CompleteLayerUploadResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
CompleteLayerUploadResponse' <$>
(x .?> "registryId") <*> (x .?> "layerDigest") <*>
(x .?> "repositoryName")
<*> (x .?> "uploadId")
<*> (pure (fromEnum s)))
instance Hashable CompleteLayerUpload
instance NFData CompleteLayerUpload
instance ToHeaders CompleteLayerUpload where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.CompleteLayerUpload"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CompleteLayerUpload where
toJSON CompleteLayerUpload'{..}
= object
(catMaybes
[("registryId" .=) <$> _cluRegistryId,
Just ("repositoryName" .= _cluRepositoryName),
Just ("uploadId" .= _cluUploadId),
Just ("layerDigests" .= _cluLayerDigests)])
instance ToPath CompleteLayerUpload where
toPath = const "/"
instance ToQuery CompleteLayerUpload where
toQuery = const mempty
data CompleteLayerUploadResponse = CompleteLayerUploadResponse'
{ _clursRegistryId :: !(Maybe Text)
, _clursLayerDigest :: !(Maybe Text)
, _clursRepositoryName :: !(Maybe Text)
, _clursUploadId :: !(Maybe Text)
, _clursResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
completeLayerUploadResponse
:: Int
-> CompleteLayerUploadResponse
completeLayerUploadResponse pResponseStatus_ =
CompleteLayerUploadResponse'
{ _clursRegistryId = Nothing
, _clursLayerDigest = Nothing
, _clursRepositoryName = Nothing
, _clursUploadId = Nothing
, _clursResponseStatus = pResponseStatus_
}
clursRegistryId :: Lens' CompleteLayerUploadResponse (Maybe Text)
clursRegistryId = lens _clursRegistryId (\ s a -> s{_clursRegistryId = a});
clursLayerDigest :: Lens' CompleteLayerUploadResponse (Maybe Text)
clursLayerDigest = lens _clursLayerDigest (\ s a -> s{_clursLayerDigest = a});
clursRepositoryName :: Lens' CompleteLayerUploadResponse (Maybe Text)
clursRepositoryName = lens _clursRepositoryName (\ s a -> s{_clursRepositoryName = a});
clursUploadId :: Lens' CompleteLayerUploadResponse (Maybe Text)
clursUploadId = lens _clursUploadId (\ s a -> s{_clursUploadId = a});
clursResponseStatus :: Lens' CompleteLayerUploadResponse Int
clursResponseStatus = lens _clursResponseStatus (\ s a -> s{_clursResponseStatus = a});
instance NFData CompleteLayerUploadResponse