module Network.AWS.ECR.BatchGetImage
(
batchGetImage
, BatchGetImage
, bgiRegistryId
, bgiRepositoryName
, bgiImageIds
, batchGetImageResponse
, BatchGetImageResponse
, bgirsImages
, bgirsFailures
, bgirsResponseStatus
) 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 BatchGetImage = BatchGetImage'
{ _bgiRegistryId :: !(Maybe Text)
, _bgiRepositoryName :: !Text
, _bgiImageIds :: !(List1 ImageIdentifier)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchGetImage
:: Text
-> NonEmpty ImageIdentifier
-> BatchGetImage
batchGetImage pRepositoryName_ pImageIds_ =
BatchGetImage'
{ _bgiRegistryId = Nothing
, _bgiRepositoryName = pRepositoryName_
, _bgiImageIds = _List1 # pImageIds_
}
bgiRegistryId :: Lens' BatchGetImage (Maybe Text)
bgiRegistryId = lens _bgiRegistryId (\ s a -> s{_bgiRegistryId = a});
bgiRepositoryName :: Lens' BatchGetImage Text
bgiRepositoryName = lens _bgiRepositoryName (\ s a -> s{_bgiRepositoryName = a});
bgiImageIds :: Lens' BatchGetImage (NonEmpty ImageIdentifier)
bgiImageIds = lens _bgiImageIds (\ s a -> s{_bgiImageIds = a}) . _List1;
instance AWSRequest BatchGetImage where
type Rs BatchGetImage = BatchGetImageResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
BatchGetImageResponse' <$>
(x .?> "images" .!@ mempty) <*>
(x .?> "failures" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchGetImage
instance ToHeaders BatchGetImage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.BatchGetImage"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchGetImage where
toJSON BatchGetImage'{..}
= object
(catMaybes
[("registryId" .=) <$> _bgiRegistryId,
Just ("repositoryName" .= _bgiRepositoryName),
Just ("imageIds" .= _bgiImageIds)])
instance ToPath BatchGetImage where
toPath = const "/"
instance ToQuery BatchGetImage where
toQuery = const mempty
data BatchGetImageResponse = BatchGetImageResponse'
{ _bgirsImages :: !(Maybe [Image])
, _bgirsFailures :: !(Maybe [ImageFailure])
, _bgirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchGetImageResponse
:: Int
-> BatchGetImageResponse
batchGetImageResponse pResponseStatus_ =
BatchGetImageResponse'
{ _bgirsImages = Nothing
, _bgirsFailures = Nothing
, _bgirsResponseStatus = pResponseStatus_
}
bgirsImages :: Lens' BatchGetImageResponse [Image]
bgirsImages = lens _bgirsImages (\ s a -> s{_bgirsImages = a}) . _Default . _Coerce;
bgirsFailures :: Lens' BatchGetImageResponse [ImageFailure]
bgirsFailures = lens _bgirsFailures (\ s a -> s{_bgirsFailures = a}) . _Default . _Coerce;
bgirsResponseStatus :: Lens' BatchGetImageResponse Int
bgirsResponseStatus = lens _bgirsResponseStatus (\ s a -> s{_bgirsResponseStatus = a});