{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ECR.BatchGetImage
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets detailed information for an image. Images are specified with either
-- an @imageTag@ or @imageDigest@.
--
-- When an image is pulled, the BatchGetImage API is called once to
-- retrieve the image manifest.
module Amazonka.ECR.BatchGetImage
  ( -- * Creating a Request
    BatchGetImage (..),
    newBatchGetImage,

    -- * Request Lenses
    batchGetImage_registryId,
    batchGetImage_acceptedMediaTypes,
    batchGetImage_repositoryName,
    batchGetImage_imageIds,

    -- * Destructuring the Response
    BatchGetImageResponse (..),
    newBatchGetImageResponse,

    -- * Response Lenses
    batchGetImageResponse_images,
    batchGetImageResponse_failures,
    batchGetImageResponse_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

-- | /See:/ 'newBatchGetImage' smart constructor.
data BatchGetImage = BatchGetImage'
  { -- | The Amazon Web Services account ID associated with the registry that
    -- contains the images to describe. If you do not specify a registry, the
    -- default registry is assumed.
    BatchGetImage -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The accepted media types for the request.
    --
    -- Valid values: @application\/vnd.docker.distribution.manifest.v1+json@ |
    -- @application\/vnd.docker.distribution.manifest.v2+json@ |
    -- @application\/vnd.oci.image.manifest.v1+json@
    BatchGetImage -> Maybe (NonEmpty Text)
acceptedMediaTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The repository that contains the images to describe.
    BatchGetImage -> Text
repositoryName :: Prelude.Text,
    -- | A list of image ID references that correspond to images to describe. The
    -- format of the @imageIds@ reference is @imageTag=tag@ or
    -- @imageDigest=digest@.
    BatchGetImage -> [ImageIdentifier]
imageIds :: [ImageIdentifier]
  }
  deriving (BatchGetImage -> BatchGetImage -> Bool
(BatchGetImage -> BatchGetImage -> Bool)
-> (BatchGetImage -> BatchGetImage -> Bool) -> Eq BatchGetImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetImage -> BatchGetImage -> Bool
$c/= :: BatchGetImage -> BatchGetImage -> Bool
== :: BatchGetImage -> BatchGetImage -> Bool
$c== :: BatchGetImage -> BatchGetImage -> Bool
Prelude.Eq, ReadPrec [BatchGetImage]
ReadPrec BatchGetImage
Int -> ReadS BatchGetImage
ReadS [BatchGetImage]
(Int -> ReadS BatchGetImage)
-> ReadS [BatchGetImage]
-> ReadPrec BatchGetImage
-> ReadPrec [BatchGetImage]
-> Read BatchGetImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetImage]
$creadListPrec :: ReadPrec [BatchGetImage]
readPrec :: ReadPrec BatchGetImage
$creadPrec :: ReadPrec BatchGetImage
readList :: ReadS [BatchGetImage]
$creadList :: ReadS [BatchGetImage]
readsPrec :: Int -> ReadS BatchGetImage
$creadsPrec :: Int -> ReadS BatchGetImage
Prelude.Read, Int -> BatchGetImage -> ShowS
[BatchGetImage] -> ShowS
BatchGetImage -> String
(Int -> BatchGetImage -> ShowS)
-> (BatchGetImage -> String)
-> ([BatchGetImage] -> ShowS)
-> Show BatchGetImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetImage] -> ShowS
$cshowList :: [BatchGetImage] -> ShowS
show :: BatchGetImage -> String
$cshow :: BatchGetImage -> String
showsPrec :: Int -> BatchGetImage -> ShowS
$cshowsPrec :: Int -> BatchGetImage -> ShowS
Prelude.Show, (forall x. BatchGetImage -> Rep BatchGetImage x)
-> (forall x. Rep BatchGetImage x -> BatchGetImage)
-> Generic BatchGetImage
forall x. Rep BatchGetImage x -> BatchGetImage
forall x. BatchGetImage -> Rep BatchGetImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetImage x -> BatchGetImage
$cfrom :: forall x. BatchGetImage -> Rep BatchGetImage x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetImage' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'registryId', 'batchGetImage_registryId' - The Amazon Web Services account ID associated with the registry that
-- contains the images to describe. If you do not specify a registry, the
-- default registry is assumed.
--
-- 'acceptedMediaTypes', 'batchGetImage_acceptedMediaTypes' - The accepted media types for the request.
--
-- Valid values: @application\/vnd.docker.distribution.manifest.v1+json@ |
-- @application\/vnd.docker.distribution.manifest.v2+json@ |
-- @application\/vnd.oci.image.manifest.v1+json@
--
-- 'repositoryName', 'batchGetImage_repositoryName' - The repository that contains the images to describe.
--
-- 'imageIds', 'batchGetImage_imageIds' - A list of image ID references that correspond to images to describe. The
-- format of the @imageIds@ reference is @imageTag=tag@ or
-- @imageDigest=digest@.
newBatchGetImage ::
  -- | 'repositoryName'
  Prelude.Text ->
  BatchGetImage
newBatchGetImage :: Text -> BatchGetImage
newBatchGetImage Text
pRepositoryName_ =
  BatchGetImage' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Text
-> [ImageIdentifier]
-> BatchGetImage
BatchGetImage'
    { $sel:registryId:BatchGetImage' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptedMediaTypes:BatchGetImage' :: Maybe (NonEmpty Text)
acceptedMediaTypes = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:BatchGetImage' :: Text
repositoryName = Text
pRepositoryName_,
      $sel:imageIds:BatchGetImage' :: [ImageIdentifier]
imageIds = [ImageIdentifier]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Web Services account ID associated with the registry that
-- contains the images to describe. If you do not specify a registry, the
-- default registry is assumed.
batchGetImage_registryId :: Lens.Lens' BatchGetImage (Prelude.Maybe Prelude.Text)
batchGetImage_registryId :: (Maybe Text -> f (Maybe Text)) -> BatchGetImage -> f BatchGetImage
batchGetImage_registryId = (BatchGetImage -> Maybe Text)
-> (BatchGetImage -> Maybe Text -> BatchGetImage)
-> Lens BatchGetImage BatchGetImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImage' {Maybe Text
registryId :: Maybe Text
$sel:registryId:BatchGetImage' :: BatchGetImage -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: BatchGetImage
s@BatchGetImage' {} Maybe Text
a -> BatchGetImage
s {$sel:registryId:BatchGetImage' :: Maybe Text
registryId = Maybe Text
a} :: BatchGetImage)

-- | The accepted media types for the request.
--
-- Valid values: @application\/vnd.docker.distribution.manifest.v1+json@ |
-- @application\/vnd.docker.distribution.manifest.v2+json@ |
-- @application\/vnd.oci.image.manifest.v1+json@
batchGetImage_acceptedMediaTypes :: Lens.Lens' BatchGetImage (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchGetImage_acceptedMediaTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetImage -> f BatchGetImage
batchGetImage_acceptedMediaTypes = (BatchGetImage -> Maybe (NonEmpty Text))
-> (BatchGetImage -> Maybe (NonEmpty Text) -> BatchGetImage)
-> Lens
     BatchGetImage
     BatchGetImage
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImage' {Maybe (NonEmpty Text)
acceptedMediaTypes :: Maybe (NonEmpty Text)
$sel:acceptedMediaTypes:BatchGetImage' :: BatchGetImage -> Maybe (NonEmpty Text)
acceptedMediaTypes} -> Maybe (NonEmpty Text)
acceptedMediaTypes) (\s :: BatchGetImage
s@BatchGetImage' {} Maybe (NonEmpty Text)
a -> BatchGetImage
s {$sel:acceptedMediaTypes:BatchGetImage' :: Maybe (NonEmpty Text)
acceptedMediaTypes = Maybe (NonEmpty Text)
a} :: BatchGetImage) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> BatchGetImage -> f BatchGetImage)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> BatchGetImage
-> f BatchGetImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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 AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The repository that contains the images to describe.
batchGetImage_repositoryName :: Lens.Lens' BatchGetImage Prelude.Text
batchGetImage_repositoryName :: (Text -> f Text) -> BatchGetImage -> f BatchGetImage
batchGetImage_repositoryName = (BatchGetImage -> Text)
-> (BatchGetImage -> Text -> BatchGetImage)
-> Lens BatchGetImage BatchGetImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImage' {Text
repositoryName :: Text
$sel:repositoryName:BatchGetImage' :: BatchGetImage -> Text
repositoryName} -> Text
repositoryName) (\s :: BatchGetImage
s@BatchGetImage' {} Text
a -> BatchGetImage
s {$sel:repositoryName:BatchGetImage' :: Text
repositoryName = Text
a} :: BatchGetImage)

