{-# 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.ECRPublic.BatchDeleteImage
(
BatchDeleteImage (..),
newBatchDeleteImage,
batchDeleteImage_registryId,
batchDeleteImage_repositoryName,
batchDeleteImage_imageIds,
BatchDeleteImageResponse (..),
newBatchDeleteImageResponse,
batchDeleteImageResponse_failures,
batchDeleteImageResponse_imageIds,
batchDeleteImageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECRPublic.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchDeleteImage = BatchDeleteImage'
{
BatchDeleteImage -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
BatchDeleteImage -> Text
repositoryName :: Prelude.Text,
BatchDeleteImage -> NonEmpty ImageIdentifier
imageIds :: Prelude.NonEmpty ImageIdentifier
}
deriving (BatchDeleteImage -> BatchDeleteImage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteImage -> BatchDeleteImage -> Bool
$c/= :: BatchDeleteImage -> BatchDeleteImage -> Bool
== :: BatchDeleteImage -> BatchDeleteImage -> Bool
$c== :: BatchDeleteImage -> BatchDeleteImage -> Bool
Prelude.Eq, ReadPrec [BatchDeleteImage]
ReadPrec BatchDeleteImage
Int -> ReadS BatchDeleteImage
ReadS [BatchDeleteImage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteImage]
$creadListPrec :: ReadPrec [BatchDeleteImage]
readPrec :: ReadPrec BatchDeleteImage
$creadPrec :: ReadPrec BatchDeleteImage
readList :: ReadS [BatchDeleteImage]
$creadList :: ReadS [BatchDeleteImage]
readsPrec :: Int -> ReadS BatchDeleteImage
$creadsPrec :: Int -> ReadS BatchDeleteImage
Prelude.Read, Int -> BatchDeleteImage -> ShowS
[BatchDeleteImage] -> ShowS
BatchDeleteImage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteImage] -> ShowS
$cshowList :: [BatchDeleteImage] -> ShowS
show :: BatchDeleteImage -> String
$cshow :: BatchDeleteImage -> String
showsPrec :: Int -> BatchDeleteImage -> ShowS
$cshowsPrec :: Int -> BatchDeleteImage -> ShowS
Prelude.Show, forall x. Rep BatchDeleteImage x -> BatchDeleteImage
forall x. BatchDeleteImage -> Rep BatchDeleteImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeleteImage x -> BatchDeleteImage
$cfrom :: forall x. BatchDeleteImage -> Rep BatchDeleteImage x
Prelude.Generic)
newBatchDeleteImage ::
Prelude.Text ->
Prelude.NonEmpty ImageIdentifier ->
BatchDeleteImage
newBatchDeleteImage :: Text -> NonEmpty ImageIdentifier -> BatchDeleteImage
newBatchDeleteImage Text
pRepositoryName_ NonEmpty ImageIdentifier
pImageIds_ =
BatchDeleteImage'
{ $sel:registryId:BatchDeleteImage' :: Maybe Text
registryId = forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:BatchDeleteImage' :: Text
repositoryName = Text
pRepositoryName_,
$sel:imageIds:BatchDeleteImage' :: NonEmpty ImageIdentifier
imageIds = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty ImageIdentifier
pImageIds_
}
batchDeleteImage_registryId :: Lens.Lens' BatchDeleteImage (Prelude.Maybe Prelude.Text)
batchDeleteImage_registryId :: Lens' BatchDeleteImage (Maybe Text)
batchDeleteImage_registryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImage' {Maybe Text
registryId :: Maybe Text
$sel:registryId:BatchDeleteImage' :: BatchDeleteImage -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: BatchDeleteImage
s@BatchDeleteImage' {} Maybe Text
a -> BatchDeleteImage
s {$sel:registryId:BatchDeleteImage' :: Maybe Text
registryId = Maybe Text
a} :: BatchDeleteImage)
batchDeleteImage_repositoryName :: Lens.Lens' BatchDeleteImage Prelude.Text
batchDeleteImage_repositoryName :: Lens' BatchDeleteImage Text
batchDeleteImage_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImage' {Text
repositoryName :: Text
$sel:repositoryName:BatchDeleteImage' :: BatchDeleteImage -> Text
repositoryName} -> Text
repositoryName) (\s :: BatchDeleteImage
s@BatchDeleteImage' {} Text
a -> BatchDeleteImage
s {$sel:repositoryName:BatchDeleteImage' :: Text
repositoryName = Text
a} :: BatchDeleteImage)
batchDeleteImage_imageIds :: Lens.Lens' BatchDeleteImage (Prelude.NonEmpty ImageIdentifier)
batchDeleteImage_imageIds :: Lens' BatchDeleteImage (NonEmpty ImageIdentifier)
batchDeleteImage_imageIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImage' {NonEmpty ImageIdentifier
imageIds :: NonEmpty ImageIdentifier
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> NonEmpty ImageIdentifier
imageIds} -> NonEmpty ImageIdentifier
imageIds) (\s :: BatchDeleteImage
s@BatchDeleteImage' {} NonEmpty ImageIdentifier
a -> BatchDeleteImage
s {$sel:imageIds:BatchDeleteImage' :: NonEmpty ImageIdentifier
imageIds = NonEmpty ImageIdentifier
a} :: BatchDeleteImage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchDeleteImage where
type
AWSResponse BatchDeleteImage =
BatchDeleteImageResponse
request :: (Service -> Service)
-> BatchDeleteImage -> Request BatchDeleteImage
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchDeleteImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchDeleteImage)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [ImageFailure]
-> Maybe (NonEmpty ImageIdentifier)
-> Int
-> BatchDeleteImageResponse
BatchDeleteImageResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"failures" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"imageIds")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchDeleteImage where
hashWithSalt :: Int -> BatchDeleteImage -> Int
hashWithSalt Int
_salt BatchDeleteImage' {Maybe Text
NonEmpty ImageIdentifier
Text
imageIds :: NonEmpty ImageIdentifier
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> NonEmpty ImageIdentifier
$sel:repositoryName:BatchDeleteImage' :: BatchDeleteImage -> Text
$sel:registryId:BatchDeleteImage' :: BatchDeleteImage -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registryId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty ImageIdentifier
imageIds
instance Prelude.NFData BatchDeleteImage where
rnf :: BatchDeleteImage -> ()
rnf BatchDeleteImage' {Maybe Text
NonEmpty ImageIdentifier
Text
imageIds :: NonEmpty ImageIdentifier
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> NonEmpty ImageIdentifier
$sel:repositoryName:BatchDeleteImage' :: BatchDeleteImage -> Text
$sel:registryId:BatchDeleteImage' :: BatchDeleteImage -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repositoryName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty ImageIdentifier
imageIds
instance Data.ToHeaders BatchDeleteImage where
toHeaders :: BatchDeleteImage -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SpencerFrontendService.BatchDeleteImage" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchDeleteImage where
toJSON :: BatchDeleteImage -> Value
toJSON BatchDeleteImage' {Maybe Text
NonEmpty ImageIdentifier
Text
imageIds :: NonEmpty ImageIdentifier
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> NonEmpty ImageIdentifier
$sel:repositoryName:BatchDeleteImage' :: BatchDeleteImage -> Text
$sel:registryId:BatchDeleteImage' :: BatchDeleteImage -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"registryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryId,
forall a. a -> Maybe a
Prelude.Just
(Key
"repositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
repositoryName),
forall a. a -> Maybe a
Prelude.Just (Key
"imageIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty ImageIdentifier
imageIds)
]
)
instance Data.ToPath BatchDeleteImage where
toPath :: BatchDeleteImage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchDeleteImage where
toQuery :: BatchDeleteImage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDeleteImageResponse = BatchDeleteImageResponse'
{
BatchDeleteImageResponse -> Maybe [ImageFailure]
failures :: Prelude.Maybe [ImageFailure],
BatchDeleteImageResponse -> Maybe (NonEmpty ImageIdentifier)
imageIds :: Prelude.Maybe (Prelude.NonEmpty ImageIdentifier),
BatchDeleteImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchDeleteImageResponse -> BatchDeleteImageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteImageResponse -> BatchDeleteImageResponse -> Bool
$c/= :: BatchDeleteImageResponse -> BatchDeleteImageResponse -> Bool
== :: BatchDeleteImageResponse -> BatchDeleteImageResponse -> Bool
$c== :: BatchDeleteImageResponse -> BatchDeleteImageResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeleteImageResponse]
ReadPrec BatchDeleteImageResponse
Int -> ReadS BatchDeleteImageResponse
ReadS [BatchDeleteImageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteImageResponse]
$creadListPrec :: ReadPrec [BatchDeleteImageResponse]
readPrec :: ReadPrec BatchDeleteImageResponse
$creadPrec :: ReadPrec BatchDeleteImageResponse
readList :: ReadS [BatchDeleteImageResponse]
$creadList :: ReadS [BatchDeleteImageResponse]
readsPrec :: Int -> ReadS BatchDeleteImageResponse
$creadsPrec :: Int -> ReadS BatchDeleteImageResponse
Prelude.Read, Int -> BatchDeleteImageResponse -> ShowS
[BatchDeleteImageResponse] -> ShowS
BatchDeleteImageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteImageResponse] -> ShowS
$cshowList :: [BatchDeleteImageResponse] -> ShowS
show :: BatchDeleteImageResponse -> String
$cshow :: BatchDeleteImageResponse -> String
showsPrec :: Int -> BatchDeleteImageResponse -> ShowS
$cshowsPrec :: Int -> BatchDeleteImageResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDeleteImageResponse x -> BatchDeleteImageResponse
forall x.
BatchDeleteImageResponse -> Rep BatchDeleteImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeleteImageResponse x -> BatchDeleteImageResponse
$cfrom :: forall x.
BatchDeleteImageResponse -> Rep BatchDeleteImageResponse x
Prelude.Generic)
newBatchDeleteImageResponse ::
Prelude.Int ->
BatchDeleteImageResponse
newBatchDeleteImageResponse :: Int -> BatchDeleteImageResponse
newBatchDeleteImageResponse Int
pHttpStatus_ =
BatchDeleteImageResponse'
{ $sel:failures:BatchDeleteImageResponse' :: Maybe [ImageFailure]
failures =
forall a. Maybe a
Prelude.Nothing,
$sel:imageIds:BatchDeleteImageResponse' :: Maybe (NonEmpty ImageIdentifier)
imageIds = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchDeleteImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchDeleteImageResponse_failures :: Lens.Lens' BatchDeleteImageResponse (Prelude.Maybe [ImageFailure])
batchDeleteImageResponse_failures :: Lens' BatchDeleteImageResponse (Maybe [ImageFailure])
batchDeleteImageResponse_failures = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImageResponse' {Maybe [ImageFailure]
failures :: Maybe [ImageFailure]
$sel:failures:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe [ImageFailure]
failures} -> Maybe [ImageFailure]
failures) (\s :: BatchDeleteImageResponse
s@BatchDeleteImageResponse' {} Maybe [ImageFailure]
a -> BatchDeleteImageResponse
s {$sel:failures:BatchDeleteImageResponse' :: Maybe [ImageFailure]
failures = Maybe [ImageFailure]
a} :: BatchDeleteImageResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchDeleteImageResponse_imageIds :: Lens.Lens' BatchDeleteImageResponse (Prelude.Maybe (Prelude.NonEmpty ImageIdentifier))
batchDeleteImageResponse_imageIds :: Lens' BatchDeleteImageResponse (Maybe (NonEmpty ImageIdentifier))
batchDeleteImageResponse_imageIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImageResponse' {Maybe (NonEmpty ImageIdentifier)
imageIds :: Maybe (NonEmpty ImageIdentifier)
$sel:imageIds:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe (NonEmpty ImageIdentifier)
imageIds} -> Maybe (NonEmpty ImageIdentifier)
imageIds) (\s :: BatchDeleteImageResponse
s@BatchDeleteImageResponse' {} Maybe (NonEmpty ImageIdentifier)
a -> BatchDeleteImageResponse
s {$sel:imageIds:BatchDeleteImageResponse' :: Maybe (NonEmpty ImageIdentifier)
imageIds = Maybe (NonEmpty ImageIdentifier)
a} :: BatchDeleteImageResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchDeleteImageResponse_httpStatus :: Lens.Lens' BatchDeleteImageResponse Prelude.Int
batchDeleteImageResponse_httpStatus :: Lens' BatchDeleteImageResponse Int
batchDeleteImageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDeleteImageResponse
s@BatchDeleteImageResponse' {} Int
a -> BatchDeleteImageResponse
s {$sel:httpStatus:BatchDeleteImageResponse' :: Int
httpStatus = Int
a} :: BatchDeleteImageResponse)
instance Prelude.NFData BatchDeleteImageResponse where
rnf :: BatchDeleteImageResponse -> ()
rnf BatchDeleteImageResponse' {Int
Maybe [ImageFailure]
Maybe (NonEmpty ImageIdentifier)
httpStatus :: Int
imageIds :: Maybe (NonEmpty ImageIdentifier)
failures :: Maybe [ImageFailure]
$sel:httpStatus:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Int
$sel:imageIds:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe (NonEmpty ImageIdentifier)
$sel:failures:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe [ImageFailure]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ImageFailure]
failures
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ImageIdentifier)
imageIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus