{-# 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.PutImage
(
putImage
, PutImage
, piRegistryId
, piRepositoryName
, piImageManifest
, putImageResponse
, PutImageResponse
, pirsImage
, pirsResponseStatus
) 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 PutImage = PutImage'
{ _piRegistryId :: !(Maybe Text)
, _piRepositoryName :: !Text
, _piImageManifest :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putImage
:: Text
-> Text
-> PutImage
putImage pRepositoryName_ pImageManifest_ =
PutImage'
{ _piRegistryId = Nothing
, _piRepositoryName = pRepositoryName_
, _piImageManifest = pImageManifest_
}
piRegistryId :: Lens' PutImage (Maybe Text)
piRegistryId = lens _piRegistryId (\ s a -> s{_piRegistryId = a});
piRepositoryName :: Lens' PutImage Text
piRepositoryName = lens _piRepositoryName (\ s a -> s{_piRepositoryName = a});
piImageManifest :: Lens' PutImage Text
piImageManifest = lens _piImageManifest (\ s a -> s{_piImageManifest = a});
instance AWSRequest PutImage where
type Rs PutImage = PutImageResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
PutImageResponse' <$>
(x .?> "image") <*> (pure (fromEnum s)))
instance Hashable PutImage
instance NFData PutImage
instance ToHeaders PutImage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.PutImage" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutImage where
toJSON PutImage'{..}
= object
(catMaybes
[("registryId" .=) <$> _piRegistryId,
Just ("repositoryName" .= _piRepositoryName),
Just ("imageManifest" .= _piImageManifest)])
instance ToPath PutImage where
toPath = const "/"
instance ToQuery PutImage where
toQuery = const mempty
data PutImageResponse = PutImageResponse'
{ _pirsImage :: !(Maybe Image)
, _pirsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putImageResponse
:: Int
-> PutImageResponse
putImageResponse pResponseStatus_ =
PutImageResponse'
{ _pirsImage = Nothing
, _pirsResponseStatus = pResponseStatus_
}
pirsImage :: Lens' PutImageResponse (Maybe Image)
pirsImage = lens _pirsImage (\ s a -> s{_pirsImage = a});
pirsResponseStatus :: Lens' PutImageResponse Int
pirsResponseStatus = lens _pirsResponseStatus (\ s a -> s{_pirsResponseStatus = a});
instance NFData PutImageResponse