{-# 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.AppConfig.ListEnvironments -- 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 environments for an application. module Amazonka.AppConfig.ListEnvironments ( -- * Creating a Request ListEnvironments (..), newListEnvironments, -- * Request Lenses listEnvironments_maxResults, listEnvironments_nextToken, listEnvironments_applicationId, -- * Destructuring the Response ListEnvironmentsResponse (..), newListEnvironmentsResponse, -- * Response Lenses listEnvironmentsResponse_items, listEnvironmentsResponse_nextToken, listEnvironmentsResponse_httpStatus, ) where import Amazonka.AppConfig.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:/ 'newListEnvironments' smart constructor. data ListEnvironments = ListEnvironments' { -- | The maximum number of items to return for this call. The call also -- returns a token that you can specify in a subsequent call to get the -- next set of results. maxResults :: Prelude.Maybe Prelude.Natural, -- | A token to start the list. Use this token to get the next set of -- results. nextToken :: Prelude.Maybe Prelude.Text, -- | The application ID. applicationId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListEnvironments' 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', 'listEnvironments_maxResults' - The maximum number of items to return for this call. The call also -- returns a token that you can specify in a subsequent call to get the -- next set of results. -- -- 'nextToken', 'listEnvironments_nextToken' - A token to start the list. Use this token to get the next set of -- results. -- -- 'applicationId', 'listEnvironments_applicationId' - The application ID. newListEnvironments :: -- | 'applicationId' Prelude.Text -> ListEnvironments newListEnvironments pApplicationId_ = ListEnvironments' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, applicationId = pApplicationId_ } -- | The maximum number of items to return for this call. The call also -- returns a token that you can specify in a subsequent call to get the -- next set of results. listEnvironments_maxResults :: Lens.Lens' ListEnvironments (Prelude.Maybe Prelude.Natural) listEnvironments_maxResults = Lens.lens (\ListEnvironments' {maxResults} -> maxResults) (\s@ListEnvironments' {} a -> s {maxResults = a} :: ListEnvironments) -- | A token to start the list. Use this token to get the next set of -- results. listEnvironments_nextToken :: Lens.Lens' ListEnvironments (Prelude.Maybe Prelude.Text) listEnvironments_nextToken = Lens.lens (\ListEnvironments' {nextToken} -> nextToken) (\s@ListEnvironments' {} a -> s {nextToken = a} :: ListEnvironments) -- | The application ID. listEnvironments_applicationId :: Lens.Lens' ListEnvironments Prelude.Text listEnvironments_applicationId = Lens.lens (\ListEnvironments' {applicationId} -> applicationId) (\s@ListEnvironments' {} a -> s {applicationId = a} :: ListEnvironments) instance Core.AWSRequest ListEnvironments where type AWSResponse ListEnvironments = ListEnvironmentsResponse request overrides = Request.get (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListEnvironmentsResponse' Prelude.<$> (x Data..?> "Items" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "NextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListEnvironments where hashWithSalt _salt ListEnvironments' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` applicationId instance Prelude.NFData ListEnvironments where rnf ListEnvironments' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf applicationId instance Data.ToHeaders ListEnvironments where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListEnvironments where toPath ListEnvironments' {..} = Prelude.mconcat [ "/applications/", Data.toBS applicationId, "/environments" ] instance Data.ToQuery ListEnvironments where toQuery ListEnvironments' {..} = Prelude.mconcat [ "max_results" Data.=: maxResults, "next_token" Data.=: nextToken ] -- | /See:/ 'newListEnvironmentsResponse' smart constructor. data ListEnvironmentsResponse = ListEnvironmentsResponse' { -- | The elements from this collection. items :: Prelude.Maybe [Environment], -- | The token for the next set of items to return. Use this token to get the -- next set of results. nextToken :: Prelude.Maybe Prelude.Text, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListEnvironmentsResponse' 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: -- -- 'items', 'listEnvironmentsResponse_items' - The elements from this collection. -- -- 'nextToken', 'listEnvironmentsResponse_nextToken' - The token for the next set of items to return. Use this token to get the -- next set of results. -- -- 'httpStatus', 'listEnvironmentsResponse_httpStatus' - The response's http status code. newListEnvironmentsResponse :: -- | 'httpStatus' Prelude.Int -> ListEnvironmentsResponse newListEnvironmentsResponse pHttpStatus_ = ListEnvironmentsResponse' { items = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The elements from this collection. listEnvironmentsResponse_items :: Lens.Lens' ListEnvironmentsResponse (Prelude.Maybe [Environment]) listEnvironmentsResponse_items = Lens.lens (\ListEnvironmentsResponse' {items} -> items) (\s@ListEnvironmentsResponse' {} a -> s {items = a} :: ListEnvironmentsResponse) Prelude.. Lens.mapping Lens.coerced -- | The token for the next set of items to return. Use this token to get the -- next set of results. listEnvironmentsResponse_nextToken :: Lens.Lens' ListEnvironmentsResponse (Prelude.Maybe Prelude.Text) listEnvironmentsResponse_nextToken = Lens.lens (\ListEnvironmentsResponse' {nextToken} -> nextToken) (\s@ListEnvironmentsResponse' {} a -> s {nextToken = a} :: ListEnvironmentsResponse) -- | The response's http status code. listEnvironmentsResponse_httpStatus :: Lens.Lens' ListEnvironmentsResponse Prelude.Int listEnvironmentsResponse_httpStatus = Lens.lens (\ListEnvironmentsResponse' {httpStatus} -> httpStatus) (\s@ListEnvironmentsResponse' {} a -> s {httpStatus = a} :: ListEnvironmentsResponse) instance Prelude.NFData ListEnvironmentsResponse where rnf ListEnvironmentsResponse' {..} = Prelude.rnf items `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus