{-# 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.ListRepositoriesInDomain
-- 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 domain and that matches the input
-- parameters.
--
-- This operation returns paginated results.
module Amazonka.CodeArtifact.ListRepositoriesInDomain
  ( -- * Creating a Request
    ListRepositoriesInDomain (..),
    newListRepositoriesInDomain,

    -- * Request Lenses
    listRepositoriesInDomain_repositoryPrefix,
    listRepositoriesInDomain_domainOwner,
    listRepositoriesInDomain_nextToken,
    listRepositoriesInDomain_administratorAccount,
    listRepositoriesInDomain_maxResults,
    listRepositoriesInDomain_domain,

    -- * Destructuring the Response
    ListRepositoriesInDomainResponse (..),
    newListRepositoriesInDomainResponse,

    -- * Response Lenses
    listRepositoriesInDomainResponse_repositories,
    listRepositoriesInDomainResponse_nextToken,
    listRepositoriesInDomainResponse_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:/ 'newListRepositoriesInDomain' smart constructor.
data ListRepositoriesInDomain = ListRepositoriesInDomain'
  { -- | A prefix used to filter returned repositories. Only repositories with
    -- names that start with @repositoryPrefix@ are returned.
    ListRepositoriesInDomain -> Maybe Text
repositoryPrefix :: Prelude.Maybe Prelude.Text,
    -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    ListRepositoriesInDomain -> Maybe Text
domainOwner :: 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.
    ListRepositoriesInDomain -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Filter the list of repositories to only include those that are managed
    -- by the AWS account ID.
    ListRepositoriesInDomain -> Maybe Text
administratorAccount :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return per page.
    ListRepositoriesInDomain -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the domain that contains the returned list of repositories.
    ListRepositoriesInDomain -> Text
domain :: Prelude.Text
  }
  deriving (ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool
(ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool)
-> (ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool)
-> Eq ListRepositoriesInDomain
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool
$c/= :: ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool
== :: ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool
$c== :: ListRepositoriesInDomain -> ListRepositoriesInDomain -> Bool
Prelude.Eq, ReadPrec [ListRepositoriesInDomain]
ReadPrec ListRepositoriesInDomain
Int -> ReadS ListRepositoriesInDomain
ReadS [ListRepositoriesInDomain]
(Int -> ReadS ListRepositoriesInDomain)
-> ReadS [ListRepositoriesInDomain]
-> ReadPrec ListRepositoriesInDomain
-> ReadPrec [ListRepositoriesInDomain]
-> Read ListRepositoriesInDomain
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRepositoriesInDomain]
$creadListPrec :: ReadPrec [ListRepositoriesInDomain]
readPrec :: ReadPrec ListRepositoriesInDomain
$creadPrec :: ReadPrec ListRepositoriesInDomain
readList :: ReadS [ListRepositoriesInDomain]
$creadList :: ReadS [ListRepositoriesInDomain]
readsPrec :: Int -> ReadS ListRepositoriesInDomain
$creadsPrec :: Int -> ReadS ListRepositoriesInDomain
Prelude.Read, Int -> ListRepositoriesInDomain -> ShowS
[ListRepositoriesInDomain] -> ShowS
ListRepositoriesInDomain -> String
(Int -> ListRepositoriesInDomain -> ShowS)
-> (ListRepositoriesInDomain -> String)
-> ([ListRepositoriesInDomain] -> ShowS)
-> Show ListRepositoriesInDomain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRepositoriesInDomain] -> ShowS
$cshowList :: [ListRepositoriesInDomain] -> ShowS
show :: ListRepositoriesInDomain -> String
$cshow :: ListRepositoriesInDomain -> String
showsPrec :: Int -> ListRepositoriesInDomain -> ShowS
$cshowsPrec :: Int -> ListRepositoriesInDomain -> ShowS
Prelude.Show, (forall x.
 ListRepositoriesInDomain -> Rep ListRepositoriesInDomain x)
-> (forall x.
    Rep ListRepositoriesInDomain x -> ListRepositoriesInDomain)
-> Generic ListRepositoriesInDomain
forall x.
Rep ListRepositoriesInDomain x -> ListRepositoriesInDomain
forall x.
ListRepositoriesInDomain -> Rep ListRepositoriesInDomain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRepositoriesInDomain x -> ListRepositoriesInDomain
$cfrom :: forall x.
ListRepositoriesInDomain -> Rep ListRepositoriesInDomain x
Prelude.Generic)

