{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.ECR.PutImage
(
PutImage (..),
newPutImage,
putImage_registryId,
putImage_imageManifestMediaType,
putImage_imageDigest,
putImage_imageTag,
putImage_repositoryName,
putImage_imageManifest,
PutImageResponse (..),
newPutImageResponse,
putImageResponse_image,
putImageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECR.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutImage = PutImage'
{
PutImage -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
PutImage -> Maybe Text
imageManifestMediaType :: Prelude.Maybe Prelude.Text,
PutImage -> Maybe Text
imageDigest :: Prelude.Maybe Prelude.Text,
PutImage -> Maybe Text
imageTag :: Prelude.Maybe Prelude.Text,
PutImage -> Text
repositoryName :: Prelude.Text,
PutImage -> Text
imageManifest :: Prelude.Text
}
deriving (PutImage -> PutImage -> Bool
(PutImage -> PutImage -> Bool)
-> (PutImage -> PutImage -> Bool) -> Eq PutImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImage -> PutImage -> Bool
$c/= :: PutImage -> PutImage -> Bool
== :: PutImage -> PutImage -> Bool
$c== :: PutImage -> PutImage -> Bool
Prelude.Eq, ReadPrec [PutImage]
ReadPrec PutImage
Int -> ReadS PutImage
ReadS [PutImage]
(Int -> ReadS PutImage)
-> ReadS [PutImage]
-> ReadPrec PutImage
-> ReadPrec [PutImage]
-> Read PutImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImage]
$creadListPrec :: ReadPrec [PutImage]
readPrec :: ReadPrec PutImage
$creadPrec :: ReadPrec PutImage
readList :: ReadS [PutImage]
$creadList :: ReadS [PutImage]
readsPrec :: Int -> ReadS PutImage
$creadsPrec :: Int -> ReadS PutImage
Prelude.Read, Int -> PutImage -> ShowS
[PutImage] -> ShowS
PutImage -> String
(Int -> PutImage -> ShowS)
-> (PutImage -> String) -> ([PutImage] -> ShowS) -> Show PutImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImage] -> ShowS
$cshowList :: [PutImage] -> ShowS
show :: PutImage -> String
$cshow :: PutImage -> String
showsPrec :: Int -> PutImage -> ShowS
$cshowsPrec :: Int -> PutImage -> ShowS
Prelude.Show, (forall x. PutImage -> Rep PutImage x)
-> (forall x. Rep PutImage x -> PutImage) -> Generic PutImage
forall x. Rep PutImage x -> PutImage
forall x. PutImage -> Rep PutImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutImage x -> PutImage
$cfrom :: forall x. PutImage -> Rep PutImage x
Prelude.Generic)
newPutImage ::
Prelude.Text ->
Prelude.Text ->
PutImage
newPutImage :: Text -> Text -> PutImage
newPutImage Text
pRepositoryName_ Text
pImageManifest_ =
PutImage' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> PutImage
PutImage'
{ $sel:registryId:PutImage' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageManifestMediaType:PutImage' :: Maybe Text
imageManifestMediaType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageDigest:PutImage' :: Maybe Text
imageDigest = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageTag:PutImage' :: Maybe Text
imageTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:PutImage' :: Text
repositoryName = Text
pRepositoryName_,
$sel:imageManifest:PutImage' :: Text
imageManifest = Text
pImageManifest_
}
putImage_registryId :: Lens.Lens' PutImage (Prelude.Maybe Prelude.Text)
putImage_registryId :: (Maybe Text -> f (Maybe Text)) -> PutImage -> f PutImage
putImage_registryId = (PutImage -> Maybe Text)
-> (PutImage -> Maybe Text -> PutImage)
-> Lens PutImage PutImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Maybe Text
registryId :: Maybe Text
$sel:registryId:PutImage' :: PutImage -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: PutImage
s@PutImage' {} Maybe Text
a -> PutImage
s {$sel:registryId:PutImage' :: Maybe Text
registryId = Maybe Text
a} :: PutImage)
putImage_imageManifestMediaType :: Lens.Lens' PutImage (Prelude.Maybe Prelude.Text)
putImage_imageManifestMediaType :: (Maybe Text -> f (Maybe Text)) -> PutImage -> f PutImage
putImage_imageManifestMediaType = (PutImage -> Maybe Text)
-> (PutImage -> Maybe Text -> PutImage)
-> Lens PutImage PutImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Maybe Text
imageManifestMediaType :: Maybe Text
$sel:imageManifestMediaType:PutImage' :: PutImage -> Maybe Text
imageManifestMediaType} -> Maybe Text
imageManifestMediaType) (\s :: PutImage
s@PutImage' {} Maybe Text
a -> PutImage
s {$sel:imageManifestMediaType:PutImage' :: Maybe Text
imageManifestMediaType = Maybe Text
a} :: PutImage)
putImage_imageDigest :: Lens.Lens' PutImage (Prelude.Maybe Prelude.Text)
putImage_imageDigest :: (Maybe Text -> f (Maybe Text)) -> PutImage -> f PutImage
putImage_imageDigest = (PutImage -> Maybe Text)
-> (PutImage -> Maybe Text -> PutImage)
-> Lens PutImage PutImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Maybe Text
imageDigest :: Maybe Text
$sel:imageDigest:PutImage' :: PutImage -> Maybe Text
imageDigest} -> Maybe Text
imageDigest) (\s :: PutImage
s@PutImage' {} Maybe Text
a -> PutImage
s {$sel:imageDigest:PutImage' :: Maybe Text
imageDigest = Maybe Text
a} :: PutImage)
putImage_imageTag :: Lens.Lens' PutImage (Prelude.Maybe Prelude.Text)
putImage_imageTag :: (Maybe Text -> f (Maybe Text)) -> PutImage -> f PutImage
putImage_imageTag = (PutImage -> Maybe Text)
-> (PutImage -> Maybe Text -> PutImage)
-> Lens PutImage PutImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Maybe Text
imageTag :: Maybe Text
$sel:imageTag:PutImage' :: PutImage -> Maybe Text
imageTag} -> Maybe Text
imageTag) (\s :: PutImage
s@PutImage' {} Maybe Text
a -> PutImage
s {$sel:imageTag:PutImage' :: Maybe Text
imageTag = Maybe Text
a} :: PutImage)
putImage_repositoryName :: Lens.Lens' PutImage Prelude.Text
putImage_repositoryName :: (Text -> f Text) -> PutImage -> f PutImage
putImage_repositoryName = (PutImage -> Text)
-> (PutImage -> Text -> PutImage)
-> Lens PutImage PutImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Text
repositoryName :: Text
$sel:repositoryName:PutImage' :: PutImage -> Text
repositoryName} -> Text
repositoryName) (\s :: PutImage
s@PutImage' {} Text
a -> PutImage
s {$sel:repositoryName:PutImage' :: Text
repositoryName = Text
a} :: PutImage)
putImage_imageManifest :: Lens.Lens' PutImage Prelude.Text
putImage_imageManifest :: (Text -> f Text) -> PutImage -> f PutImage
putImage_imageManifest = (PutImage -> Text)
-> (PutImage -> Text -> PutImage)
-> Lens PutImage PutImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImage' {Text
imageManifest :: Text
$sel:imageManifest:PutImage' :: PutImage -> Text
imageManifest} -> Text
imageManifest) (\s :: PutImage
s@PutImage' {} Text
a -> PutImage
s {$sel:imageManifest:PutImage' :: Text
imageManifest = Text
a} :: PutImage)
instance Core.AWSRequest PutImage where
type AWSResponse PutImage = PutImageResponse
request :: PutImage -> Request PutImage
request = Service -> PutImage -> Request PutImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutImage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutImage))
-> Logger
-> Service
-> Proxy PutImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutImage)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Image -> Int -> PutImageResponse
PutImageResponse'
(Maybe Image -> Int -> PutImageResponse)
-> Either String (Maybe Image)
-> Either String (Int -> PutImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Image)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"image")
Either String (Int -> PutImageResponse)
-> Either String Int -> Either String PutImageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutImage
instance Prelude.NFData PutImage
instance Core.ToHeaders PutImage where
toHeaders :: PutImage -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutImage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonEC2ContainerRegistry_V20150921.PutImage" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutImage where
toJSON :: PutImage -> Value
toJSON PutImage' {Maybe Text
Text
imageManifest :: Text
repositoryName :: Text
imageTag :: Maybe Text
imageDigest :: Maybe Text
imageManifestMediaType :: Maybe Text
registryId :: Maybe Text
$sel:imageManifest:PutImage' :: PutImage -> Text
$sel:repositoryName:PutImage' :: PutImage -> Text
$sel:imageTag:PutImage' :: PutImage -> Maybe Text
$sel:imageDigest:PutImage' :: PutImage -> Maybe Text
$sel:imageManifestMediaType:PutImage' :: PutImage -> Maybe Text
$sel:registryId:PutImage' :: PutImage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"registryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryId,
(Text
"imageManifestMediaType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
imageManifestMediaType,
(Text
"imageDigest" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
imageDigest,
(Text
"imageTag" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
imageTag,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"imageManifest" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageManifest)
]
)
instance Core.ToPath PutImage where
toPath :: PutImage -> ByteString
toPath = ByteString -> PutImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutImage where
toQuery :: PutImage -> QueryString
toQuery = QueryString -> PutImage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutImageResponse = PutImageResponse'
{
PutImageResponse -> Maybe Image
image :: Prelude.Maybe Image,
PutImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutImageResponse -> PutImageResponse -> Bool
(PutImageResponse -> PutImageResponse -> Bool)
-> (PutImageResponse -> PutImageResponse -> Bool)
-> Eq PutImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImageResponse -> PutImageResponse -> Bool
$c/= :: PutImageResponse -> PutImageResponse -> Bool
== :: PutImageResponse -> PutImageResponse -> Bool
$c== :: PutImageResponse -> PutImageResponse -> Bool
Prelude.Eq, ReadPrec [PutImageResponse]
ReadPrec PutImageResponse
Int -> ReadS PutImageResponse
ReadS [PutImageResponse]
(Int -> ReadS PutImageResponse)
-> ReadS [PutImageResponse]
-> ReadPrec PutImageResponse
-> ReadPrec [PutImageResponse]
-> Read PutImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImageResponse]
$creadListPrec :: ReadPrec [PutImageResponse]
readPrec :: ReadPrec PutImageResponse
$creadPrec :: ReadPrec PutImageResponse
readList :: ReadS [PutImageResponse]
$creadList :: ReadS [PutImageResponse]
readsPrec :: Int -> ReadS PutImageResponse
$creadsPrec :: Int -> ReadS PutImageResponse
Prelude.Read, Int -> PutImageResponse -> ShowS
[PutImageResponse] -> ShowS
PutImageResponse -> String
(Int -> PutImageResponse -> ShowS)
-> (PutImageResponse -> String)
-> ([PutImageResponse] -> ShowS)
-> Show PutImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImageResponse] -> ShowS
$cshowList :: [PutImageResponse] -> ShowS
show :: PutImageResponse -> String
$cshow :: PutImageResponse -> String
showsPrec :: Int -> PutImageResponse -> ShowS
$cshowsPrec :: Int -> PutImageResponse -> ShowS
Prelude.Show, (forall x. PutImageResponse -> Rep PutImageResponse x)
-> (forall x. Rep PutImageResponse x -> PutImageResponse)
-> Generic PutImageResponse
forall x. Rep PutImageResponse x -> PutImageResponse
forall x. PutImageResponse -> Rep PutImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutImageResponse x -> PutImageResponse
$cfrom :: forall x. PutImageResponse -> Rep PutImageResponse x
Prelude.Generic)
newPutImageResponse ::
Prelude.Int ->
PutImageResponse
newPutImageResponse :: Int -> PutImageResponse
newPutImageResponse Int
pHttpStatus_ =
PutImageResponse' :: Maybe Image -> Int -> PutImageResponse
PutImageResponse'
{ $sel:image:PutImageResponse' :: Maybe Image
image = Maybe Image
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putImageResponse_image :: Lens.Lens' PutImageResponse (Prelude.Maybe Image)
putImageResponse_image :: (Maybe Image -> f (Maybe Image))
-> PutImageResponse -> f PutImageResponse
putImageResponse_image = (PutImageResponse -> Maybe Image)
-> (PutImageResponse -> Maybe Image -> PutImageResponse)
-> Lens
PutImageResponse PutImageResponse (Maybe Image) (Maybe Image)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageResponse' {Maybe Image
image :: Maybe Image
$sel:image:PutImageResponse' :: PutImageResponse -> Maybe Image
image} -> Maybe Image
image) (\s :: PutImageResponse
s@PutImageResponse' {} Maybe Image
a -> PutImageResponse
s {$sel:image:PutImageResponse' :: Maybe Image
image = Maybe Image
a} :: PutImageResponse)
putImageResponse_httpStatus :: Lens.Lens' PutImageResponse Prelude.Int
putImageResponse_httpStatus :: (Int -> f Int) -> PutImageResponse -> f PutImageResponse
putImageResponse_httpStatus = (PutImageResponse -> Int)
-> (PutImageResponse -> Int -> PutImageResponse)
-> Lens PutImageResponse PutImageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutImageResponse' :: PutImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutImageResponse
s@PutImageResponse' {} Int
a -> PutImageResponse
s {$sel:httpStatus:PutImageResponse' :: Int
httpStatus = Int
a} :: PutImageResponse)
instance Prelude.NFData PutImageResponse