-- | A list of image ID references that correspond to images to describe. The
-- format of the @imageIds@ reference is @imageTag=tag@ or
-- @imageDigest=digest@.
batchGetImage_imageIds :: Lens.Lens' BatchGetImage [ImageIdentifier]
batchGetImage_imageIds :: ([ImageIdentifier] -> f [ImageIdentifier])
-> BatchGetImage -> f BatchGetImage
batchGetImage_imageIds = (BatchGetImage -> [ImageIdentifier])
-> (BatchGetImage -> [ImageIdentifier] -> BatchGetImage)
-> Lens
     BatchGetImage BatchGetImage [ImageIdentifier] [ImageIdentifier]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImage' {[ImageIdentifier]
imageIds :: [ImageIdentifier]
$sel:imageIds:BatchGetImage' :: BatchGetImage -> [ImageIdentifier]
imageIds} -> [ImageIdentifier]
imageIds) (\s :: BatchGetImage
s@BatchGetImage' {} [ImageIdentifier]
a -> BatchGetImage
s {$sel:imageIds:BatchGetImage' :: [ImageIdentifier]
imageIds = [ImageIdentifier]
a} :: BatchGetImage) (([ImageIdentifier] -> f [ImageIdentifier])
 -> BatchGetImage -> f BatchGetImage)
