{-# 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.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 :: ![ImageIdentifier]
} deriving (Eq, Read, Show, Data, Typeable, Generic)
batchDeleteImage
:: Text
-> BatchDeleteImage
batchDeleteImage pRepositoryName_ =
BatchDeleteImage'
{ _bdiRegistryId = Nothing
, _bdiRepositoryName = pRepositoryName_
, _bdiImageIds = mempty
}
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 [ImageIdentifier]
bdiImageIds = lens _bdiImageIds (\ s a -> s{_bdiImageIds = a}) . _Coerce
instance AWSRequest BatchDeleteImage where
type Rs BatchDeleteImage = BatchDeleteImageResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
BatchDeleteImageResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "imageIds" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchDeleteImage where
instance NFData BatchDeleteImage where
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 [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 [ImageIdentifier]
bdirsImageIds = lens _bdirsImageIds (\ s a -> s{_bdirsImageIds = a}) . _Default . _Coerce
bdirsResponseStatus :: Lens' BatchDeleteImageResponse Int
bdirsResponseStatus = lens _bdirsResponseStatus (\ s a -> s{_bdirsResponseStatus = a})
instance NFData BatchDeleteImageResponse where