{-# 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.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.ECR.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 -> [ImageIdentifier]
imageIds :: [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 ->
BatchDeleteImage
newBatchDeleteImage :: Text -> BatchDeleteImage
newBatchDeleteImage Text
pRepositoryName_ =
BatchDeleteImage'
{ $sel:registryId:BatchDeleteImage' :: Maybe Text
registryId = forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:BatchDeleteImage' :: Text
repositoryName = Text
pRepositoryName_,
$sel:imageIds:BatchDeleteImage' :: [ImageIdentifier]
imageIds = forall a. Monoid a => a
Prelude.mempty
}
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 [ImageIdentifier]
batchDeleteImage_imageIds :: Lens' BatchDeleteImage [ImageIdentifier]
batchDeleteImage_imageIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImage' {[ImageIdentifier]
imageIds :: [ImageIdentifier]
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> [ImageIdentifier]
imageIds} -> [ImageIdentifier]
imageIds) (\s :: BatchDeleteImage
s@BatchDeleteImage' {} [ImageIdentifier]
a -> BatchDeleteImage
s {$sel:imageIds:BatchDeleteImage' :: [ImageIdentifier]
imageIds = [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 [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. 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.<*> (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' {[ImageIdentifier]
Maybe Text
Text
imageIds :: [ImageIdentifier]
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> [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` [ImageIdentifier]
imageIds
instance Prelude.NFData BatchDeleteImage where
rnf :: BatchDeleteImage -> ()
rnf BatchDeleteImage' {[ImageIdentifier]
Maybe Text
Text
imageIds :: [ImageIdentifier]
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> [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 [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
"AmazonEC2ContainerRegistry_V20150921.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' {[ImageIdentifier]
Maybe Text
Text
imageIds :: [ImageIdentifier]
repositoryName :: Text
registryId :: Maybe Text
$sel:imageIds:BatchDeleteImage' :: BatchDeleteImage -> [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..= [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 [ImageIdentifier]
imageIds :: Prelude.Maybe [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 [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 [ImageIdentifier])
batchDeleteImageResponse_imageIds :: Lens' BatchDeleteImageResponse (Maybe [ImageIdentifier])
batchDeleteImageResponse_imageIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteImageResponse' {Maybe [ImageIdentifier]
imageIds :: Maybe [ImageIdentifier]
$sel:imageIds:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe [ImageIdentifier]
imageIds} -> Maybe [ImageIdentifier]
imageIds) (\s :: BatchDeleteImageResponse
s@BatchDeleteImageResponse' {} Maybe [ImageIdentifier]
a -> BatchDeleteImageResponse
s {$sel:imageIds:BatchDeleteImageResponse' :: Maybe [ImageIdentifier]
imageIds = Maybe [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 [ImageIdentifier]
Maybe [ImageFailure]
httpStatus :: Int
imageIds :: Maybe [ImageIdentifier]
failures :: Maybe [ImageFailure]
$sel:httpStatus:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Int
$sel:imageIds:BatchDeleteImageResponse' :: BatchDeleteImageResponse -> Maybe [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 [ImageIdentifier]
imageIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus