{-# 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.ListImages
-- 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)
--
-- Lists all the image IDs for the specified repository.
--
-- You can filter images based on whether or not they are tagged by using
-- the @tagStatus@ filter and specifying either @TAGGED@, @UNTAGGED@ or
-- @ANY@. For example, you can filter your results to return only
-- @UNTAGGED@ images and then pipe that result to a BatchDeleteImage
-- operation to delete them. Or, you can filter your results to return only
-- @TAGGED@ images to list all of the tags in your repository.
--
-- This operation returns paginated results.
module Amazonka.ECR.ListImages
  ( -- * Creating a Request
    ListImages (..),
    newListImages,

    -- * Request Lenses
    listImages_registryId,
    listImages_nextToken,
    listImages_filter,
    listImages_maxResults,
    listImages_repositoryName,

    -- * Destructuring the Response
    ListImagesResponse (..),
    newListImagesResponse,

    -- * Response Lenses
    listImagesResponse_imageIds,
    listImagesResponse_nextToken,
    listImagesResponse_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:/ 'newListImages' smart constructor.
data ListImages = ListImages'
  { -- | The Amazon Web Services account ID associated with the registry that
    -- contains the repository in which to list images. If you do not specify a
    -- registry, the default registry is assumed.
    ListImages -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a previous paginated @ListImages@
    -- request where @maxResults@ was used and the results exceeded the value
    -- of that parameter. Pagination continues from the end of the previous
    -- results that returned the @nextToken@ value. This value is @null@ when
    -- there are no more results to return.
    --
    -- This token should be treated as an opaque identifier that is only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    ListImages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The filter key and value with which to filter your @ListImages@ results.
    ListImages -> Maybe ListImagesFilter
filter' :: Prelude.Maybe ListImagesFilter,
    -- | The maximum number of image results returned by @ListImages@ in
    -- paginated output. When this parameter is used, @ListImages@ only returns
    -- @maxResults@ results in a single page along with a @nextToken@ response
    -- element. The remaining results of the initial request can be seen by
    -- sending another @ListImages@ request with the returned @nextToken@
    -- value. This value can be between 1 and 1000. If this parameter is not
    -- used, then @ListImages@ returns up to 100 results and a @nextToken@
    -- value, if applicable.
    ListImages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The repository with image IDs to be listed.
    ListImages -> Text
repositoryName :: Prelude.Text
  }
  deriving (ListImages -> ListImages -> Bool
(ListImages -> ListImages -> Bool)
-> (ListImages -> ListImages -> Bool) -> Eq ListImages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImages -> ListImages -> Bool
$c/= :: ListImages -> ListImages -> Bool
== :: ListImages -> ListImages -> Bool
$c== :: ListImages -> ListImages -> Bool
Prelude.Eq, ReadPrec [ListImages]
ReadPrec ListImages
Int -> ReadS ListImages
ReadS [ListImages]
(Int -> ReadS ListImages)
-> ReadS [ListImages]
-> ReadPrec ListImages
-> ReadPrec [ListImages]
-> Read ListImages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImages]
$creadListPrec :: ReadPrec [ListImages]
readPrec :: ReadPrec ListImages
$creadPrec :: ReadPrec ListImages
readList :: ReadS [ListImages]
$creadList :: ReadS [ListImages]
readsPrec :: Int -> ReadS ListImages
$creadsPrec :: Int -> ReadS ListImages
Prelude.Read, Int -> ListImages -> ShowS
[ListImages] -> ShowS
ListImages -> String
(Int -> ListImages -> ShowS)
-> (ListImages -> String)
-> ([ListImages] -> ShowS)
-> Show ListImages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImages] -> ShowS
$cshowList :: [ListImages] -> ShowS
show :: ListImages -> String
$cshow :: ListImages -> String
showsPrec :: Int -> ListImages -> ShowS
$cshowsPrec :: Int -> ListImages -> ShowS
Prelude.Show, (forall x. ListImages -> Rep ListImages x)
-> (forall x. Rep ListImages x -> ListImages) -> Generic ListImages
forall x. Rep ListImages x -> ListImages
forall x. ListImages -> Rep ListImages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListImages x -> ListImages
$cfrom :: forall x. ListImages -> Rep ListImages x
Prelude.Generic)

-- |
-- Create a value of 'ListImages' 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', 'listImages_registryId' - The Amazon Web Services account ID associated with the registry that
-- contains the repository in which to list images. If you do not specify a
-- registry, the default registry is assumed.
--
-- 'nextToken', 'listImages_nextToken' - The @nextToken@ value returned from a previous paginated @ListImages@
-- request where @maxResults@ was used and the results exceeded the value
-- of that parameter. Pagination continues from the end of the previous
-- results that returned the @nextToken@ value. This value is @null@ when
-- there are no more results to return.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'filter'', 'listImages_filter' - The filter key and value with which to filter your @ListImages@ results.
--
-- 'maxResults', 'listImages_maxResults' - The maximum number of image results returned by @ListImages@ in
-- paginated output. When this parameter is used, @ListImages@ only returns
-- @maxResults@ results in a single page along with a @nextToken@ response
-- element. The remaining results of the initial request can be seen by
-- sending another @ListImages@ request with the returned @nextToken@
-- value. This value can be between 1 and 1000. If this parameter is not
-- used, then @ListImages@ returns up to 100 results and a @nextToken@
-- value, if applicable.
--
-- 'repositoryName', 'listImages_repositoryName' - The repository with image IDs to be listed.
newListImages ::
  -- | 'repositoryName'
  Prelude.Text ->
  ListImages
newListImages :: Text -> ListImages
newListImages Text
pRepositoryName_ =
  ListImages' :: Maybe Text
-> Maybe Text
-> Maybe ListImagesFilter
-> Maybe Natural
-> Text
-> ListImages
ListImages'
    { $sel:registryId:ListImages' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListImages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListImages' :: Maybe ListImagesFilter
filter' = Maybe ListImagesFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListImages' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:ListImages' :: Text
repositoryName = Text
pRepositoryName_
    }

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

-- | The @nextToken@ value returned from a previous paginated @ListImages@
-- request where @maxResults@ was used and the results exceeded the value
-- of that parameter. Pagination continues from the end of the previous
-- results that returned the @nextToken@ value. This value is @null@ when
-- there are no more results to return.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
listImages_nextToken :: Lens.Lens' ListImages (Prelude.Maybe Prelude.Text)
listImages_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListImages -> f ListImages
listImages_nextToken = (ListImages -> Maybe Text)
-> (ListImages -> Maybe Text -> ListImages)
-> Lens ListImages ListImages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImages' :: ListImages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImages
s@ListImages' {} Maybe Text
a -> ListImages
s {$sel:nextToken:ListImages' :: Maybe Text
nextToken = Maybe Text
a} :: ListImages)

-- | The filter key and value with which to filter your @ListImages@ results.
listImages_filter :: Lens.Lens' ListImages (Prelude.Maybe ListImagesFilter)
listImages_filter :: (Maybe ListImagesFilter -> f (Maybe ListImagesFilter))
-> ListImages -> f ListImages
listImages_filter = (ListImages -> Maybe ListImagesFilter)
-> (ListImages -> Maybe ListImagesFilter -> ListImages)
-> Lens
     ListImages
     ListImages
     (Maybe ListImagesFilter)
     (Maybe ListImagesFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImages' {Maybe ListImagesFilter
filter' :: Maybe ListImagesFilter
$sel:filter':ListImages' :: ListImages -> Maybe ListImagesFilter
filter'} -> Maybe ListImagesFilter
filter') (\s :: ListImages
s@ListImages' {} Maybe ListImagesFilter
a -> ListImages
s {$sel:filter':ListImages' :: Maybe ListImagesFilter
filter' = Maybe ListImagesFilter
a} :: ListImages)

-- | The maximum number of image results returned by @ListImages@ in
-- paginated output. When this parameter is used, @ListImages@ only returns
-- @maxResults@ results in a single page along with a @nextToken@ response
-- element. The remaining results of the initial request can be seen by
-- sending another @ListImages@ request with the returned @nextToken@
-- value. This value can be between 1 and 1000. If this parameter is not
-- used, then @ListImages@ returns up to 100 results and a @nextToken@
-- value, if applicable.
listImages_maxResults :: Lens.Lens' ListImages (Prelude.Maybe Prelude.Natural)
listImages_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListImages -> f ListImages
listImages_maxResults = (ListImages -> Maybe Natural)
-> (ListImages -> Maybe Natural -> ListImages)
-> Lens ListImages ListImages (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListImages' :: ListImages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListImages
s@ListImages' {} Maybe Natural
a -> ListImages
s {$sel:maxResults:ListImages' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListImages)

-- | The repository with image IDs to be listed.
listImages_repositoryName :: Lens.Lens' ListImages Prelude.Text
listImages_repositoryName :: (Text -> f Text) -> ListImages -> f ListImages
listImages_repositoryName = (ListImages -> Text)
-> (ListImages -> Text -> ListImages)
-> Lens ListImages ListImages Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImages' {Text
repositoryName :: Text
$sel:repositoryName:ListImages' :: ListImages -> Text
repositoryName} -> Text
repositoryName) (\s :: ListImages
s@ListImages' {} Text
a -> ListImages
s {$sel:repositoryName:ListImages' :: Text
repositoryName = Text
a} :: ListImages)

instance Core.AWSPager ListImages where
  page :: ListImages -> AWSResponse ListImages -> Maybe ListImages
page ListImages
rq AWSResponse ListImages
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListImages
ListImagesResponse
rs
            ListImagesResponse
-> Getting (First Text) ListImagesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListImagesResponse -> Const (First Text) ListImagesResponse
Lens' ListImagesResponse (Maybe Text)
listImagesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListImagesResponse -> Const (First Text) ListImagesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListImagesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListImages
forall a. Maybe a
Prelude.Nothing
    | Maybe [ImageIdentifier] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListImages
ListImagesResponse
rs
            ListImagesResponse
-> Getting
     (First [ImageIdentifier]) ListImagesResponse [ImageIdentifier]
-> Maybe [ImageIdentifier]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ImageIdentifier]
 -> Const (First [ImageIdentifier]) (Maybe [ImageIdentifier]))
-> ListImagesResponse
-> Const (First [ImageIdentifier]) ListImagesResponse
Lens' ListImagesResponse (Maybe [ImageIdentifier])
listImagesResponse_imageIds ((Maybe [ImageIdentifier]
  -> Const (First [ImageIdentifier]) (Maybe [ImageIdentifier]))
 -> ListImagesResponse
 -> Const (First [ImageIdentifier]) ListImagesResponse)
-> (([ImageIdentifier]
     -> Const (First [ImageIdentifier]) [ImageIdentifier])
    -> Maybe [ImageIdentifier]
    -> Const (First [ImageIdentifier]) (Maybe [ImageIdentifier]))
-> Getting
     (First [ImageIdentifier]) ListImagesResponse [ImageIdentifier]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ImageIdentifier]
 -> Const (First [ImageIdentifier]) [ImageIdentifier])
-> Maybe [ImageIdentifier]
-> Const (First [ImageIdentifier]) (Maybe [ImageIdentifier])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListImages
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListImages -> Maybe ListImages
forall a. a -> Maybe a
Prelude.Just (ListImages -> Maybe ListImages) -> ListImages -> Maybe ListImages
forall a b. (a -> b) -> a -> b
Prelude.$
        ListImages
rq
          ListImages -> (ListImages -> ListImages) -> ListImages
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListImages -> Identity ListImages
Lens ListImages ListImages (Maybe Text) (Maybe Text)
listImages_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListImages -> Identity ListImages)
-> Maybe Text -> ListImages -> ListImages
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListImages
ListImagesResponse
rs
          ListImagesResponse
-> Getting (First Text) ListImagesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListImagesResponse -> Const (First Text) ListImagesResponse
Lens' ListImagesResponse (Maybe Text)
listImagesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListImagesResponse -> Const (First Text) ListImagesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListImagesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.NFData ListImages

instance Core.ToHeaders ListImages where
  toHeaders :: ListImages -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListImages -> 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.ListImages" ::
                          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 ListImages where
  toJSON :: ListImages -> Value
toJSON ListImages' {Maybe Natural
Maybe Text
Maybe ListImagesFilter
Text
repositoryName :: Text
maxResults :: Maybe Natural
filter' :: Maybe ListImagesFilter
nextToken :: Maybe Text
registryId :: Maybe Text
$sel:repositoryName:ListImages' :: ListImages -> Text
$sel:maxResults:ListImages' :: ListImages -> Maybe Natural
$sel:filter':ListImages' :: ListImages -> Maybe ListImagesFilter
$sel:nextToken:ListImages' :: ListImages -> Maybe Text
$sel:registryId:ListImages' :: ListImages -> 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
"nextToken" 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
nextToken,
            (Text
"filter" Text -> ListImagesFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ListImagesFilter -> Pair) -> Maybe ListImagesFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ListImagesFilter
filter',
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            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)
          ]
      )

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

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

-- | /See:/ 'newListImagesResponse' smart constructor.
data ListImagesResponse = ListImagesResponse'
  { -- | The list of image IDs for the requested repository.
    ListImagesResponse -> Maybe [ImageIdentifier]
imageIds :: Prelude.Maybe [ImageIdentifier],
    -- | The @nextToken@ value to include in a future @ListImages@ request. When
    -- the results of a @ListImages@ request exceed @maxResults@, this value
    -- can be used to retrieve the next page of results. This value is @null@
    -- when there are no more results to return.
    ListImagesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListImagesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListImagesResponse -> ListImagesResponse -> Bool
(ListImagesResponse -> ListImagesResponse -> Bool)
-> (ListImagesResponse -> ListImagesResponse -> Bool)
-> Eq ListImagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImagesResponse -> ListImagesResponse -> Bool
$c/= :: ListImagesResponse -> ListImagesResponse -> Bool
== :: ListImagesResponse -> ListImagesResponse -> Bool
$c== :: ListImagesResponse -> ListImagesResponse -> Bool
Prelude.Eq, ReadPrec [ListImagesResponse]
ReadPrec ListImagesResponse
Int -> ReadS ListImagesResponse
ReadS [ListImagesResponse]
(Int -> ReadS ListImagesResponse)
-> ReadS [ListImagesResponse]
-> ReadPrec ListImagesResponse
-> ReadPrec [ListImagesResponse]
-> Read ListImagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImagesResponse]
$creadListPrec :: ReadPrec [ListImagesResponse]
readPrec :: ReadPrec ListImagesResponse
$creadPrec :: ReadPrec ListImagesResponse
readList :: ReadS [ListImagesResponse]
$creadList :: ReadS [ListImagesResponse]
readsPrec :: Int -> ReadS ListImagesResponse
$creadsPrec :: Int -> ReadS ListImagesResponse
Prelude.Read, Int -> ListImagesResponse -> ShowS
[ListImagesResponse] -> ShowS
ListImagesResponse -> String
(Int -> ListImagesResponse -> ShowS)
-> (ListImagesResponse -> String)
-> ([ListImagesResponse] -> ShowS)
-> Show ListImagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImagesResponse] -> ShowS
$cshowList :: [ListImagesResponse] -> ShowS
show :: ListImagesResponse -> String
$cshow :: ListImagesResponse -> String
showsPrec :: Int -> ListImagesResponse -> ShowS
$cshowsPrec :: Int -> ListImagesResponse -> ShowS
Prelude.Show, (forall x. ListImagesResponse -> Rep ListImagesResponse x)
-> (forall x. Rep ListImagesResponse x -> ListImagesResponse)
-> Generic ListImagesResponse
forall x. Rep ListImagesResponse x -> ListImagesResponse
forall x. ListImagesResponse -> Rep ListImagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListImagesResponse x -> ListImagesResponse
$cfrom :: forall x. ListImagesResponse -> Rep ListImagesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListImagesResponse' 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:
--
-- 'imageIds', 'listImagesResponse_imageIds' - The list of image IDs for the requested repository.
--
-- 'nextToken', 'listImagesResponse_nextToken' - The @nextToken@ value to include in a future @ListImages@ request. When
-- the results of a @ListImages@ request exceed @maxResults@, this value
-- can be used to retrieve the next page of results. This value is @null@
-- when there are no more results to return.
--
-- 'httpStatus', 'listImagesResponse_httpStatus' - The response's http status code.
newListImagesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListImagesResponse
newListImagesResponse :: Int -> ListImagesResponse
newListImagesResponse Int
pHttpStatus_ =
  ListImagesResponse' :: Maybe [ImageIdentifier] -> Maybe Text -> Int -> ListImagesResponse
