{-# 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.BatchCheckLayerAvailability
(
batchCheckLayerAvailability
, BatchCheckLayerAvailability
, bclaRegistryId
, bclaRepositoryName
, bclaLayerDigests
, batchCheckLayerAvailabilityResponse
, BatchCheckLayerAvailabilityResponse
, bclarsFailures
, bclarsLayers
, bclarsResponseStatus
) 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 BatchCheckLayerAvailability = BatchCheckLayerAvailability'
{ _bclaRegistryId :: !(Maybe Text)
, _bclaRepositoryName :: !Text
, _bclaLayerDigests :: !(List1 Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchCheckLayerAvailability
:: Text
-> NonEmpty Text
-> BatchCheckLayerAvailability
batchCheckLayerAvailability pRepositoryName_ pLayerDigests_ =
BatchCheckLayerAvailability'
{ _bclaRegistryId = Nothing
, _bclaRepositoryName = pRepositoryName_
, _bclaLayerDigests = _List1 # pLayerDigests_
}
bclaRegistryId :: Lens' BatchCheckLayerAvailability (Maybe Text)
bclaRegistryId = lens _bclaRegistryId (\ s a -> s{_bclaRegistryId = a});
bclaRepositoryName :: Lens' BatchCheckLayerAvailability Text
bclaRepositoryName = lens _bclaRepositoryName (\ s a -> s{_bclaRepositoryName = a});
bclaLayerDigests :: Lens' BatchCheckLayerAvailability (NonEmpty Text)
bclaLayerDigests = lens _bclaLayerDigests (\ s a -> s{_bclaLayerDigests = a}) . _List1;
instance AWSRequest BatchCheckLayerAvailability where
type Rs BatchCheckLayerAvailability =
BatchCheckLayerAvailabilityResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
BatchCheckLayerAvailabilityResponse' <$>
(x .?> "failures" .!@ mempty) <*>
(x .?> "layers" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable BatchCheckLayerAvailability
instance NFData BatchCheckLayerAvailability
instance ToHeaders BatchCheckLayerAvailability where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.BatchCheckLayerAvailability"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON BatchCheckLayerAvailability where
toJSON BatchCheckLayerAvailability'{..}
= object
(catMaybes
[("registryId" .=) <$> _bclaRegistryId,
Just ("repositoryName" .= _bclaRepositoryName),
Just ("layerDigests" .= _bclaLayerDigests)])
instance ToPath BatchCheckLayerAvailability where
toPath = const "/"
instance ToQuery BatchCheckLayerAvailability where
toQuery = const mempty
data BatchCheckLayerAvailabilityResponse = BatchCheckLayerAvailabilityResponse'
{ _bclarsFailures :: !(Maybe [LayerFailure])
, _bclarsLayers :: !(Maybe [Layer])
, _bclarsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
batchCheckLayerAvailabilityResponse
:: Int
-> BatchCheckLayerAvailabilityResponse
batchCheckLayerAvailabilityResponse pResponseStatus_ =
BatchCheckLayerAvailabilityResponse'
{ _bclarsFailures = Nothing
, _bclarsLayers = Nothing
, _bclarsResponseStatus = pResponseStatus_
}
bclarsFailures :: Lens' BatchCheckLayerAvailabilityResponse [LayerFailure]
bclarsFailures = lens _bclarsFailures (\ s a -> s{_bclarsFailures = a}) . _Default . _Coerce;
bclarsLayers :: Lens' BatchCheckLayerAvailabilityResponse [Layer]
bclarsLayers = lens _bclarsLayers (\ s a -> s{_bclarsLayers = a}) . _Default . _Coerce;
bclarsResponseStatus :: Lens' BatchCheckLayerAvailabilityResponse Int
bclarsResponseStatus = lens _bclarsResponseStatus (\ s a -> s{_bclarsResponseStatus = a});
instance NFData BatchCheckLayerAvailabilityResponse