-> (([ImageIdentifier] -> f [ImageIdentifier])
    -> [ImageIdentifier] -> f [ImageIdentifier])
-> ([ImageIdentifier] -> f [ImageIdentifier])
-> BatchGetImage
-> f BatchGetImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ImageIdentifier] -> f [ImageIdentifier])
-> [ImageIdentifier] -> f [ImageIdentifier]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest BatchGetImage where
  type
    AWSResponse BatchGetImage =
      BatchGetImageResponse
  request :: BatchGetImage -> Request BatchGetImage
request = Service -> BatchGetImage -> Request BatchGetImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy BatchGetImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetImage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse BatchGetImage))
-> Logger
-> Service
-> Proxy BatchGetImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetImage)))
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]
-> Maybe [ImageFailure] -> Int -> BatchGetImageResponse
BatchGetImageResponse'
            (Maybe [Image]
 -> Maybe [ImageFailure] -> Int -> BatchGetImageResponse)
-> Either String (Maybe [Image])
-> Either
     String (Maybe [ImageFailure] -> Int -> BatchGetImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Image]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"images" Either String (Maybe (Maybe [Image]))
-> Maybe [Image] -> Either String (Maybe [Image])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Image]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String (Maybe [ImageFailure] -> Int -> BatchGetImageResponse)
-> Either String (Maybe [ImageFailure])
-> Either String (Int -> BatchGetImageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ImageFailure]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failures" Either String (Maybe (Maybe [ImageFailure]))
-> Maybe [ImageFailure] -> Either String (Maybe [ImageFailure])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ImageFailure]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> BatchGetImageResponse)
-> Either String Int -> Either String BatchGetImageResponse
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 BatchGetImage

instance Prelude.NFData BatchGetImage

instance Core.ToHeaders BatchGetImage where
  toHeaders :: BatchGetImage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> BatchGetImage -> 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.BatchGetImage" ::
                          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 BatchGetImage where
  toJSON :: BatchGetImage -> Value
toJSON BatchGetImage' {[ImageIdentifier]
Maybe (NonEmpty Text)
Maybe Text
Text
imageIds :: [ImageIdentifier]
repositoryName :: Text
acceptedMediaTypes :: Maybe (NonEmpty Text)
registryId :: Maybe Text
$sel:imageIds:BatchGetImage' :: BatchGetImage -> [ImageIdentifier]
$sel:repositoryName:BatchGetImage' :: BatchGetImage -> Text
$sel:acceptedMediaTypes:BatchGetImage' :: BatchGetImage -> Maybe (NonEmpty Text)
$sel:registryId:BatchGetImage' :: BatchGetImage -> 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
"acceptedMediaTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
acceptedMediaTypes,
            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
"imageIds" Text -> [ImageIdentifier] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ImageIdentifier]
imageIds)
          ]
      )

instance Core.ToPath BatchGetImage where
  toPath :: BatchGetImage -> ByteString