-- |
-- Create a value of 'ListRepositoriesInDomain' 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', 'listRepositoriesInDomain_repositoryPrefix' - A prefix used to filter returned repositories. Only repositories with
-- names that start with @repositoryPrefix@ are returned.
--
-- 'domainOwner', 'listRepositoriesInDomain_domainOwner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'nextToken', 'listRepositoriesInDomain_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.
--
-- 'administratorAccount', 'listRepositoriesInDomain_administratorAccount' - Filter the list of repositories to only include those that are managed
-- by the AWS account ID.
--
-- 'maxResults', 'listRepositoriesInDomain_maxResults' - The maximum number of results to return per page.
--
-- 'domain', 'listRepositoriesInDomain_domain' - The name of the domain that contains the returned list of repositories.
newListRepositoriesInDomain ::
  -- | 'domain'
  Prelude.Text ->
  ListRepositoriesInDomain
newListRepositoriesInDomain :: Text -> ListRepositoriesInDomain
newListRepositoriesInDomain Text
pDomain_ =
  ListRepositoriesInDomain' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> ListRepositoriesInDomain
ListRepositoriesInDomain'
    { $sel:repositoryPrefix:ListRepositoriesInDomain' :: Maybe Text
repositoryPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainOwner:ListRepositoriesInDomain' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRepositoriesInDomain' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:administratorAccount:ListRepositoriesInDomain' :: Maybe Text
administratorAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRepositoriesInDomain' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:ListRepositoriesInDomain' :: Text
domain = Text
pDomain_
    }

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

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
listRepositoriesInDomain_domainOwner :: Lens.Lens' ListRepositoriesInDomain (Prelude.Maybe Prelude.Text)
listRepositoriesInDomain_domainOwner :: (Maybe Text -> f (Maybe Text))
-> ListRepositoriesInDomain -> f ListRepositoriesInDomain
listRepositoriesInDomain_domainOwner = (ListRepositoriesInDomain -> Maybe Text)
-> (ListRepositoriesInDomain
    -> Maybe Text -> ListRepositoriesInDomain)
-> Lens
     ListRepositoriesInDomain
     ListRepositoriesInDomain
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomain' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: ListRepositoriesInDomain
s@ListRepositoriesInDomain' {} Maybe Text
a -> ListRepositoriesInDomain
s {$sel:domainOwner:ListRepositoriesInDomain' :: Maybe Text
domainOwner = Maybe Text
a} :: ListRepositoriesInDomain)

-- | 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.
listRepositoriesInDomain_nextToken :: Lens.Lens' ListRepositoriesInDomain (Prelude.Maybe Prelude.Text)
listRepositoriesInDomain_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRepositoriesInDomain -> f ListRepositoriesInDomain
listRepositoriesInDomain_nextToken = (ListRepositoriesInDomain -> Maybe Text)
-> (ListRepositoriesInDomain
    -> Maybe Text -> ListRepositoriesInDomain)
-> Lens
     ListRepositoriesInDomain
     ListRepositoriesInDomain
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomain' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRepositoriesInDomain
s@ListRepositoriesInDomain' {} Maybe Text
a -> ListRepositoriesInDomain
s {$sel:nextToken:ListRepositoriesInDomain' :: Maybe Text
nextToken = Maybe Text
a} :: ListRepositoriesInDomain)

-- | Filter the list of repositories to only include those that are managed
-- by the AWS account ID.
listRepositoriesInDomain_administratorAccount :: Lens.Lens' ListRepositoriesInDomain (Prelude.Maybe Prelude.Text)
listRepositoriesInDomain_administratorAccount :: (Maybe Text -> f (Maybe Text))
-> ListRepositoriesInDomain -> f ListRepositoriesInDomain
listRepositoriesInDomain_administratorAccount = (ListRepositoriesInDomain -> Maybe Text)
-> (ListRepositoriesInDomain
    -> Maybe Text -> ListRepositoriesInDomain)
-> Lens
     ListRepositoriesInDomain
     ListRepositoriesInDomain
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomain' {Maybe Text
administratorAccount :: Maybe Text
$sel:administratorAccount:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
administratorAccount} -> Maybe Text
administratorAccount) (\s :: ListRepositoriesInDomain
s@ListRepositoriesInDomain' {} Maybe Text
a -> ListRepositoriesInDomain
s {$sel:administratorAccount:ListRepositoriesInDomain' :: Maybe Text
administratorAccount = Maybe Text
a} :: ListRepositoriesInDomain)

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

-- | The name of the domain that contains the returned list of repositories.
listRepositoriesInDomain_domain :: Lens.Lens' ListRepositoriesInDomain Prelude.Text
listRepositoriesInDomain_domain :: (Text -> f Text)
-> ListRepositoriesInDomain -> f ListRepositoriesInDomain
listRepositoriesInDomain_domain = (ListRepositoriesInDomain -> Text)
-> (ListRepositoriesInDomain -> Text -> ListRepositoriesInDomain)
-> Lens ListRepositoriesInDomain ListRepositoriesInDomain Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomain' {Text
domain :: Text
$sel:domain:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Text
domain} -> Text
domain) (\s :: ListRepositoriesInDomain
s@ListRepositoriesInDomain' {} Text
a -> ListRepositoriesInDomain
s {$sel:domain:ListRepositoriesInDomain' :: Text
domain = Text
a} :: ListRepositoriesInDomain)