ListImagesResponse'
    { $sel:imageIds:ListImagesResponse' :: Maybe [ImageIdentifier]
imageIds = Maybe [ImageIdentifier]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListImagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListImagesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of image IDs for the requested repository.
listImagesResponse_imageIds :: Lens.Lens' ListImagesResponse (Prelude.Maybe [ImageIdentifier])
listImagesResponse_imageIds :: (Maybe [ImageIdentifier] -> f (Maybe [ImageIdentifier]))
-> ListImagesResponse -> f ListImagesResponse
listImagesResponse_imageIds = (ListImagesResponse -> Maybe [ImageIdentifier])
-> (ListImagesResponse
    -> Maybe [ImageIdentifier] -> ListImagesResponse)
-> Lens' ListImagesResponse (Maybe [ImageIdentifier])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImagesResponse' {Maybe [ImageIdentifier]
imageIds :: Maybe [ImageIdentifier]
$sel:imageIds:ListImagesResponse' :: ListImagesResponse -> Maybe [ImageIdentifier]
imageIds} -> Maybe [ImageIdentifier]
imageIds) (\s :: ListImagesResponse
s@ListImagesResponse' {} Maybe [ImageIdentifier]
a -> ListImagesResponse
s {$sel:imageIds:ListImagesResponse' :: Maybe [ImageIdentifier]
imageIds = Maybe [ImageIdentifier]
a} :: ListImagesResponse) ((Maybe [ImageIdentifier] -> f (Maybe [ImageIdentifier]))
 -> ListImagesResponse -> f ListImagesResponse)
-> ((Maybe [ImageIdentifier] -> f (Maybe [ImageIdentifier]))
    -> Maybe [ImageIdentifier] -> f (Maybe [ImageIdentifier]))
-> (Maybe [ImageIdentifier] -> f (Maybe [ImageIdentifier]))
-> ListImagesResponse
-> f ListImagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ImageIdentifier]
  [ImageIdentifier]
  [ImageIdentifier]
  [ImageIdentifier]
-> Iso
     (Maybe [ImageIdentifier])
     (Maybe [ImageIdentifier])
     (Maybe [ImageIdentifier])
     (Maybe [ImageIdentifier])
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
  [ImageIdentifier]
  [ImageIdentifier]
  [ImageIdentifier]
  [ImageIdentifier]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ value to include in a future @ListImages@ request. When
-- the results of a @ListImages@ request exceed @maxResults@, this value
-- can be used to retrieve the next page of results. This value is @null@
-- when there are no more results to return.
listImagesResponse_nextToken :: Lens.Lens' ListImagesResponse (Prelude.Maybe Prelude.Text)
listImagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListImagesResponse -> f ListImagesResponse
listImagesResponse_nextToken = (ListImagesResponse -> Maybe Text)
-> (ListImagesResponse -> Maybe Text -> ListImagesResponse)
-> Lens' ListImagesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImagesResponse' :: ListImagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImagesResponse
s@ListImagesResponse' {} Maybe Text
a -> ListImagesResponse
s {$sel:nextToken:ListImagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListImagesResponse)

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

instance Prelude.NFData ListImagesResponse