module Network.AWS.ECR.ListImages
(
listImages
, ListImages
, liRegistryId
, liNextToken
, liMaxResults
, liRepositoryName
, listImagesResponse
, ListImagesResponse
, lirsImageIds
, lirsNextToken
, lirsResponseStatus
) 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 ListImages = ListImages'
{ _liRegistryId :: !(Maybe Text)
, _liNextToken :: !(Maybe Text)
, _liMaxResults :: !(Maybe Nat)
, _liRepositoryName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listImages
:: Text
-> ListImages
listImages pRepositoryName_ =
ListImages'
{ _liRegistryId = Nothing
, _liNextToken = Nothing
, _liMaxResults = Nothing
, _liRepositoryName = pRepositoryName_
}
liRegistryId :: Lens' ListImages (Maybe Text)
liRegistryId = lens _liRegistryId (\ s a -> s{_liRegistryId = a});
liNextToken :: Lens' ListImages (Maybe Text)
liNextToken = lens _liNextToken (\ s a -> s{_liNextToken = a});
liMaxResults :: Lens' ListImages (Maybe Natural)
liMaxResults = lens _liMaxResults (\ s a -> s{_liMaxResults = a}) . mapping _Nat;
liRepositoryName :: Lens' ListImages Text
liRepositoryName = lens _liRepositoryName (\ s a -> s{_liRepositoryName = a});
instance AWSRequest ListImages where
type Rs ListImages = ListImagesResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
ListImagesResponse' <$>
(x .?> "imageIds") <*> (x .?> "nextToken") <*>
(pure (fromEnum s)))
instance Hashable ListImages
instance ToHeaders ListImages where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.ListImages" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListImages where
toJSON ListImages'{..}
= object
(catMaybes
[("registryId" .=) <$> _liRegistryId,
("nextToken" .=) <$> _liNextToken,
("maxResults" .=) <$> _liMaxResults,
Just ("repositoryName" .= _liRepositoryName)])
instance ToPath ListImages where
toPath = const "/"
instance ToQuery ListImages where
toQuery = const mempty
data ListImagesResponse = ListImagesResponse'
{ _lirsImageIds :: !(Maybe (List1 ImageIdentifier))
, _lirsNextToken :: !(Maybe Text)
, _lirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listImagesResponse
:: Int
-> ListImagesResponse
listImagesResponse pResponseStatus_ =
ListImagesResponse'
{ _lirsImageIds = Nothing
, _lirsNextToken = Nothing
, _lirsResponseStatus = pResponseStatus_
}
lirsImageIds :: Lens' ListImagesResponse (Maybe (NonEmpty ImageIdentifier))
lirsImageIds = lens _lirsImageIds (\ s a -> s{_lirsImageIds = a}) . mapping _List1;
lirsNextToken :: Lens' ListImagesResponse (Maybe Text)
lirsNextToken = lens _lirsNextToken (\ s a -> s{_lirsNextToken = a});
lirsResponseStatus :: Lens' ListImagesResponse Int
lirsResponseStatus = lens _lirsResponseStatus (\ s a -> s{_lirsResponseStatus = a});