{-# 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.ConnectCases.ListDomains -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Lists all cases domains in the Amazon Web Services account. Each list -- item is a condensed summary object of the domain. module Amazonka.ConnectCases.ListDomains ( -- * Creating a Request ListDomains (..), newListDomains, -- * Request Lenses listDomains_maxResults, listDomains_nextToken, -- * Destructuring the Response ListDomainsResponse (..), newListDomainsResponse, -- * Response Lenses listDomainsResponse_nextToken, listDomainsResponse_httpStatus, listDomainsResponse_domains, ) where import Amazonka.ConnectCases.Types import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newListDomains' smart constructor. data ListDomains = ListDomains' { -- | The maximum number of results to return per page. maxResults :: Prelude.Maybe Prelude.Natural, -- | 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. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListDomains' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'maxResults', 'listDomains_maxResults' - The maximum number of results to return per page. -- -- 'nextToken', 'listDomains_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. newListDomains :: ListDomains newListDomains = ListDomains' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | The maximum number of results to return per page. listDomains_maxResults :: Lens.Lens' ListDomains (Prelude.Maybe Prelude.Natural) listDomains_maxResults = Lens.lens (\ListDomains' {maxResults} -> maxResults) (\s@ListDomains' {} a -> s {maxResults = a} :: ListDomains) -- | 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. listDomains_nextToken :: Lens.Lens' ListDomains (Prelude.Maybe Prelude.Text) listDomains_nextToken = Lens.lens (\ListDomains' {nextToken} -> nextToken) (\s@ListDomains' {} a -> s {nextToken = a} :: ListDomains) instance Core.AWSRequest ListDomains where type AWSResponse ListDomains = ListDomainsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListDomainsResponse' Prelude.<$> (x Data..?> "nextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) Prelude.<*> (x Data..?> "domains" Core..!@ Prelude.mempty) ) instance Prelude.Hashable ListDomains where hashWithSalt _salt ListDomains' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListDomains where rnf ListDomains' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListDomains where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListDomains where toJSON = Prelude.const (Data.Object Prelude.mempty) instance Data.ToPath ListDomains where toPath = Prelude.const "/domains-list" instance Data.ToQuery ListDomains where toQuery ListDomains' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken ] -- | /See:/ 'newListDomainsResponse' smart constructor. data ListDomainsResponse = ListDomainsResponse' { -- | The token for the next set of results. This is null if there are no more -- results to return. nextToken :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int, -- | The Cases domain. domains :: [DomainSummary] } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListDomainsResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'nextToken', 'listDomainsResponse_nextToken' - The token for the next set of results. This is null if there are no more -- results to return. -- -- 'httpStatus', 'listDomainsResponse_httpStatus' - The response's http status code. -- -- 'domains', 'listDomainsResponse_domains' - The Cases domain. newListDomainsResponse :: -- | 'httpStatus' Prelude.Int -> ListDomainsResponse newListDomainsResponse pHttpStatus_ = ListDomainsResponse' { nextToken = Prelude.Nothing, httpStatus = pHttpStatus_, domains = Prelude.mempty } -- | The token for the next set of results. This is null if there are no more -- results to return. listDomainsResponse_nextToken :: Lens.Lens' ListDomainsResponse (Prelude.Maybe Prelude.Text) listDomainsResponse_nextToken = Lens.lens (\ListDomainsResponse' {nextToken} -> nextToken) (\s@ListDomainsResponse' {} a -> s {nextToken = a} :: ListDomainsResponse) -- | The response's http status code. listDomainsResponse_httpStatus :: Lens.Lens' ListDomainsResponse Prelude.Int listDomainsResponse_httpStatus = Lens.lens (\ListDomainsResponse' {httpStatus} -> httpStatus) (\s@ListDomainsResponse' {} a -> s {httpStatus = a} :: ListDomainsResponse) -- | The Cases domain. listDomainsResponse_domains :: Lens.Lens' ListDomainsResponse [DomainSummary] listDomainsResponse_domains = Lens.lens (\ListDomainsResponse' {domains} -> domains) (\s@ListDomainsResponse' {} a -> s {domains = a} :: ListDomainsResponse) Prelude.. Lens.coerced instance Prelude.NFData ListDomainsResponse where rnf ListDomainsResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus `Prelude.seq` Prelude.rnf domains