{-# 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.Athena.ListCalculationExecutions -- 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 calculations that have been submitted to a session in -- descending order. Newer calculations are listed first; older -- calculations are listed later. module Amazonka.Athena.ListCalculationExecutions ( -- * Creating a Request ListCalculationExecutions (..), newListCalculationExecutions, -- * Request Lenses listCalculationExecutions_maxResults, listCalculationExecutions_nextToken, listCalculationExecutions_stateFilter, listCalculationExecutions_sessionId, -- * Destructuring the Response ListCalculationExecutionsResponse (..), newListCalculationExecutionsResponse, -- * Response Lenses listCalculationExecutionsResponse_calculations, listCalculationExecutionsResponse_nextToken, listCalculationExecutionsResponse_httpStatus, ) where import Amazonka.Athena.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:/ 'newListCalculationExecutions' smart constructor. data ListCalculationExecutions = ListCalculationExecutions' { -- | The maximum number of calculation executions to return. maxResults :: Prelude.Maybe Prelude.Natural, -- | A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. nextToken :: Prelude.Maybe Prelude.Text, -- | A filter for a specific calculation execution state. A description of -- each state follows. -- -- @CREATING@ - The calculation is in the process of being created. -- -- @CREATED@ - The calculation has been created and is ready to run. -- -- @QUEUED@ - The calculation has been queued for processing. -- -- @RUNNING@ - The calculation is running. -- -- @CANCELING@ - A request to cancel the calculation has been received and -- the system is working to stop it. -- -- @CANCELED@ - The calculation is no longer running as the result of a -- cancel request. -- -- @COMPLETED@ - The calculation has completed without error. -- -- @FAILED@ - The calculation failed and is no longer running. stateFilter :: Prelude.Maybe CalculationExecutionState, -- | The session ID. sessionId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListCalculationExecutions' 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', 'listCalculationExecutions_maxResults' - The maximum number of calculation executions to return. -- -- 'nextToken', 'listCalculationExecutions_nextToken' - A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. -- -- 'stateFilter', 'listCalculationExecutions_stateFilter' - A filter for a specific calculation execution state. A description of -- each state follows. -- -- @CREATING@ - The calculation is in the process of being created. -- -- @CREATED@ - The calculation has been created and is ready to run. -- -- @QUEUED@ - The calculation has been queued for processing. -- -- @RUNNING@ - The calculation is running. -- -- @CANCELING@ - A request to cancel the calculation has been received and -- the system is working to stop it. -- -- @CANCELED@ - The calculation is no longer running as the result of a -- cancel request. -- -- @COMPLETED@ - The calculation has completed without error. -- -- @FAILED@ - The calculation failed and is no longer running. -- -- 'sessionId', 'listCalculationExecutions_sessionId' - The session ID. newListCalculationExecutions :: -- | 'sessionId' Prelude.Text -> ListCalculationExecutions newListCalculationExecutions pSessionId_ = ListCalculationExecutions' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, stateFilter = Prelude.Nothing, sessionId = pSessionId_ } -- | The maximum number of calculation executions to return. listCalculationExecutions_maxResults :: Lens.Lens' ListCalculationExecutions (Prelude.Maybe Prelude.Natural) listCalculationExecutions_maxResults = Lens.lens (\ListCalculationExecutions' {maxResults} -> maxResults) (\s@ListCalculationExecutions' {} a -> s {maxResults = a} :: ListCalculationExecutions) -- | A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. listCalculationExecutions_nextToken :: Lens.Lens' ListCalculationExecutions (Prelude.Maybe Prelude.Text) listCalculationExecutions_nextToken = Lens.lens (\ListCalculationExecutions' {nextToken} -> nextToken) (\s@ListCalculationExecutions' {} a -> s {nextToken = a} :: ListCalculationExecutions) -- | A filter for a specific calculation execution state. A description of -- each state follows. -- -- @CREATING@ - The calculation is in the process of being created. -- -- @CREATED@ - The calculation has been created and is ready to run. -- -- @QUEUED@ - The calculation has been queued for processing. -- -- @RUNNING@ - The calculation is running. -- -- @CANCELING@ - A request to cancel the calculation has been received and -- the system is working to stop it. -- -- @CANCELED@ - The calculation is no longer running as the result of a -- cancel request. -- -- @COMPLETED@ - The calculation has completed without error. -- -- @FAILED@ - The calculation failed and is no longer running. listCalculationExecutions_stateFilter :: Lens.Lens' ListCalculationExecutions (Prelude.Maybe CalculationExecutionState) listCalculationExecutions_stateFilter = Lens.lens (\ListCalculationExecutions' {stateFilter} -> stateFilter) (\s@ListCalculationExecutions' {} a -> s {stateFilter = a} :: ListCalculationExecutions) -- | The session ID. listCalculationExecutions_sessionId :: Lens.Lens' ListCalculationExecutions Prelude.Text listCalculationExecutions_sessionId = Lens.lens (\ListCalculationExecutions' {sessionId} -> sessionId) (\s@ListCalculationExecutions' {} a -> s {sessionId = a} :: ListCalculationExecutions) instance Core.AWSRequest ListCalculationExecutions where type AWSResponse ListCalculationExecutions = ListCalculationExecutionsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListCalculationExecutionsResponse' Prelude.<$> (x Data..?> "Calculations" Core..!@ Prelude.mempty) Prelude.<*> (x Data..?> "NextToken") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListCalculationExecutions where hashWithSalt _salt ListCalculationExecutions' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken `Prelude.hashWithSalt` stateFilter `Prelude.hashWithSalt` sessionId instance Prelude.NFData ListCalculationExecutions where rnf ListCalculationExecutions' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf stateFilter `Prelude.seq` Prelude.rnf sessionId instance Data.ToHeaders ListCalculationExecutions where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AmazonAthena.ListCalculationExecutions" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListCalculationExecutions where toJSON ListCalculationExecutions' {..} = Data.object ( Prelude.catMaybes [ ("MaxResults" Data..=) Prelude.<$> maxResults, ("NextToken" Data..=) Prelude.<$> nextToken, ("StateFilter" Data..=) Prelude.<$> stateFilter, Prelude.Just ("SessionId" Data..= sessionId) ] ) instance Data.ToPath ListCalculationExecutions where toPath = Prelude.const "/" instance Data.ToQuery ListCalculationExecutions where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListCalculationExecutionsResponse' smart constructor. data ListCalculationExecutionsResponse = ListCalculationExecutionsResponse' { -- | A list of CalculationSummary objects. calculations :: Prelude.Maybe [CalculationSummary], -- | A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. 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 'ListCalculationExecutionsResponse' 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: -- -- 'calculations', 'listCalculationExecutionsResponse_calculations' - A list of CalculationSummary objects. -- -- 'nextToken', 'listCalculationExecutionsResponse_nextToken' - A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. -- -- 'httpStatus', 'listCalculationExecutionsResponse_httpStatus' - The response's http status code. newListCalculationExecutionsResponse :: -- | 'httpStatus' Prelude.Int -> ListCalculationExecutionsResponse newListCalculationExecutionsResponse pHttpStatus_ = ListCalculationExecutionsResponse' { calculations = Prelude.Nothing, nextToken = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | A list of CalculationSummary objects. listCalculationExecutionsResponse_calculations :: Lens.Lens' ListCalculationExecutionsResponse (Prelude.Maybe [CalculationSummary]) listCalculationExecutionsResponse_calculations = Lens.lens (\ListCalculationExecutionsResponse' {calculations} -> calculations) (\s@ListCalculationExecutionsResponse' {} a -> s {calculations = a} :: ListCalculationExecutionsResponse) Prelude.. Lens.mapping Lens.coerced -- | A token generated by the Athena service that specifies where to continue -- pagination if a previous request was truncated. To obtain the next set -- of pages, pass in the @NextToken@ from the response object of the -- previous page call. listCalculationExecutionsResponse_nextToken :: Lens.Lens' ListCalculationExecutionsResponse (Prelude.Maybe Prelude.Text) listCalculationExecutionsResponse_nextToken = Lens.lens (\ListCalculationExecutionsResponse' {nextToken} -> nextToken) (\s@ListCalculationExecutionsResponse' {} a -> s {nextToken = a} :: ListCalculationExecutionsResponse) -- | The response's http status code. listCalculationExecutionsResponse_httpStatus :: Lens.Lens' ListCalculationExecutionsResponse Prelude.Int listCalculationExecutionsResponse_httpStatus = Lens.lens (\ListCalculationExecutionsResponse' {httpStatus} -> httpStatus) (\s@ListCalculationExecutionsResponse' {} a -> s {httpStatus = a} :: ListCalculationExecutionsResponse) instance Prelude.NFData ListCalculationExecutionsResponse where rnf ListCalculationExecutionsResponse' {..} = Prelude.rnf calculations `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf httpStatus