module Network.AWS.ECR.BatchDeleteImage
(
batchDeleteImage
, BatchDeleteImage
, bdiRegistryId
, bdiRepositoryName
, bdiImageIds
, batchDeleteImageResponse
, BatchDeleteImageResponse
, bdirsFailures
, bdirsImageIds
, bdirsResponseStatus
) 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 BatchDeleteImage = BatchDeleteImage'
{ _bdiRegistryId :: !(Maybe Text)
, _bdiRepositoryName :: !Text
, _bdiImageIds :: !(List1 ImageIdentifier)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchDeleteImage
:: Text
-> NonEmpty ImageIdentifier
-> BatchDeleteImage
batchDeleteImage pRepositoryName_ pImageIds_ =
BatchDeleteImage'
{ _bdiRegistryId = Nothing
, _bdiRepositoryName = pRepositoryName_
, _bdiImageIds = _List1 # pImageIds_
}
bdiRegistryId :: Lens' BatchDeleteImage (Maybe Text)
bdiRegistryId = lens _bdiRegistryId (\ s a -> s{_bdiRegistryId = a});
bdiRepositoryName :: Lens' BatchDeleteImage Text
bdiRepositoryName = lens _bdiRepositoryName (\ s a -> s{_bdiRepositoryName = a});
bdiImageIds :: Lens' BatchDeleteImage (NonEmpty ImageIdentifier)
bdiImageIds = lens _bdiImageIds (\ s a -> s{_bdiImageIds = a}) . _List1;
instance AWSRequest BatchDeleteImage where
type Rs BatchDeleteImage = BatchDeleteImageResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
BatchDeleteImageResponse' <$>
(x .?> "failures" .!@ mempty) <*> (x .?> "imageIds")
<*> (pure (fromEnum s)))
instance Hashable BatchDeleteImage
instance ToHeaders BatchDeleteImage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.BatchDeleteImage"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchDeleteImage where
toJSON BatchDeleteImage'{..}
= object
(catMaybes
[("registryId" .=) <$> _bdiRegistryId,
Just ("repositoryName" .= _bdiRepositoryName),
Just ("imageIds" .= _bdiImageIds)])
instance ToPath BatchDeleteImage where
toPath = const "/"
instance ToQuery BatchDeleteImage where
toQuery = const mempty
data BatchDeleteImageResponse = BatchDeleteImageResponse'
{ _bdirsFailures :: !(Maybe [ImageFailure])
, _bdirsImageIds :: !(Maybe (List1 ImageIdentifier))
, _bdirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchDeleteImageResponse
:: Int
-> BatchDeleteImageResponse
batchDeleteImageResponse pResponseStatus_ =
BatchDeleteImageResponse'
{ _bdirsFailures = Nothing
, _bdirsImageIds = Nothing
, _bdirsResponseStatus = pResponseStatus_
}
bdirsFailures :: Lens' BatchDeleteImageResponse [ImageFailure]
bdirsFailures = lens _bdirsFailures (\ s a -> s{_bdirsFailures = a}) . _Default . _Coerce;
bdirsImageIds :: Lens' BatchDeleteImageResponse (Maybe (NonEmpty ImageIdentifier))
bdirsImageIds = lens _bdirsImageIds (\ s a -> s{_bdirsImageIds = a}) . mapping _List1;
bdirsResponseStatus :: Lens' BatchDeleteImageResponse Int
bdirsResponseStatus = lens _bdirsResponseStatus (\ s a -> s{_bdirsResponseStatus = a});