{-# 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.ECRPublic.DescribeRepositories
-- 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)
--
-- Describes repositories in a public registry.
--
-- This operation returns paginated results.
module Amazonka.ECRPublic.DescribeRepositories
  ( -- * Creating a Request
    DescribeRepositories (..),
    newDescribeRepositories,

    -- * Request Lenses
    describeRepositories_registryId,
    describeRepositories_repositoryNames,
    describeRepositories_nextToken,
    describeRepositories_maxResults,

    -- * Destructuring the Response
    DescribeRepositoriesResponse (..),
    newDescribeRepositoriesResponse,

    -- * Response Lenses
    describeRepositoriesResponse_repositories,
    describeRepositoriesResponse_nextToken,
    describeRepositoriesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECRPublic.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:/ 'newDescribeRepositories' smart constructor.
data DescribeRepositories = DescribeRepositories'
  { -- | The AWS account ID associated with the registry that contains the
    -- repositories to be described. If you do not specify a registry, the
    -- default public registry is assumed.
    DescribeRepositories -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | A list of repositories to describe. If this parameter is omitted, then
    -- all repositories in a registry are described.
    DescribeRepositories -> Maybe (NonEmpty Text)
repositoryNames :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The @nextToken@ value returned from a previous paginated
    -- @DescribeRepositories@ 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
    -- option cannot be used when you specify repositories with
    -- @repositoryNames@.
    --
    -- 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.
    DescribeRepositories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of repository results returned by
    -- @DescribeRepositories@ in paginated output. When this parameter is used,
    -- @DescribeRepositories@ 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
    -- @DescribeRepositories@ request with the returned @nextToken@ value. This
    -- value can be between 1 and 1000. If this parameter is not used, then
    -- @DescribeRepositories@ returns up to 100 results and a @nextToken@
    -- value, if applicable. This option cannot be used when you specify
    -- repositories with @repositoryNames@.
    DescribeRepositories -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeRepositories -> DescribeRepositories -> Bool
(DescribeRepositories -> DescribeRepositories -> Bool)
-> (DescribeRepositories -> DescribeRepositories -> Bool)
-> Eq DescribeRepositories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRepositories -> DescribeRepositories -> Bool
$c/= :: DescribeRepositories -> DescribeRepositories -> Bool
== :: DescribeRepositories -> DescribeRepositories -> Bool
$c== :: DescribeRepositories -> DescribeRepositories -> Bool
Prelude.Eq, ReadPrec [DescribeRepositories]
ReadPrec DescribeRepositories
Int -> ReadS DescribeRepositories
ReadS [DescribeRepositories]
(Int -> ReadS DescribeRepositories)
-> ReadS [DescribeRepositories]
-> ReadPrec DescribeRepositories
-> ReadPrec [DescribeRepositories]
-> Read DescribeRepositories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRepositories]
$creadListPrec :: ReadPrec [DescribeRepositories]
readPrec :: ReadPrec DescribeRepositories
$creadPrec :: ReadPrec DescribeRepositories
readList :: ReadS [DescribeRepositories]
$creadList :: ReadS [DescribeRepositories]
readsPrec :: Int -> ReadS DescribeRepositories
$creadsPrec :: Int -> ReadS DescribeRepositories
Prelude.Read, Int -> DescribeRepositories -> ShowS
[DescribeRepositories] -> ShowS
DescribeRepositories -> String
(Int -> DescribeRepositories -> ShowS)
-> (DescribeRepositories -> String)
-> ([DescribeRepositories] -> ShowS)
-> Show DescribeRepositories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRepositories] -> ShowS
$cshowList :: [DescribeRepositories] -> ShowS
show :: DescribeRepositories -> String
$cshow :: DescribeRepositories -> String
showsPrec :: Int -> DescribeRepositories -> ShowS
$cshowsPrec :: Int -> DescribeRepositories -> ShowS
Prelude.Show, (forall x. DescribeRepositories -> Rep DescribeRepositories x)
-> (forall x. Rep DescribeRepositories x -> DescribeRepositories)
-> Generic DescribeRepositories
forall x. Rep DescribeRepositories x -> DescribeRepositories
forall x. DescribeRepositories -> Rep DescribeRepositories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRepositories x -> DescribeRepositories
$cfrom :: forall x. DescribeRepositories -> Rep DescribeRepositories x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRepositories' 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', 'describeRepositories_registryId' - The AWS account ID associated with the registry that contains the
-- repositories to be described. If you do not specify a registry, the
-- default public registry is assumed.
--
-- 'repositoryNames', 'describeRepositories_repositoryNames' - A list of repositories to describe. If this parameter is omitted, then
-- all repositories in a registry are described.
--
-- 'nextToken', 'describeRepositories_nextToken' - The @nextToken@ value returned from a previous paginated
-- @DescribeRepositories@ 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
-- option cannot be used when you specify repositories with
-- @repositoryNames@.
--
-- 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.
--
-- 'maxResults', 'describeRepositories_maxResults' - The maximum number of repository results returned by
-- @DescribeRepositories@ in paginated output. When this parameter is used,
-- @DescribeRepositories@ 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
-- @DescribeRepositories@ request with the returned @nextToken@ value. This
-- value can be between 1 and 1000. If this parameter is not used, then
-- @DescribeRepositories@ returns up to 100 results and a @nextToken@
-- value, if applicable. This option cannot be used when you specify
-- repositories with @repositoryNames@.
newDescribeRepositories ::
  DescribeRepositories
