{-# 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.Glue.ListWorkflows -- 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 names of workflows created in the account. module Amazonka.Glue.ListWorkflows ( -- * Creating a Request ListWorkflows (..), newListWorkflows, -- * Request Lenses listWorkflows_maxResults, listWorkflows_nextToken, -- * Destructuring the Response ListWorkflowsResponse (..), newListWorkflowsResponse, -- * Response Lenses listWorkflowsResponse_nextToken, listWorkflowsResponse_workflows, listWorkflowsResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.Glue.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newListWorkflows' smart constructor. data ListWorkflows = ListWorkflows' { -- | The maximum size of a list to return. maxResults :: Prelude.Maybe Prelude.Natural, -- | A continuation token, if this is a continuation request. nextToken :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListWorkflows' 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', 'listWorkflows_maxResults' - The maximum size of a list to return. -- -- 'nextToken', 'listWorkflows_nextToken' - A continuation token, if this is a continuation request. newListWorkflows :: ListWorkflows newListWorkflows = ListWorkflows' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing } -- | The maximum size of a list to return. listWorkflows_maxResults :: Lens.Lens' ListWorkflows (Prelude.Maybe Prelude.Natural) listWorkflows_maxResults = Lens.lens (\ListWorkflows' {maxResults} -> maxResults) (\s@ListWorkflows' {} a -> s {maxResults = a} :: ListWorkflows) -- | A continuation token, if this is a continuation request. listWorkflows_nextToken :: Lens.Lens' ListWorkflows (Prelude.Maybe Prelude.Text) listWorkflows_nextToken = Lens.lens (\ListWorkflows' {nextToken} -> nextToken) (\s@ListWorkflows' {} a -> s {nextToken = a} :: ListWorkflows) instance Core.AWSRequest ListWorkflows where type AWSResponse ListWorkflows = ListWorkflowsResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> ListWorkflowsResponse' Prelude.<$> (x Data..?> "NextToken") Prelude.<*> (x Data..?> "Workflows") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable ListWorkflows where hashWithSalt _salt ListWorkflows' {..} = _salt `Prelude.hashWithSalt` maxResults `Prelude.hashWithSalt` nextToken instance Prelude.NFData ListWorkflows where rnf ListWorkflows' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken instance Data.ToHeaders ListWorkflows where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ("AWSGlue.ListWorkflows" :: Prelude.ByteString), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON ListWorkflows where toJSON ListWorkflows' {..} = Data.object ( Prelude.catMaybes [ ("MaxResults" Data..=) Prelude.<$> maxResults, ("NextToken" Data..=) Prelude.<$> nextToken ] ) instance Data.ToPath ListWorkflows where toPath = Prelude.const "/" instance Data.ToQuery ListWorkflows where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newListWorkflowsResponse' smart constructor. data ListWorkflowsResponse = ListWorkflowsResponse' { -- | A continuation token, if not all workflow names have been returned. nextToken :: Prelude.Maybe Prelude.Text, -- | List of names of workflows in the account. workflows :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text), -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListWorkflowsResponse' 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', 'listWorkflowsResponse_nextToken' - A continuation token, if not all workflow names have been returned. -- -- 'workflows', 'listWorkflowsResponse_workflows' - List of names of workflows in the account. -- -- 'httpStatus', 'listWorkflowsResponse_httpStatus' - The response's http status code. newListWorkflowsResponse :: -- | 'httpStatus' Prelude.Int -> ListWorkflowsResponse newListWorkflowsResponse pHttpStatus_ = ListWorkflowsResponse' { nextToken = Prelude.Nothing, workflows = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | A continuation token, if not all workflow names have been returned. listWorkflowsResponse_nextToken :: Lens.Lens' ListWorkflowsResponse (Prelude.Maybe Prelude.Text) listWorkflowsResponse_nextToken = Lens.lens (\ListWorkflowsResponse' {nextToken} -> nextToken) (\s@ListWorkflowsResponse' {} a -> s {nextToken = a} :: ListWorkflowsResponse) -- | List of names of workflows in the account. listWorkflowsResponse_workflows :: Lens.Lens' ListWorkflowsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text)) listWorkflowsResponse_workflows = Lens.lens (\ListWorkflowsResponse' {workflows} -> workflows) (\s@ListWorkflowsResponse' {} a -> s {workflows = a} :: ListWorkflowsResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listWorkflowsResponse_httpStatus :: Lens.Lens' ListWorkflowsResponse Prelude.Int listWorkflowsResponse_httpStatus = Lens.lens (\ListWorkflowsResponse' {httpStatus} -> httpStatus) (\s@ListWorkflowsResponse' {} a -> s {httpStatus = a} :: ListWorkflowsResponse) instance Prelude.NFData ListWorkflowsResponse where rnf ListWorkflowsResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf workflows `Prelude.seq` Prelude.rnf httpStatus