toPath = ByteString -> BatchGetImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery BatchGetImage where
  toQuery :: BatchGetImage -> QueryString
toQuery = QueryString -> BatchGetImage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newBatchGetImageResponse' smart constructor.
data BatchGetImageResponse = BatchGetImageResponse'
  { -- | A list of image objects corresponding to the image references in the
    -- request.
    BatchGetImageResponse -> Maybe [Image]
images :: Prelude.Maybe [Image],
    -- | Any failures associated with the call.
    BatchGetImageResponse -> Maybe [ImageFailure]
failures :: Prelude.Maybe [ImageFailure],
    -- | The response's http status code.
    BatchGetImageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (BatchGetImageResponse -> BatchGetImageResponse -> Bool
(BatchGetImageResponse -> BatchGetImageResponse -> Bool)
-> (BatchGetImageResponse -> BatchGetImageResponse -> Bool)
-> Eq BatchGetImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetImageResponse -> BatchGetImageResponse -> Bool
$c/= :: BatchGetImageResponse -> BatchGetImageResponse -> Bool
== :: BatchGetImageResponse -> BatchGetImageResponse -> Bool
$c== :: BatchGetImageResponse -> BatchGetImageResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetImageResponse]
ReadPrec BatchGetImageResponse
Int -> ReadS BatchGetImageResponse
ReadS [BatchGetImageResponse]
(Int -> ReadS BatchGetImageResponse)
-> ReadS [BatchGetImageResponse]
-> ReadPrec BatchGetImageResponse
-> ReadPrec [BatchGetImageResponse]
-> Read BatchGetImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetImageResponse]
$creadListPrec :: ReadPrec [BatchGetImageResponse]
readPrec :: ReadPrec BatchGetImageResponse
$creadPrec :: ReadPrec BatchGetImageResponse
readList :: ReadS [BatchGetImageResponse]
$creadList :: ReadS [BatchGetImageResponse]
readsPrec :: Int -> ReadS BatchGetImageResponse
$creadsPrec :: Int -> ReadS BatchGetImageResponse
Prelude.Read, Int -> BatchGetImageResponse -> ShowS
[BatchGetImageResponse] -> ShowS
BatchGetImageResponse -> String
(Int -> BatchGetImageResponse -> ShowS)
-> (BatchGetImageResponse -> String)
-> ([BatchGetImageResponse] -> ShowS)
-> Show BatchGetImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetImageResponse] -> ShowS
$cshowList :: [BatchGetImageResponse] -> ShowS
show :: BatchGetImageResponse -> String
$cshow :: BatchGetImageResponse -> String
showsPrec :: Int -> BatchGetImageResponse -> ShowS
$cshowsPrec :: Int -> BatchGetImageResponse -> ShowS
Prelude.Show, (forall x. BatchGetImageResponse -> Rep BatchGetImageResponse x)
-> (forall x. Rep BatchGetImageResponse x -> BatchGetImageResponse)
-> Generic BatchGetImageResponse
forall x. Rep BatchGetImageResponse x -> BatchGetImageResponse
forall x. BatchGetImageResponse -> Rep BatchGetImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetImageResponse x -> BatchGetImageResponse
$cfrom :: forall x. BatchGetImageResponse -> Rep BatchGetImageResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetImageResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'images', 'batchGetImageResponse_images' - A list of image objects corresponding to the image references in the
-- request.
--
-- 'failures', 'batchGetImageResponse_failures' - Any failures associated with the call.
--
-- 'httpStatus', 'batchGetImageResponse_httpStatus' - The response's http status code.
newBatchGetImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchGetImageResponse
newBatchGetImageResponse :: Int -> BatchGetImageResponse
newBatchGetImageResponse Int
pHttpStatus_ =
  BatchGetImageResponse' :: Maybe [Image]