newDescribeRepositories :: DescribeRepositories
newDescribeRepositories =
  DescribeRepositories' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Natural
-> DescribeRepositories
DescribeRepositories'
    { $sel:registryId:DescribeRepositories' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryNames:DescribeRepositories' :: Maybe (NonEmpty Text)
repositoryNames = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeRepositories' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeRepositories' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The AWS account ID associated with the registry that contains the
-- repositories to be described. If you do not specify a registry, the
-- default public registry is assumed.
describeRepositories_registryId :: Lens.Lens' DescribeRepositories (Prelude.Maybe Prelude.Text)
describeRepositories_registryId :: (Maybe Text -> f (Maybe Text))
-> DescribeRepositories -> f DescribeRepositories
describeRepositories_registryId = (DescribeRepositories -> Maybe Text)
-> (DescribeRepositories -> Maybe Text -> DescribeRepositories)
-> Lens
     DescribeRepositories DescribeRepositories (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositories' {Maybe Text
registryId :: Maybe Text
$sel:registryId:DescribeRepositories' :: DescribeRepositories -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: DescribeRepositories
s@DescribeRepositories' {} Maybe Text
a -> DescribeRepositories
s {$sel:registryId:DescribeRepositories' :: Maybe Text
registryId = Maybe Text
a} :: DescribeRepositories)

-- | A list of repositories to describe. If this parameter is omitted, then
-- all repositories in a registry are described.
describeRepositories_repositoryNames :: Lens.Lens' DescribeRepositories (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeRepositories_repositoryNames :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeRepositories -> f DescribeRepositories
describeRepositories_repositoryNames = (DescribeRepositories -> Maybe (NonEmpty Text))
-> (DescribeRepositories
    -> Maybe (NonEmpty Text) -> DescribeRepositories)
-> Lens
     DescribeRepositories
     DescribeRepositories
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositories' {Maybe (NonEmpty Text)
repositoryNames :: Maybe (NonEmpty Text)
$sel:repositoryNames:DescribeRepositories' :: DescribeRepositories -> Maybe (NonEmpty Text)
repositoryNames} -> Maybe (NonEmpty Text)
repositoryNames) (\s :: DescribeRepositories
s@DescribeRepositories' {} Maybe (NonEmpty Text)
a -> DescribeRepositories
s {$sel:repositoryNames:DescribeRepositories' :: Maybe (NonEmpty Text)
repositoryNames = Maybe (NonEmpty Text)
a} :: DescribeRepositories) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeRepositories -> f DescribeRepositories)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeRepositories
-> f DescribeRepositories
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 @nextToken@ value returned from a previous paginated
-- @DescribeRepositories@ 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
-- option cannot be used when you specify repositories with
-- @repositoryNames@.
--
-- 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.
describeRepositories_nextToken :: Lens.Lens' DescribeRepositories (Prelude.Maybe Prelude.Text)
describeRepositories_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRepositories -> f DescribeRepositories
describeRepositories_nextToken = (DescribeRepositories -> Maybe Text)
-> (DescribeRepositories -> Maybe Text -> DescribeRepositories)
-> Lens
     DescribeRepositories DescribeRepositories (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositories' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRepositories' :: DescribeRepositories -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRepositories
s@DescribeRepositories' {} Maybe Text
a -> DescribeRepositories
s {$sel:nextToken:DescribeRepositories' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRepositories)

-- | The maximum number of repository results returned by
-- @DescribeRepositories@ in paginated output. When this parameter is used,
-- @DescribeRepositories@ 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
-- @DescribeRepositories@ request with the returned @nextToken@ value. This
-- value can be between 1 and 1000. If this parameter is not used, then
-- @DescribeRepositories@ returns up to 100 results and a @nextToken@
-- value, if applicable. This option cannot be used when you specify
-- repositories with @repositoryNames@.
describeRepositories_maxResults :: Lens.Lens' DescribeRepositories (Prelude.Maybe Prelude.Natural)
describeRepositories_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeRepositories -> f DescribeRepositories
describeRepositories_maxResults = (DescribeRepositories -> Maybe Natural)
-> (DescribeRepositories -> Maybe Natural -> DescribeRepositories)
-> Lens
     DescribeRepositories
     DescribeRepositories
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositories' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeRepositories' :: DescribeRepositories -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeRepositories
s@DescribeRepositories' {} Maybe Natural
a -> DescribeRepositories
s {$sel:maxResults:DescribeRepositories' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeRepositories)

instance Core.AWSPager DescribeRepositories where
  page :: DescribeRepositories
-> AWSResponse DescribeRepositories -> Maybe DescribeRepositories
page DescribeRepositories
rq AWSResponse DescribeRepositories
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeRepositories
DescribeRepositoriesResponse
rs
            DescribeRepositoriesResponse
-> Getting (First Text) DescribeRepositoriesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeRepositoriesResponse
-> Const (First Text) DescribeRepositoriesResponse
Lens' DescribeRepositoriesResponse (Maybe Text)
describeRepositoriesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeRepositoriesResponse
 -> Const (First Text) DescribeRepositoriesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeRepositoriesResponse 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 DescribeRepositories
forall a. Maybe a
Prelude.Nothing
    | Maybe [Repository] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeRepositories
DescribeRepositoriesResponse
rs
            DescribeRepositoriesResponse
-> Getting
     (First [Repository]) DescribeRepositoriesResponse [Repository]
-> Maybe [Repository]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Repository]
 -> Const (First [Repository]) (Maybe [Repository]))
-> DescribeRepositoriesResponse
-> Const (First [Repository]) DescribeRepositoriesResponse
Lens' DescribeRepositoriesResponse (Maybe [Repository])
describeRepositoriesResponse_repositories
              ((Maybe [Repository]
  -> Const (First [Repository]) (Maybe [Repository]))
 -> DescribeRepositoriesResponse
 -> Const (First [Repository]) DescribeRepositoriesResponse)
-> (([Repository] -> Const (First [Repository]) [Repository])
    -> Maybe [Repository]
    -> Const (First [Repository]) (Maybe [Repository]))
-> Getting
     (First [Repository]) DescribeRepositoriesResponse [Repository]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Repository] -> Const (First [Repository]) [Repository])
-> Maybe [Repository]
-> Const (First [Repository]) (Maybe [Repository])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeRepositories
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeRepositories -> Maybe DescribeRepositories
forall a. a -> Maybe a
Prelude.Just (DescribeRepositories -> Maybe DescribeRepositories)
-> DescribeRepositories -> Maybe DescribeRepositories
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeRepositories
rq
          DescribeRepositories
-> (DescribeRepositories -> DescribeRepositories)
-> DescribeRepositories
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeRepositories -> Identity DescribeRepositories
Lens
  DescribeRepositories DescribeRepositories (Maybe Text) (Maybe Text)
describeRepositories_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeRepositories -> Identity DescribeRepositories)
-> Maybe Text -> DescribeRepositories -> DescribeRepositories
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeRepositories
DescribeRepositoriesResponse
rs
          DescribeRepositoriesResponse
-> Getting (First Text) DescribeRepositoriesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeRepositoriesResponse
-> Const (First Text) DescribeRepositoriesResponse
Lens' DescribeRepositoriesResponse (Maybe Text)
describeRepositoriesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeRepositoriesResponse
 -> Const (First Text) DescribeRepositoriesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeRepositoriesResponse 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 DescribeRepositories where
  type
    AWSResponse DescribeRepositories =
      DescribeRepositoriesResponse
  request :: DescribeRepositories -> Request DescribeRepositories
request = Service -> DescribeRepositories -> Request DescribeRepositories
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeRepositories
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRepositories)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeRepositories))
-> Logger
-> Service
-> Proxy DescribeRepositories
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRepositories)))
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 [Repository]
-> Maybe Text -> Int -> DescribeRepositoriesResponse
DescribeRepositoriesResponse'
            (Maybe [Repository]
 -> Maybe Text -> Int -> DescribeRepositoriesResponse)
-> Either String (Maybe [Repository])
-> Either
     String (Maybe Text -> Int -> DescribeRepositoriesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Repository]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repositories" Either String (Maybe (Maybe [Repository]))
-> Maybe [Repository] -> Either String (Maybe [Repository])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Repository]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> DescribeRepositoriesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeRepositoriesResponse)
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 -> DescribeRepositoriesResponse)
-> Either String Int -> Either String DescribeRepositoriesResponse
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 DescribeRepositories

instance Prelude.NFData DescribeRepositories

instance Core.ToHeaders DescribeRepositories where
  toHeaders :: DescribeRepositories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeRepositories -> 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
"SpencerFrontendService.DescribeRepositories" ::
                          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 DescribeRepositories where
  toJSON :: DescribeRepositories -> Value
toJSON DescribeRepositories' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
repositoryNames :: Maybe (NonEmpty Text)
registryId :: Maybe Text
$sel:maxResults:DescribeRepositories' :: DescribeRepositories -> Maybe Natural
$sel:nextToken:DescribeRepositories' :: DescribeRepositories -> Maybe Text
$sel:repositoryNames:DescribeRepositories' :: DescribeRepositories -> Maybe (NonEmpty Text)
$sel:registryId:DescribeRepositories' :: DescribeRepositories -> 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
"repositoryNames" 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)
repositoryNames,
            (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
"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
          ]
      )

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

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

-- | /See:/ 'newDescribeRepositoriesResponse' smart constructor.
data DescribeRepositoriesResponse = DescribeRepositoriesResponse'
  { -- | A list of repository objects corresponding to valid repositories.
    DescribeRepositoriesResponse -> Maybe [Repository]
repositories :: Prelude.Maybe [Repository],
    -- | The @nextToken@ value to include in a future @DescribeRepositories@
    -- request. When the results of a @DescribeRepositories@ 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.
    DescribeRepositoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeRepositoriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeRepositoriesResponse
-> DescribeRepositoriesResponse -> Bool
(DescribeRepositoriesResponse
 -> DescribeRepositoriesResponse -> Bool)
-> (DescribeRepositoriesResponse
    -> DescribeRepositoriesResponse -> Bool)
-> Eq DescribeRepositoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRepositoriesResponse
-> DescribeRepositoriesResponse -> Bool
$c/= :: DescribeRepositoriesResponse
-> DescribeRepositoriesResponse -> Bool
== :: DescribeRepositoriesResponse
-> DescribeRepositoriesResponse -> Bool
$c== :: DescribeRepositoriesResponse
-> DescribeRepositoriesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRepositoriesResponse]
ReadPrec DescribeRepositoriesResponse
Int -> ReadS DescribeRepositoriesResponse
ReadS [DescribeRepositoriesResponse]
(Int -> ReadS DescribeRepositoriesResponse)
-> ReadS [DescribeRepositoriesResponse]
-> ReadPrec DescribeRepositoriesResponse
-> ReadPrec [DescribeRepositoriesResponse]
-> Read DescribeRepositoriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRepositoriesResponse]
$creadListPrec :: ReadPrec [DescribeRepositoriesResponse]
readPrec :: ReadPrec DescribeRepositoriesResponse
$creadPrec :: ReadPrec DescribeRepositoriesResponse
readList :: ReadS [DescribeRepositoriesResponse]
$creadList :: ReadS [DescribeRepositoriesResponse]
readsPrec :: Int -> ReadS DescribeRepositoriesResponse
$creadsPrec :: Int -> ReadS DescribeRepositoriesResponse
Prelude.Read, Int -> DescribeRepositoriesResponse -> ShowS
[DescribeRepositoriesResponse] -> ShowS
DescribeRepositoriesResponse -> String
(Int -> DescribeRepositoriesResponse -> ShowS)
-> (DescribeRepositoriesResponse -> String)
-> ([DescribeRepositoriesResponse] -> ShowS)
-> Show DescribeRepositoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRepositoriesResponse] -> ShowS
$cshowList :: [DescribeRepositoriesResponse] -> ShowS
show :: DescribeRepositoriesResponse -> String
$cshow :: DescribeRepositoriesResponse -> String
showsPrec :: Int -> DescribeRepositoriesResponse -> ShowS
$cshowsPrec :: Int -> DescribeRepositoriesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeRepositoriesResponse -> Rep DescribeRepositoriesResponse x)
-> (forall x.
    Rep DescribeRepositoriesResponse x -> DescribeRepositoriesResponse)
