{-# 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.CodeArtifact.ListRepositories
-- 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)
--
-- Returns a list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_RepositorySummary.html RepositorySummary>
-- objects. Each @RepositorySummary@ contains information about a
-- repository in the specified AWS account and that matches the input
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.CodeArtifact.ListRepositories
  ( -- * Creating a Request
    ListRepositories (..),
    newListRepositories,

    -- * Request Lenses
    listRepositories_repositoryPrefix,
    listRepositories_nextToken,
    listRepositories_maxResults,

    -- * Destructuring the Response
    ListRepositoriesResponse (..),
    newListRepositoriesResponse,

    -- * Response Lenses
    listRepositoriesResponse_repositories,
    listRepositoriesResponse_nextToken,
    listRepositoriesResponse_httpStatus,
  )
where

import Amazonka.CodeArtifact.Types
import qualified Amazonka.Core as Core
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:/ 'newListRepositories' smart constructor.
data ListRepositories = ListRepositories'
  { -- | A prefix used to filter returned repositories. Only repositories with
    -- names that start with @repositoryPrefix@ are returned.
    ListRepositories -> Maybe Text
repositoryPrefix :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    ListRepositories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per page.
    ListRepositories -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListRepositories -> ListRepositories -> Bool
(ListRepositories -> ListRepositories -> Bool)
-> (ListRepositories -> ListRepositories -> Bool)
-> Eq ListRepositories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRepositories -> ListRepositories -> Bool
$c/= :: ListRepositories -> ListRepositories -> Bool
== :: ListRepositories -> ListRepositories -> Bool
$c== :: ListRepositories -> ListRepositories -> Bool
Prelude.Eq, ReadPrec [ListRepositories]
ReadPrec ListRepositories
Int -> ReadS ListRepositories
ReadS [ListRepositories]
(Int -> ReadS ListRepositories)
-> ReadS [ListRepositories]
-> ReadPrec ListRepositories
-> ReadPrec [ListRepositories]
-> Read ListRepositories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRepositories]
$creadListPrec :: ReadPrec [ListRepositories]
readPrec :: ReadPrec ListRepositories
$creadPrec :: ReadPrec ListRepositories
readList :: ReadS [ListRepositories]
$creadList :: ReadS [ListRepositories]
readsPrec :: Int -> ReadS ListRepositories
$creadsPrec :: Int -> ReadS ListRepositories
Prelude.Read, Int -> ListRepositories -> ShowS
[ListRepositories] -> ShowS
ListRepositories -> String
(Int -> ListRepositories -> ShowS)
-> (ListRepositories -> String)
-> ([ListRepositories] -> ShowS)
-> Show ListRepositories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRepositories] -> ShowS
$cshowList :: [ListRepositories] -> ShowS
show :: ListRepositories -> String
$cshow :: ListRepositories -> String
showsPrec :: Int -> ListRepositories -> ShowS
$cshowsPrec :: Int -> ListRepositories -> ShowS
Prelude.Show, (forall x. ListRepositories -> Rep ListRepositories x)
-> (forall x. Rep ListRepositories x -> ListRepositories)
-> Generic ListRepositories
forall x. Rep ListRepositories x -> ListRepositories
forall x. ListRepositories -> Rep ListRepositories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRepositories x -> ListRepositories
$cfrom :: forall x. ListRepositories -> Rep ListRepositories x
Prelude.Generic)

-- |
-- Create a value of 'ListRepositories' 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:
--
-- 'repositoryPrefix', 'listRepositories_repositoryPrefix' - A prefix used to filter returned repositories. Only repositories with
-- names that start with @repositoryPrefix@ are returned.
--
-- 'nextToken', 'listRepositories_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
--
-- 'maxResults', 'listRepositories_maxResults' - The maximum number of results to return per page.
newListRepositories ::
  ListRepositories
newListRepositories :: ListRepositories
newListRepositories =
  ListRepositories' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListRepositories
ListRepositories'
    { $sel:repositoryPrefix:ListRepositories' :: Maybe Text
repositoryPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRepositories' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRepositories' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A prefix used to filter returned repositories. Only repositories with
-- names that start with @repositoryPrefix@ are returned.
listRepositories_repositoryPrefix :: Lens.Lens' ListRepositories (Prelude.Maybe Prelude.Text)
listRepositories_repositoryPrefix :: (Maybe Text -> f (Maybe Text))
-> ListRepositories -> f ListRepositories
listRepositories_repositoryPrefix = (ListRepositories -> Maybe Text)
-> (ListRepositories -> Maybe Text -> ListRepositories)
-> Lens ListRepositories ListRepositories (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositories' {Maybe Text
repositoryPrefix :: Maybe Text
$sel:repositoryPrefix:ListRepositories' :: ListRepositories -> Maybe Text
repositoryPrefix} -> Maybe Text
repositoryPrefix) (\s :: ListRepositories
s@ListRepositories' {} Maybe Text
a -> ListRepositories
s {$sel:repositoryPrefix:ListRepositories' :: Maybe Text
repositoryPrefix = Maybe Text
a} :: ListRepositories)

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
listRepositories_nextToken :: Lens.Lens' ListRepositories (Prelude.Maybe Prelude.Text)
listRepositories_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRepositories -> f ListRepositories
listRepositories_nextToken = (ListRepositories -> Maybe Text)
-> (ListRepositories -> Maybe Text -> ListRepositories)
-> Lens ListRepositories ListRepositories (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositories' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRepositories' :: ListRepositories -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRepositories
s@ListRepositories' {} Maybe Text
a -> ListRepositories
s {$sel:nextToken:ListRepositories' :: Maybe Text
nextToken = Maybe Text
a} :: ListRepositories)

