{-# 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.ServiceQuotas.ListServices -- 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 the names and codes for the services integrated with Service -- Quotas. -- -- This operation returns paginated results. module Amazonka.ServiceQuotas.ListServices ( -- * Creating a Request ListServices (..), newListServices, -- * Request Lenses listServices_maxResults, listServices_nextToken, -- * Destructuring the Response ListServicesResponse (..), newListServicesResponse, -- * Response Lenses listServicesResponse_nextToken, listServicesResponse_services, listServicesResponse_httpStatus, ) where 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 import Amazonka.ServiceQuotas.Types -- | /See:/ 'newListServices' smart constructor. data ListServices = ListServices' { -- | The maximum number of results to return with a single call. To retrieve -- the remaining results, if any, make another call with the token returned -- from this call. maxResults :: Prelude.Maybe Prelude.Natural, -- | The token for the next page of results. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListServices' 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', 'listServices_maxResults' - The maximum number of results to return with a single call. To retrieve -- the remaining results, if any, make another call with the token returned -- from this call. -- -- 'nextToken', 'listServices_nextToken' - The token for the next page of results. newListServices :: ListServices newListServices = ListServices' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | The maximum number of results to return with a single call. To retrieve -- the remaining results, if any, make another call with the token returned -- from this call. listServices_maxResults :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Natural) listServices_maxResults = Lens.lens (\ListServices' {maxResults} -> maxResults) (\s@ListServices' {} a -> s {maxResults = a} :: ListServices) -- | The token for the next page of results. listServices_nextToken :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Text) listServices_nextToken = Lens.lens (\ListServices' {nextToken} -> nextToken) (\s@ListServices' {} a -> s {nextToken = a} :: ListServices) instance Core.AWSPager ListServices where page rq rs | Core.stop ( rs Lens.^? listServicesResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listServicesResponse_services Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listServices_nextToken Lens..~ rs Lens.^? listServicesResponse_nextToken Prelude.. Lens._Just instance Core.AWSRequest ListServices where type AWSResponse ListServices = ListServicesResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListServicesResponse' Prelude.<$> (x Data..?> "NextToken") Prelude.<*> (x Data..?> "Services" Core..!@ Prelude.mempty) Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListServices where hashWithSalt _salt ListServices' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListServices where rnf ListServices' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListServices where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "ServiceQuotasV20190624.ListServices" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListServices where toJSON ListServices' {..} = Data.object ( Prelude.catMaybes [ ("MaxResults" Data..=) Prelude.<$> maxResults, ("NextToken" Data..=) Prelude.<$> nextToken ] ) instance Data.ToPath ListServices where toPath = Prelude.const "/" instance Data.ToQuery ListServices where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListServicesResponse' smart constructor. data ListServicesResponse = ListServicesResponse' { -- | The token to use to retrieve the next page of results. This value is -- null when there are no more results to return. nextToken :: Prelude.Maybe Prelude.Text, -- | Information about the services. services :: Prelude.Maybe [ServiceInfo], -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListServicesResponse' 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', 'listServicesResponse_nextToken' - The token to use to retrieve the next page of results. This value is -- null when there are no more results to return. -- -- 'services', 'listServicesResponse_services' - Information about the services. -- -- 'httpStatus', 'listServicesResponse_httpStatus' - The response's http status code. newListServicesResponse :: -- | 'httpStatus' Prelude.Int -> ListServicesResponse newListServicesResponse pHttpStatus_ = ListServicesResponse' { nextToken = Prelude.Nothing, services = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The token to use to retrieve the next page of results. This value is -- null when there are no more results to return. listServicesResponse_nextToken :: Lens.Lens' ListServicesResponse (Prelude.Maybe Prelude.Text) listServicesResponse_nextToken = Lens.lens (\ListServicesResponse' {nextToken} -> nextToken) (\s@ListServicesResponse' {} a -> s {nextToken = a} :: ListServicesResponse) -- | Information about the services. listServicesResponse_services :: Lens.Lens' ListServicesResponse (Prelude.Maybe [ServiceInfo]) listServicesResponse_services = Lens.lens (\ListServicesResponse' {services} -> services) (\s@ListServicesResponse' {} a -> s {services = a} :: ListServicesResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listServicesResponse_httpStatus :: Lens.Lens' ListServicesResponse Prelude.Int listServicesResponse_httpStatus = Lens.lens (\ListServicesResponse' {httpStatus} -> httpStatus) (\s@ListServicesResponse' {} a -> s {httpStatus = a} :: ListServicesResponse) instance Prelude.NFData ListServicesResponse where rnf ListServicesResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf services `Prelude.seq` Prelude.rnf httpStatus