-> Generic DescribeRepositoriesResponse
forall x.
Rep DescribeRepositoriesResponse x -> DescribeRepositoriesResponse
forall x.
DescribeRepositoriesResponse -> Rep DescribeRepositoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRepositoriesResponse x -> DescribeRepositoriesResponse
$cfrom :: forall x.
DescribeRepositoriesResponse -> Rep DescribeRepositoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRepositoriesResponse' 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:
--
-- 'repositories', 'describeRepositoriesResponse_repositories' - A list of repository objects corresponding to valid repositories.
--
-- 'nextToken', 'describeRepositoriesResponse_nextToken' - The @nextToken@ value to include in a future @DescribeRepositories@
-- request. When the results of a @DescribeRepositories@ 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', 'describeRepositoriesResponse_httpStatus' - The response's http status code.
newDescribeRepositoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeRepositoriesResponse
newDescribeRepositoriesResponse :: Int -> DescribeRepositoriesResponse
newDescribeRepositoriesResponse Int
pHttpStatus_ =
  DescribeRepositoriesResponse' :: Maybe [Repository]
-> Maybe Text -> Int -> DescribeRepositoriesResponse
DescribeRepositoriesResponse'
    { $sel:repositories:DescribeRepositoriesResponse' :: Maybe [Repository]
repositories =
        Maybe [Repository]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeRepositoriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeRepositoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of repository objects corresponding to valid repositories.
describeRepositoriesResponse_repositories :: Lens.Lens' DescribeRepositoriesResponse (Prelude.Maybe [Repository])
describeRepositoriesResponse_repositories :: (Maybe [Repository] -> f (Maybe [Repository]))
-> DescribeRepositoriesResponse -> f DescribeRepositoriesResponse
describeRepositoriesResponse_repositories = (DescribeRepositoriesResponse -> Maybe [Repository])
-> (DescribeRepositoriesResponse
    -> Maybe [Repository] -> DescribeRepositoriesResponse)
-> Lens' DescribeRepositoriesResponse (Maybe [Repository])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositoriesResponse' {Maybe [Repository]
repositories :: Maybe [Repository]
$sel:repositories:DescribeRepositoriesResponse' :: DescribeRepositoriesResponse -> Maybe [Repository]
repositories} -> Maybe [Repository]
repositories) (\s :: DescribeRepositoriesResponse
s@DescribeRepositoriesResponse' {} Maybe [Repository]
a -> DescribeRepositoriesResponse
s {$sel:repositories:DescribeRepositoriesResponse' :: Maybe [Repository]
repositories = Maybe [Repository]
a} :: DescribeRepositoriesResponse) ((Maybe [Repository] -> f (Maybe [Repository]))
 -> DescribeRepositoriesResponse -> f DescribeRepositoriesResponse)
-> ((Maybe [Repository] -> f (Maybe [Repository]))
    -> Maybe [Repository] -> f (Maybe [Repository]))
-> (Maybe [Repository] -> f (Maybe [Repository]))
-> DescribeRepositoriesResponse
-> f DescribeRepositoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Repository] [Repository] [Repository] [Repository]
-> Iso
     (Maybe [Repository])
     (Maybe [Repository])
     (Maybe [Repository])
     (Maybe [Repository])
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 [Repository] [Repository] [Repository] [Repository]
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 @DescribeRepositories@
-- request. When the results of a @DescribeRepositories@ 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.
describeRepositoriesResponse_nextToken :: Lens.Lens' DescribeRepositoriesResponse (Prelude.Maybe Prelude.Text)
describeRepositoriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeRepositoriesResponse -> f DescribeRepositoriesResponse
describeRepositoriesResponse_nextToken = (DescribeRepositoriesResponse -> Maybe Text)
-> (DescribeRepositoriesResponse
    -> Maybe Text -> DescribeRepositoriesResponse)
-> Lens' DescribeRepositoriesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositoriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRepositoriesResponse' :: DescribeRepositoriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRepositoriesResponse
s@DescribeRepositoriesResponse' {} Maybe Text
a -> DescribeRepositoriesResponse
s {$sel:nextToken:DescribeRepositoriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRepositoriesResponse)

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

instance Prelude.NFData DescribeRepositoriesResponse