-- | The maximum number of results to return per page.
listRepositories_maxResults :: Lens.Lens' ListRepositories (Prelude.Maybe Prelude.Natural)
listRepositories_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListRepositories -> f ListRepositories
listRepositories_maxResults = (ListRepositories -> Maybe Natural)
-> (ListRepositories -> Maybe Natural -> ListRepositories)
-> Lens
     ListRepositories ListRepositories (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositories' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRepositories' :: ListRepositories -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRepositories
s@ListRepositories' {} Maybe Natural
a -> ListRepositories
s {$sel:maxResults:ListRepositories' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRepositories)

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

instance Prelude.NFData ListRepositories

instance Core.ToHeaders ListRepositories where
  toHeaders :: ListRepositories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRepositories -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 ListRepositories where
  toJSON :: ListRepositories -> Value
toJSON = Value -> ListRepositories -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

instance Core.ToQuery ListRepositories where
  toQuery :: ListRepositories -> QueryString
toQuery ListRepositories' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
repositoryPrefix :: Maybe Text
$sel:maxResults:ListRepositories' :: ListRepositories -> Maybe Natural
$sel:nextToken:ListRepositories' :: ListRepositories -> Maybe Text
$sel:repositoryPrefix:ListRepositories' :: ListRepositories -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"repository-prefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
repositoryPrefix,
        ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListRepositoriesResponse' smart constructor.
data ListRepositoriesResponse = ListRepositoriesResponse'
  { -- | The returned list of
    -- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_RepositorySummary.html RepositorySummary>
    -- objects.
    ListRepositoriesResponse -> Maybe [RepositorySummary]
repositories :: Prelude.Maybe [RepositorySummary],
    -- | If there are additional results, this is the token for the next set of
    -- results.
    ListRepositoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRepositoriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRepositoriesResponse -> ListRepositoriesResponse -> Bool
(ListRepositoriesResponse -> ListRepositoriesResponse -> Bool)
-> (ListRepositoriesResponse -> ListRepositoriesResponse -> Bool)
-> Eq ListRepositoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRepositoriesResponse -> ListRepositoriesResponse -> Bool
$c/= :: ListRepositoriesResponse -> ListRepositoriesResponse -> Bool
== :: ListRepositoriesResponse -> ListRepositoriesResponse -> Bool
$c== :: ListRepositoriesResponse -> ListRepositoriesResponse -> Bool
Prelude.Eq, ReadPrec [ListRepositoriesResponse]
ReadPrec ListRepositoriesResponse
Int -> ReadS ListRepositoriesResponse
ReadS [ListRepositoriesResponse]
(Int -> ReadS ListRepositoriesResponse)
-> ReadS [ListRepositoriesResponse]
-> ReadPrec ListRepositoriesResponse
-> ReadPrec [ListRepositoriesResponse]
-> Read ListRepositoriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRepositoriesResponse]
$creadListPrec :: ReadPrec [ListRepositoriesResponse]
readPrec :: ReadPrec ListRepositoriesResponse
$creadPrec :: ReadPrec ListRepositoriesResponse
readList :: ReadS [ListRepositoriesResponse]
$creadList :: ReadS [ListRepositoriesResponse]
readsPrec :: Int -> ReadS ListRepositoriesResponse
$creadsPrec :: Int -> ReadS ListRepositoriesResponse
Prelude.Read, Int -> ListRepositoriesResponse -> ShowS
[ListRepositoriesResponse] -> ShowS
ListRepositoriesResponse -> String
(Int -> ListRepositoriesResponse -> ShowS)
-> (ListRepositoriesResponse -> String)
-> ([ListRepositoriesResponse] -> ShowS)
-> Show ListRepositoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRepositoriesResponse] -> ShowS
$cshowList :: [ListRepositoriesResponse] -> ShowS
show :: ListRepositoriesResponse -> String
$cshow :: ListRepositoriesResponse -> String
showsPrec :: Int -> ListRepositoriesResponse -> ShowS
$cshowsPrec :: Int -> ListRepositoriesResponse -> ShowS
Prelude.Show, (forall x.
 ListRepositoriesResponse -> Rep ListRepositoriesResponse x)
-> (forall x.
    Rep ListRepositoriesResponse x -> ListRepositoriesResponse)
-> Generic ListRepositoriesResponse
forall x.
Rep ListRepositoriesResponse x -> ListRepositoriesResponse
forall x.
ListRepositoriesResponse -> Rep ListRepositoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRepositoriesResponse x -> ListRepositoriesResponse
$cfrom :: forall x.
ListRepositoriesResponse -> Rep ListRepositoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRepositoriesResponse' 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', 'listRepositoriesResponse_repositories' - The returned list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_RepositorySummary.html RepositorySummary>
-- objects.
--
-- 'nextToken', 'listRepositoriesResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'httpStatus', 'listRepositoriesResponse_httpStatus' - The response's http status code.
newListRepositoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRepositoriesResponse
newListRepositoriesResponse :: Int -> ListRepositoriesResponse
newListRepositoriesResponse Int
pHttpStatus_ =
  ListRepositoriesResponse' :: Maybe [RepositorySummary]
-> Maybe Text -> Int -> ListRepositoriesResponse
ListRepositoriesResponse'
    { $sel:repositories:ListRepositoriesResponse' :: Maybe [RepositorySummary]
repositories =
        Maybe [RepositorySummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRepositoriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRepositoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The returned list of
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_RepositorySummary.html RepositorySummary>
-- objects.
listRepositoriesResponse_repositories :: Lens.Lens' ListRepositoriesResponse (Prelude.Maybe [RepositorySummary])
listRepositoriesResponse_repositories :: (Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> ListRepositoriesResponse -> f ListRepositoriesResponse
listRepositoriesResponse_repositories = (ListRepositoriesResponse -> Maybe [RepositorySummary])
-> (ListRepositoriesResponse
    -> Maybe [RepositorySummary] -> ListRepositoriesResponse)
-> Lens' ListRepositoriesResponse (Maybe [RepositorySummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesResponse' {Maybe [RepositorySummary]
repositories :: Maybe [RepositorySummary]
$sel:repositories:ListRepositoriesResponse' :: ListRepositoriesResponse -> Maybe [RepositorySummary]
repositories} -> Maybe [RepositorySummary]
repositories) (\s :: ListRepositoriesResponse
s@ListRepositoriesResponse' {} Maybe [RepositorySummary]
a -> ListRepositoriesResponse
s {$sel:repositories:ListRepositoriesResponse' :: Maybe [RepositorySummary]
repositories = Maybe [RepositorySummary]
a} :: ListRepositoriesResponse) ((Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
 -> ListRepositoriesResponse -> f ListRepositoriesResponse)
-> ((Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
    -> Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> (Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> ListRepositoriesResponse
-> f ListRepositoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RepositorySummary]
  [RepositorySummary]
  [RepositorySummary]
  [RepositorySummary]
-> Iso
     (Maybe [RepositorySummary])
     (Maybe [RepositorySummary])
     (Maybe [RepositorySummary])
     (Maybe [RepositorySummary])
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
  [RepositorySummary]
  [RepositorySummary]
  [RepositorySummary]
  [RepositorySummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If there are additional results, this is the token for the next set of
-- results.
listRepositoriesResponse_nextToken :: Lens.Lens' ListRepositoriesResponse (Prelude.Maybe Prelude.Text)
listRepositoriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRepositoriesResponse -> f ListRepositoriesResponse
listRepositoriesResponse_nextToken = (ListRepositoriesResponse -> Maybe Text)
-> (ListRepositoriesResponse
    -> Maybe Text -> ListRepositoriesResponse)
-> Lens' ListRepositoriesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRepositoriesResponse' :: ListRepositoriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRepositoriesResponse
s@ListRepositoriesResponse' {} Maybe Text
a -> ListRepositoriesResponse
s {$sel:nextToken:ListRepositoriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRepositoriesResponse)

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

instance Prelude.NFData ListRepositoriesResponse