instance Core.AWSPager ListRepositoriesInDomain where
  page :: ListRepositoriesInDomain
-> AWSResponse ListRepositoriesInDomain
-> Maybe ListRepositoriesInDomain
page ListRepositoriesInDomain
rq AWSResponse ListRepositoriesInDomain
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRepositoriesInDomain
ListRepositoriesInDomainResponse
rs
            ListRepositoriesInDomainResponse
-> Getting (First Text) ListRepositoriesInDomainResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRepositoriesInDomainResponse
-> Const (First Text) ListRepositoriesInDomainResponse
Lens' ListRepositoriesInDomainResponse (Maybe Text)
listRepositoriesInDomainResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRepositoriesInDomainResponse
 -> Const (First Text) ListRepositoriesInDomainResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRepositoriesInDomainResponse 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 ListRepositoriesInDomain
forall a. Maybe a
Prelude.Nothing
    | Maybe [RepositorySummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRepositoriesInDomain
ListRepositoriesInDomainResponse
rs
            ListRepositoriesInDomainResponse
-> Getting
     (First [RepositorySummary])
     ListRepositoriesInDomainResponse
     [RepositorySummary]
-> Maybe [RepositorySummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RepositorySummary]
 -> Const (First [RepositorySummary]) (Maybe [RepositorySummary]))
-> ListRepositoriesInDomainResponse
-> Const
     (First [RepositorySummary]) ListRepositoriesInDomainResponse
Lens' ListRepositoriesInDomainResponse (Maybe [RepositorySummary])
listRepositoriesInDomainResponse_repositories
              ((Maybe [RepositorySummary]
  -> Const (First [RepositorySummary]) (Maybe [RepositorySummary]))
 -> ListRepositoriesInDomainResponse
 -> Const
      (First [RepositorySummary]) ListRepositoriesInDomainResponse)
-> (([RepositorySummary]
     -> Const (First [RepositorySummary]) [RepositorySummary])
    -> Maybe [RepositorySummary]
    -> Const (First [RepositorySummary]) (Maybe [RepositorySummary]))
-> Getting
     (First [RepositorySummary])
     ListRepositoriesInDomainResponse
     [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 ListRepositoriesInDomain
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRepositoriesInDomain -> Maybe ListRepositoriesInDomain
forall a. a -> Maybe a
Prelude.Just (ListRepositoriesInDomain -> Maybe ListRepositoriesInDomain)
-> ListRepositoriesInDomain -> Maybe ListRepositoriesInDomain
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRepositoriesInDomain
rq
          ListRepositoriesInDomain
-> (ListRepositoriesInDomain -> ListRepositoriesInDomain)
-> ListRepositoriesInDomain
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRepositoriesInDomain -> Identity ListRepositoriesInDomain
Lens
  ListRepositoriesInDomain
  ListRepositoriesInDomain
  (Maybe Text)
  (Maybe Text)
listRepositoriesInDomain_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRepositoriesInDomain -> Identity ListRepositoriesInDomain)
-> Maybe Text
-> ListRepositoriesInDomain
-> ListRepositoriesInDomain
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRepositoriesInDomain
ListRepositoriesInDomainResponse
rs
          ListRepositoriesInDomainResponse
-> Getting (First Text) ListRepositoriesInDomainResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRepositoriesInDomainResponse
-> Const (First Text) ListRepositoriesInDomainResponse
Lens' ListRepositoriesInDomainResponse (Maybe Text)
listRepositoriesInDomainResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRepositoriesInDomainResponse
 -> Const (First Text) ListRepositoriesInDomainResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRepositoriesInDomainResponse 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 ListRepositoriesInDomain where
  type
    AWSResponse ListRepositoriesInDomain =
      ListRepositoriesInDomainResponse
  request :: ListRepositoriesInDomain -> Request ListRepositoriesInDomain
request = Service
-> ListRepositoriesInDomain -> Request ListRepositoriesInDomain
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRepositoriesInDomain
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRepositoriesInDomain)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListRepositoriesInDomain))
-> Logger
-> Service
-> Proxy ListRepositoriesInDomain
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRepositoriesInDomain)))
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 -> ListRepositoriesInDomainResponse
ListRepositoriesInDomainResponse'
            (Maybe [RepositorySummary]
 -> Maybe Text -> Int -> ListRepositoriesInDomainResponse)
-> Either String (Maybe [RepositorySummary])
-> Either
     String (Maybe Text -> Int -> ListRepositoriesInDomainResponse)
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 -> ListRepositoriesInDomainResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListRepositoriesInDomainResponse)
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 -> ListRepositoriesInDomainResponse)
-> Either String Int
-> Either String ListRepositoriesInDomainResponse
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 ListRepositoriesInDomain

instance Prelude.NFData ListRepositoriesInDomain

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

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

instance Core.ToQuery ListRepositoriesInDomain where
  toQuery :: ListRepositoriesInDomain -> QueryString
toQuery ListRepositoriesInDomain' {Maybe Natural
Maybe Text
Text
domain :: Text
maxResults :: Maybe Natural
administratorAccount :: Maybe Text
nextToken :: Maybe Text
domainOwner :: Maybe Text
repositoryPrefix :: Maybe Text
$sel:domain:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Text
$sel:maxResults:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Natural
$sel:administratorAccount:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
$sel:nextToken:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
$sel:domainOwner:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> Maybe Text
$sel:repositoryPrefix:ListRepositoriesInDomain' :: ListRepositoriesInDomain -> 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
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
        ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"administrator-account" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
administratorAccount,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain
      ]

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

-- |
-- Create a value of 'ListRepositoriesInDomainResponse' 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', 'listRepositoriesInDomainResponse_repositories' - The returned list of repositories.
--
-- 'nextToken', 'listRepositoriesInDomainResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'httpStatus', 'listRepositoriesInDomainResponse_httpStatus' - The response's http status code.
newListRepositoriesInDomainResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRepositoriesInDomainResponse
newListRepositoriesInDomainResponse :: Int -> ListRepositoriesInDomainResponse
newListRepositoriesInDomainResponse Int
pHttpStatus_ =
  ListRepositoriesInDomainResponse' :: Maybe [RepositorySummary]
-> Maybe Text -> Int -> ListRepositoriesInDomainResponse
ListRepositoriesInDomainResponse'
    { $sel:repositories:ListRepositoriesInDomainResponse' :: Maybe [RepositorySummary]
repositories =
        Maybe [RepositorySummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRepositoriesInDomainResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRepositoriesInDomainResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The returned list of repositories.
listRepositoriesInDomainResponse_repositories :: Lens.Lens' ListRepositoriesInDomainResponse (Prelude.Maybe [RepositorySummary])
listRepositoriesInDomainResponse_repositories :: (Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> ListRepositoriesInDomainResponse
-> f ListRepositoriesInDomainResponse
listRepositoriesInDomainResponse_repositories = (ListRepositoriesInDomainResponse -> Maybe [RepositorySummary])
-> (ListRepositoriesInDomainResponse
    -> Maybe [RepositorySummary] -> ListRepositoriesInDomainResponse)
-> Lens'
     ListRepositoriesInDomainResponse (Maybe [RepositorySummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomainResponse' {Maybe [RepositorySummary]
repositories :: Maybe [RepositorySummary]
$sel:repositories:ListRepositoriesInDomainResponse' :: ListRepositoriesInDomainResponse -> Maybe [RepositorySummary]
repositories} -> Maybe [RepositorySummary]
repositories) (\s :: ListRepositoriesInDomainResponse
s@ListRepositoriesInDomainResponse' {} Maybe [RepositorySummary]
a -> ListRepositoriesInDomainResponse
s {$sel:repositories:ListRepositoriesInDomainResponse' :: Maybe [RepositorySummary]
repositories = Maybe [RepositorySummary]
a} :: ListRepositoriesInDomainResponse) ((Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
 -> ListRepositoriesInDomainResponse
 -> f ListRepositoriesInDomainResponse)
-> ((Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
    -> Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> (Maybe [RepositorySummary] -> f (Maybe [RepositorySummary]))
-> ListRepositoriesInDomainResponse
-> f ListRepositoriesInDomainResponse
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.
listRepositoriesInDomainResponse_nextToken :: Lens.Lens' ListRepositoriesInDomainResponse (Prelude.Maybe Prelude.Text)
listRepositoriesInDomainResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRepositoriesInDomainResponse
-> f ListRepositoriesInDomainResponse
listRepositoriesInDomainResponse_nextToken = (ListRepositoriesInDomainResponse -> Maybe Text)
-> (ListRepositoriesInDomainResponse
    -> Maybe Text -> ListRepositoriesInDomainResponse)
-> Lens' ListRepositoriesInDomainResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRepositoriesInDomainResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRepositoriesInDomainResponse' :: ListRepositoriesInDomainResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRepositoriesInDomainResponse
s@ListRepositoriesInDomainResponse' {} Maybe Text
a -> ListRepositoriesInDomainResponse
s {$sel:nextToken:ListRepositoriesInDomainResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRepositoriesInDomainResponse)

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

instance
  Prelude.NFData
    ListRepositoriesInDomainResponse