-> Maybe [ImageFailure] -> Int -> BatchGetImageResponse
BatchGetImageResponse'
    { $sel:images:BatchGetImageResponse' :: Maybe [Image]
images = Maybe [Image]
forall a. Maybe a
Prelude.Nothing,
      $sel:failures:BatchGetImageResponse' :: Maybe [ImageFailure]
failures = Maybe [ImageFailure]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchGetImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of image objects corresponding to the image references in the
-- request.
batchGetImageResponse_images :: Lens.Lens' BatchGetImageResponse (Prelude.Maybe [Image])
batchGetImageResponse_images :: (Maybe [Image] -> f (Maybe [Image]))
-> BatchGetImageResponse -> f BatchGetImageResponse
batchGetImageResponse_images = (BatchGetImageResponse -> Maybe [Image])
-> (BatchGetImageResponse
    -> Maybe [Image] -> BatchGetImageResponse)
-> Lens
     BatchGetImageResponse
     BatchGetImageResponse
     (Maybe [Image])
     (Maybe [Image])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImageResponse' {Maybe [Image]
images :: Maybe [Image]
$sel:images:BatchGetImageResponse' :: BatchGetImageResponse -> Maybe [Image]
images} -> Maybe [Image]
images) (\s :: BatchGetImageResponse
s@BatchGetImageResponse' {} Maybe [Image]
a -> BatchGetImageResponse
s {$sel:images:BatchGetImageResponse' :: Maybe [Image]
images = Maybe [Image]
a} :: BatchGetImageResponse) ((Maybe [Image] -> f (Maybe [Image]))
 -> BatchGetImageResponse -> f BatchGetImageResponse)
-> ((Maybe [Image] -> f (Maybe [Image]))
    -> Maybe [Image] -> f (Maybe [Image]))
-> (Maybe [Image] -> f (Maybe [Image]))
-> BatchGetImageResponse
-> f BatchGetImageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Image] [Image] [Image] [Image]
-> Iso
     (Maybe [Image]) (Maybe [Image]) (Maybe [Image]) (Maybe [Image])
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 AnIso [Image] [Image] [Image] [Image]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Any failures associated with the call.
batchGetImageResponse_failures :: Lens.Lens' BatchGetImageResponse (Prelude.Maybe [ImageFailure])
batchGetImageResponse_failures :: (Maybe [ImageFailure] -> f (Maybe [ImageFailure]))
-> BatchGetImageResponse -> f BatchGetImageResponse
batchGetImageResponse_failures = (BatchGetImageResponse -> Maybe [ImageFailure])
-> (BatchGetImageResponse
    -> Maybe [ImageFailure] -> BatchGetImageResponse)
-> Lens
     BatchGetImageResponse
     BatchGetImageResponse
     (Maybe [ImageFailure])
     (Maybe [ImageFailure])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImageResponse' {Maybe [ImageFailure]
failures :: Maybe [ImageFailure]
$sel:failures:BatchGetImageResponse' :: BatchGetImageResponse -> Maybe [ImageFailure]
failures} -> Maybe [ImageFailure]
failures) (\s :: BatchGetImageResponse
s@BatchGetImageResponse' {} Maybe [ImageFailure]
a -> BatchGetImageResponse
s {$sel:failures:BatchGetImageResponse' :: Maybe [ImageFailure]
failures = Maybe [ImageFailure]
a} :: BatchGetImageResponse) ((Maybe [ImageFailure] -> f (Maybe [ImageFailure]))
 -> BatchGetImageResponse -> f BatchGetImageResponse)
-> ((Maybe [ImageFailure] -> f (Maybe [ImageFailure]))
    -> Maybe [ImageFailure] -> f (Maybe [ImageFailure]))
-> (Maybe [ImageFailure] -> f (Maybe [ImageFailure]))
-> BatchGetImageResponse
-> f BatchGetImageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ImageFailure] [ImageFailure] [ImageFailure] [ImageFailure]
-> Iso
     (Maybe [ImageFailure])
     (Maybe [ImageFailure])
     (Maybe [ImageFailure])
     (Maybe [ImageFailure])
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 AnIso [ImageFailure] [ImageFailure] [ImageFailure] [ImageFailure]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
batchGetImageResponse_httpStatus :: Lens.Lens' BatchGetImageResponse Prelude.Int
batchGetImageResponse_httpStatus :: (Int -> f Int) -> BatchGetImageResponse -> f BatchGetImageResponse
batchGetImageResponse_httpStatus = (BatchGetImageResponse -> Int)
-> (BatchGetImageResponse -> Int -> BatchGetImageResponse)
-> Lens BatchGetImageResponse BatchGetImageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetImageResponse' :: BatchGetImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetImageResponse
s@BatchGetImageResponse' {} Int
a -> BatchGetImageResponse
s {$sel:httpStatus:BatchGetImageResponse' :: Int
httpStatus = Int
a} :: BatchGetImageResponse)

instance Prelude.NFData BatchGetImageResponse