3

Spring Cloud Data Flow参考指南(六)

 1 year ago
source link: https://blog.51cto.com/u_15326439/5913135
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Spring Cloud Data Flow参考指南(六)

精选 原创
Spring Cloud Data Flow参考指南(六)_Boo

42. 链接

已创建多个示例来帮助您开始实现比参考指南中显示的基本流和任务更高级别的用例。 这些示例是单独存储库的一部分,并具有自己的参考文档。

提供以下示例:

  • Java DSL
  • HTTP 到 Cassandra
  • HTTP 到 MySQL
  • HTTP 到 Gemfire
  • 宝石火CQ到日志演示
  • 宝石火到日志演示
  • 定制处理器

任务和批处理

  • Cloud Foundry 上的批处理作业
  • 批处理文件摄取
  • 使用弹簧云功能

REST API 指南

本节介绍 Spring Cloud Data Flow REST API。

43. 概述

Spring Cloud Data Flow提供了一个REST API,可让您访问服务器的各个方面。 事实上,Spring Cloud Data Flow shell 是该 API 的一等使用者。

如果您计划将 REST API 与 Java 一起使用,您应该考虑使用 提供了在内部使用 REST API 的 Java 客户端 ()。​​DataflowTemplate​

43.1. HTTP 动词

Spring Cloud Data Flow 尝试在使用 HTTP 谓词时尽可能遵守标准 HTTP 和 REST 约定,如下表所述:

​GET​

用于检索资源。

​POST​

用于创建新资源。

​PUT​

用于更新现有资源,包括部分更新。也用于 暗示概念的资源,例如任务。​​restarts​

​DELETE​

用于删除现有资源。

43.2. HTTP 状态码

Spring Cloud Data Flow 在使用 HTTP 状态代码时尝试尽可能遵循标准 HTTP 和 REST 约定,如下表所示:

​200 OK​

请求已成功完成。

​201 Created​

已成功创建新资源。资源的 URI 可从响应的标头获得。​​Location​

​204 No Content​

已成功应用对现有资源的更新。

​400 Bad Request​

请求格式不正确。响应正文包括提供详细信息的错误说明。

​404 Not Found​

请求的资源不存在。

​409 Conflict​

请求的资源已存在。例如,任务已存在或流已在部署

​422 Unprocessable Entity​

在无法停止或重新启动作业执行的情况下返回。

43.3. 标题

每个响应都有以下标头:

​Content-Type​

有效负载的内容类型,例如​​application/hal+json​

43.4. 错误

​error​

​String​

发生的 HTTP 错误,例如​​Bad Request​

​message​

​String​

错误原因的说明

​path​

​String​

发出请求的路径

​status​

​Number​

HTTP 状态代码,例如​​400​

​timestamp​

​String​

发生错误的时间(以毫秒为单位)

43.5. 超媒体

Spring Cloud Data Flow 使用超媒体,资源包括指向其他资源的链接 在他们的回应中。 响应采用从资源到资源语言 (HAL) 格式的超文本应用程序。 链接可以在密钥下方找到。 API 的用户不应自行创建 URI。 相反,他们应该使用上述链接进行导航。​​_links​

44. 资源

该 API 包括以下资源:

  • 服务器元信息
  • 已注册的应用程序
  • 任务计划程序
  • 作业步骤执行
  • 有关应用程序的运行时信息

44.1. 索引

该索引提供了进入Spring Cloud Data Flow的REST API的入口点。 以下主题提供了更多详细信息:

44.1.1. 访问索引

使用请求访问索引。​​GET​

GET / HTTP/1.1
Host: localhost:9393
$ curl 'http://localhost:9393/' -i -X GET

​_links​

​Object​

指向其他资源的链接

​['api.revision']​

​Number​

每次在此 REST API 中实施更改时递增

​_links.audit-records.href​

​String​

链接到审计记录

​_links.dashboard.href​

​String​

链接到仪表板

​_links.streams/definitions.href​

​String​

链接到流/定义

​_links.streams/definitions/definition.href​

​String​

链接到流/定义/定义

​_links.streams/definitions/definition.templated​

​Boolean​

链接流/定义/定义是模板化的

​_links.runtime/apps.href​

​String​

链接到运行时/应用程序

​_links.runtime/apps/{appId}.href​

​String​

链接到运行时/应用程序/{appId}

​_links.runtime/apps/{appId}.templated​

​Boolean​

链接运行时/应用模板化

​_links.runtime/apps/{appId}/instances.href​

​String​

链接到运行时/应用程序/{appId}/实例

​_links.runtime/apps/{appId}/instances.templated​

​Boolean​

链接运行时/应用程序/{appId}/实例是模板化的

​_links.runtime/apps/{appId}/instances/{instanceId}.href​

​String​

链接到 runtime/apps/{appId}/instances/{instanceId}

​_links.runtime/apps/{appId}/instances/{instanceId}.templated​

​Boolean​

Link runtime/apps/{appId}/instances/{instanceId} is templated

​_links.runtime/streams.href​

​String​

链接到运行时/流

​_links.runtime/streams.templated​

​Boolean​

链接运行时/流是模板化的

​_links.runtime/streams/{streamNames}.href​

​String​

链接到运行时/流/{流名称}

​_links.runtime/streams/{streamNames}.templated​

​Boolean​

Link runtime/streams/{streamNames} 是模板化的

​_links.streams/logs.href​

​String​

链接到流/日志

​_links.streams/logs/{streamName}.href​

​String​

链接到流/日志/{流名称}

​_links.streams/logs/{streamName}/{appName}.href​

​String​

链接到流/日志/{流名称}/{应用名称}

​_links.streams/logs/{streamName}.templated​

​Boolean​

链接流/日志/{流名称} 是模板化的

​_links.streams/logs/{streamName}/{appName}.templated​

​Boolean​

Link streams/logs/{streamName}/{appName} is templated

​_links.streams/deployments​

​Object​

链接到流/部署

​_links.streams/deployments.href​

​String​

链接到流/部署

​_links.streams/deployments/{name}​

​Object​

链接流/部署/{名称} 已模板化

​_links.streams/deployments/{name}.href​

​String​

链接流/部署/{名称} 已模板化

​_links.streams/deployments/{name}.templated​

​Boolean​

链接流/部署/{名称} 已模板化

​_links.streams/deployments/{name}{?reuse-deployment-properties}.href​

​String​

链接流/部署/{名称} 已模板化

​_links.streams/deployments/{name}{?reuse-deployment-properties}.templated​

​Boolean​

链接流/部署/{名称} 已模板化

​_links.streams/deployments/deployment.href​

​String​

链接到流/部署/部署

​_links.streams/deployments/deployment.templated​

​Boolean​

链接流/部署/部署是模板化的

​_links.streams/deployments/manifest/{name}/{version}.href​

​String​

链接到流/部署/清单/{名称}/{版本}

​_links.streams/deployments/manifest/{name}/{version}.templated​

​Boolean​

链接流/部署/清单/{名称}/{版本} 是模板化的

​_links.streams/deployments/history/{name}.href​

​String​

链接到流/部署/历史记录/{名称}

​_links.streams/deployments/history/{name}.templated​

​Boolean​

链接流/部署/历史记录已模板化

​_links.streams/deployments/rollback/{name}/{version}.href​

​String​

链接到流/部署/回滚/{名称}/{版本}

​_links.streams/deployments/rollback/{name}/{version}.templated​

​Boolean​

链接流/部署/回滚/{名称}/{版本} 是模板化的

​_links.streams/deployments/update/{name}.href​

​String​

链接到流/部署/更新/{名称}

​_links.streams/deployments/update/{name}.templated​

​Boolean​

链接流/部署/更新/{名称} 是模板化的

​_links.streams/deployments/platform/list.href​

​String​

链接到流/部署/平台/列表

​_links.streams/deployments/scale/{streamName}/{appName}/instances/{count}.href​

​String​

链接到流/部署/规模/{流名称}/{appName}/实例/{计数}

​_links.streams/deployments/scale/{streamName}/{appName}/instances/{count}.templated​

​Boolean​

Link streams/deployments/scale/{streamName}/{appName}/instances/{count} is templated

​_links.streams/validation.href​

​String​

链接到流/验证

​_links.streams/validation.templated​

​Boolean​

链接流/验证已模板化

​_links.tasks/platforms.href​

​String​

链接到任务/平台

​_links.tasks/definitions.href​

​String​

链接到任务/定义

​_links.tasks/definitions/definition.href​

​String​

链接到任务/定义/定义

​_links.tasks/definitions/definition.templated​

​Boolean​

链接任务/定义/定义已模板化

​_links.tasks/executions.href​

​String​

链接到任务/执行

​_links.tasks/executions/name.href​

​String​

链接到任务/执行/名称

​_links.tasks/executions/name.templated​

​Boolean​

链接任务/执行/名称已模板化

​_links.tasks/executions/current.href​

​String​

链接到任务/执行/当前

​_links.tasks/executions/execution.href​

​String​

链接到任务/执行/执行

​_links.tasks/executions/execution.templated​

​Boolean​

链接任务/执行/执行是模板化的

​_links.tasks/info/executions.href​

​String​

链接到任务/信息/执行

​_links.tasks/info/executions.templated​

​Boolean​

链接任务/信息已模板化

​_links.tasks/logs.href​

​String​

链接到任务/日志

​_links.tasks/logs.templated​

​Boolean​

链接任务/日志已模板化

​_links.tasks/schedules.href​

​String​

链接到任务/执行/计划

​_links.tasks/schedules/instances.href​

​String​

链接到任务/计划/实例

​_links.tasks/schedules/instances.templated​

​Boolean​

链接任务/计划/实例是模板化的

​_links.tasks/validation.href​

​String​

链接到任务/验证

​_links.tasks/validation.templated​

​Boolean​

链接任务/验证是模板化的

​_links.jobs/executions.href​

​String​

链接到作业/执行

​_links.jobs/thinexecutions.href​

​String​

链接到作业/精简执行

​_links.jobs/executions/name.href​

​String​

链接到作业/执行/名称

​_links.jobs/executions/name.templated​

​Boolean​

链接作业/执行/名称是模板化的

​_links.jobs/executions/status.href​

​String​

链接到作业/执行/状态

​_links.jobs/executions/status.templated​

​Boolean​

链接作业/执行/状态是模板化的

​_links.jobs/thinexecutions/name.href​

​String​

链接到作业/精简执行/名称

​_links.jobs/thinexecutions/name.templated​

​Boolean​

链接作业/执行/名称是模板化的

​_links.jobs/thinexecutions/jobInstanceId.href​

​String​

链接到 jobs/thinexecutions/jobInstanceId

​_links.jobs/thinexecutions/jobInstanceId.templated​

​Boolean​

链接作业/执行/作业实例 ID 是模板化的

​_links.jobs/thinexecutions/taskExecutionId.href​

​String​

链接到 jobs/thinexecutions/taskExecutionId

​_links.jobs/thinexecutions/taskExecutionId.templated​

​Boolean​

链接作业/执行/任务执行 ID 是模板化的

​_links.jobs/executions/execution.href​

​String​

链接到作业/执行/执行

​_links.jobs/executions/execution.templated​

​Boolean​

链接作业/执行/执行是模板化的

​_links.jobs/executions/execution/steps.href​

​String​

链接到作业/执行/执行/步骤

​_links.jobs/executions/execution/steps.templated​

​Boolean​

链接作业/执行/执行/步骤模板化

​_links.jobs/executions/execution/steps/step.href​

​String​

链接到作业/执行/执行/步骤/步骤

​_links.jobs/executions/execution/steps/step.templated​

​Boolean​

链接作业/执行/执行/步骤/步骤是模板化的

​_links.jobs/executions/execution/steps/step/progress.href​

​String​

链接到作业/执行/执行/步骤/步骤/进度

​_links.jobs/executions/execution/steps/step/progress.templated​

​Boolean​

链接作业/执行/执行/步骤/步骤/进度模板化

​_links.jobs/instances/name.href​

​String​

链接到作业/实例/名称

​_links.jobs/instances/name.templated​

​Boolean​

链接作业/实例/名称已模板化

​_links.jobs/instances/instance.href​

​String​

链接到作业/实例/实例

​_links.jobs/instances/instance.templated​

​Boolean​

链接作业/实例/实例已模板化

​_links.tools/parseTaskTextToGraph.href​

​String​

链接到工具/parseTaskTextToGraph

​_links.tools/convertTaskGraphToText.href​

​String​

链接到工具/转换任务图形到文本

​_links.apps.href​

​String​

链接到应用程序

​_links.about.href​

​String​

链接到关于

​_links.completions/stream.href​

​String​

链接到完成/流

​_links.completions/stream.templated​

​Boolean​

链接完成/流模板化

​_links.completions/task.href​

​String​

链接到完成/任务

​_links.completions/task.templated​

​Boolean​

链接完成/任务已模板化

HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 7064

{
"_links" : {
"dashboard" : {
"href" : "http://localhost:9393/dashboard"
},
"audit-records" : {
"href" : "http://localhost:9393/audit-records"
},
"streams/definitions" : {
"href" : "http://localhost:9393/streams/definitions"
},
"streams/definitions/definition" : {
"href" : "http://localhost:9393/streams/definitions/{name}",
"templated" : true
},
"streams/validation" : {
"href" : "http://localhost:9393/streams/validation/{name}",
"templated" : true
},
"runtime/streams" : {
"href" : "http://localhost:9393/runtime/streams{?names}",
"templated" : true
},
"runtime/streams/{streamNames}" : {
"href" : "http://localhost:9393/runtime/streams/{streamNames}",
"templated" : true
},
"runtime/apps" : {
"href" : "http://localhost:9393/runtime/apps"
},
"runtime/apps/{appId}" : {
"href" : "http://localhost:9393/runtime/apps/{appId}",
"templated" : true
},
"runtime/apps/{appId}/instances" : {
"href" : "http://localhost:9393/runtime/apps/{appId}/instances",
"templated" : true
},
"runtime/apps/{appId}/instances/{instanceId}" : {
"href" : "http://localhost:9393/runtime/apps/{appId}/instances/{instanceId}",
"templated" : true
},
"streams/deployments" : {
"href" : "http://localhost:9393/streams/deployments"
},
"streams/deployments/{name}{?reuse-deployment-properties}" : {
"href" : "http://localhost:9393/streams/deployments/{name}?reuse-deployment-properties=false",
"templated" : true
},
"streams/deployments/{name}" : {
"href" : "http://localhost:9393/streams/deployments/{name}",
"templated" : true
},
"streams/deployments/history/{name}" : {
"href" : "http://localhost:9393/streams/deployments/history/{name}",
"templated" : true
},
"streams/deployments/manifest/{name}/{version}" : {
"href" : "http://localhost:9393/streams/deployments/manifest/{name}/{version}",
"templated" : true
},
"streams/deployments/platform/list" : {
"href" : "http://localhost:9393/streams/deployments/platform/list"
},
"streams/deployments/rollback/{name}/{version}" : {
"href" : "http://localhost:9393/streams/deployments/rollback/{name}/{version}",
"templated" : true
},
"streams/deployments/update/{name}" : {
"href" : "http://localhost:9393/streams/deployments/update/{name}",
"templated" : true
},
"streams/deployments/deployment" : {
"href" : "http://localhost:9393/streams/deployments/{name}",
"templated" : true
},
"streams/deployments/scale/{streamName}/{appName}/instances/{count}" : {
"href" : "http://localhost:9393/streams/deployments/scale/{streamName}/{appName}/instances/{count}",
"templated" : true
},
"streams/logs" : {
"href" : "http://localhost:9393/streams/logs"
},
"streams/logs/{streamName}" : {
"href" : "http://localhost:9393/streams/logs/{streamName}",
"templated" : true
},
"streams/logs/{streamName}/{appName}" : {
"href" : "http://localhost:9393/streams/logs/{streamName}/{appName}",
"templated" : true
},
"tasks/platforms" : {
"href" : "http://localhost:9393/tasks/platforms"
},
"tasks/definitions" : {
"href" : "http://localhost:9393/tasks/definitions"
},
"tasks/definitions/definition" : {
"href" : "http://localhost:9393/tasks/definitions/{name}",
"templated" : true
},
"tasks/executions" : {
"href" : "http://localhost:9393/tasks/executions"
},
"tasks/executions/name" : {
"href" : "http://localhost:9393/tasks/executions{?name}",
"templated" : true
},
"tasks/executions/current" : {
"href" : "http://localhost:9393/tasks/executions/current"
},
"tasks/executions/execution" : {
"href" : "http://localhost:9393/tasks/executions/{id}",
"templated" : true
},
"tasks/validation" : {
"href" : "http://localhost:9393/tasks/validation/{name}",
"templated" : true
},
"tasks/info/executions" : {
"href" : "http://localhost:9393/tasks/info/executions{?completed,name}",
"templated" : true
},
"tasks/logs" : {
"href" : "http://localhost:9393/tasks/logs/{taskExternalExecutionId}{?platformName}",
"templated" : true
},
"tasks/schedules" : {
"href" : "http://localhost:9393/tasks/schedules"
},
"tasks/schedules/instances" : {
"href" : "http://localhost:9393/tasks/schedules/instances/{taskDefinitionName}",
"templated" : true
},
"jobs/executions" : {
"href" : "http://localhost:9393/jobs/executions"
},
"jobs/executions/name" : {
"href" : "http://localhost:9393/jobs/executions{?name}",
"templated" : true
},
"jobs/executions/status" : {
"href" : "http://localhost:9393/jobs/executions{?status}",
"templated" : true
},
"jobs/executions/execution" : {
"href" : "http://localhost:9393/jobs/executions/{id}",
"templated" : true
},
"jobs/executions/execution/steps" : {
"href" : "http://localhost:9393/jobs/executions/{jobExecutionId}/steps",
"templated" : true
},
"jobs/executions/execution/steps/step" : {
"href" : "http://localhost:9393/jobs/executions/{jobExecutionId}/steps/{stepId}",
"templated" : true
},
"jobs/executions/execution/steps/step/progress" : {
"href" : "http://localhost:9393/jobs/executions/{jobExecutionId}/steps/{stepId}/progress",
"templated" : true
},
"jobs/instances/name" : {
"href" : "http://localhost:9393/jobs/instances{?name}",
"templated" : true
},
"jobs/instances/instance" : {
"href" : "http://localhost:9393/jobs/instances/{id}",
"templated" : true
},
"tools/parseTaskTextToGraph" : {
"href" : "http://localhost:9393/tools"
},
"tools/convertTaskGraphToText" : {
"href" : "http://localhost:9393/tools"
},
"jobs/thinexecutions" : {
"href" : "http://localhost:9393/jobs/thinexecutions"
},
"jobs/thinexecutions/name" : {
"href" : "http://localhost:9393/jobs/thinexecutions{?name}",
"templated" : true
},
"jobs/thinexecutions/jobInstanceId" : {
"href" : "http://localhost:9393/jobs/thinexecutions{?jobInstanceId}",
"templated" : true
},
"jobs/thinexecutions/taskExecutionId" : {
"href" : "http://localhost:9393/jobs/thinexecutions{?taskExecutionId}",
"templated" : true
},
"apps" : {
"href" : "http://localhost:9393/apps"
},
"about" : {
"href" : "http://localhost:9393/about"
},
"completions/stream" : {
"href" : "http://localhost:9393/completions/stream{?start,detailLevel}",
"templated" : true
},
"completions/task" : {
"href" : "http://localhost:9393/completions/task{?start,detailLevel}",
"templated" : true
}
},
"api.revision" : 14
}

索引的主要元素是链接,因为它们允许您遍历 API 并执行所需的功能:

​about​

访问元信息,包括启用的功能、安全信息、版本信息

​dashboard​

访问仪表板 UI

​audit-records​

提供审核跟踪信息

​apps​

处理已注册的应用程序

​completions/stream​

公开流的 DSL 完成功能

​completions/task​

公开任务的 DSL 完成功能

​jobs/executions​

提供作业执行资源

​jobs/thinexecutions​

提供不包含步骤执行的作业执行精简资源

​jobs/executions/execution​

提供特定作业执行的详细信息

​jobs/executions/execution/steps​

提供作业执行的步骤

​jobs/executions/execution/steps/step​

返回特定步骤的详细信息

​jobs/executions/execution/steps/step/progress​

提供特定步骤的进度信息

​jobs/executions/name​

按作业名称检索作业执行

​jobs/executions/status​

按作业状态检索作业执行

​jobs/thinexecutions/name​

按作业名称检索作业执行,不包括步骤执行

​jobs/thinexecutions/jobInstanceId​

按作业实例 ID 检索作业执行,不包括步骤执行

​jobs/thinexecutions/taskExecutionId​

按任务执行 ID 检索作业执行,不包括步骤执行

​jobs/instances/instance​

为特定作业实例提供作业实例资源

​jobs/instances/name​

为特定作业名称提供作业实例资源

​runtime/streams​

公开流运行时状态

​runtime/streams/{streamNames}​

公开给定流名称的流运行时状态

​runtime/apps​

提供运行时应用程序资源

​runtime/apps/{appId}​

公开特定应用的运行时状态

​runtime/apps/{appId}/instances​

提供应用实例的状态

​runtime/apps/{appId}/instances/{instanceId}​

提供特定应用实例的状态

​tasks/definitions​

提供任务定义资源

​tasks/definitions/definition​

提供特定任务定义的详细信息

​tasks/validation​

提供任务定义的验证

​tasks/executions​

返回任务执行并允许启动任务

​tasks/executions/current​

提供正在运行的任务的当前计数

​tasks/info/executions​

提供任务执行信息

​tasks/schedules​

提供任务的日程安排信息

​tasks/schedules/instances​

提供特定任务的计划信息

​tasks/executions/name​

返回给定任务名称的所有任务执行

​tasks/executions/execution​

提供特定任务执行的详细信息

​tasks/platforms​

提供用于启动任务的平台帐户。可以通过添加请求参数“schedulesEnabled=true ”来筛选结果以显示支持调度的平台

​tasks/logs​

检索任务应用程序日志

​streams/definitions​

公开流资源

​streams/definitions/definition​

处理特定流定义

​streams/validation​

提供流定义的验证

​streams/deployments​

提供流部署操作

​streams/deployments/{name}​

请求流定义的部署信息

​streams/deployments/{name}{?reuse-deployment-properties}​

请求流定义的部署信息

​streams/deployments/deployment​

请求(取消)部署现有流定义

​streams/deployments/manifest/{name}/{version}​

返回发布版本的清单信息

​streams/deployments/history/{name}​

获取流的部署历史记录作为此版本的列表或版本

​streams/deployments/rollback/{name}/{version}​

将流回滚到流的先前版本或特定版本

​streams/deployments/update/{name}​

​streams/deployments/platform/list​

支持的部署平台列表

​streams/deployments/scale/{streamName}/{appName}/instances/{count}​

纵向扩展或缩减所选流的应用程序实例数

​streams/logs​

检索流的应用程序日志

​streams/logs/{streamName}​

检索流的应用程序日志

​streams/logs/{streamName}/{appName}​

检索流的特定应用程序日志

​tools/parseTaskTextToGraph​

将任务定义解析为图形结构

​tools/convertTaskGraphToText​

将图形格式转换为 DSL 文本格式

44.2. 服务器元信息

服务器元信息端点提供有关服务器本身的更多信息。 以下主题提供了更多详细信息:

  • 检索有关服务器的信息

44.2.1. 检索有关服务器的信息

Arequest 返回 Spring Cloud 数据流的元信息,包括:​​GET​

  • 运行时环境信息
  • 有关启用哪些功能的信息
  • 春云数据流服务器的依赖信息
GET /about HTTP/1.1
Accept: application/json
Host: localhost:9393
$ curl 'http://localhost:9393/about' -i -X GET \
-H 'Accept: application/json'
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2601

{
"featureInfo" : {
"analyticsEnabled" : true,
"streamsEnabled" : true,
"tasksEnabled" : true,
"schedulesEnabled" : true,
"monitoringDashboardType" : "NONE"
},
"versionInfo" : {
"implementation" : {
"name" : "${info.app.name}",
"version" : "${info.app.version}"
},
"core" : {
"name" : "Spring Cloud Data Flow Core",
"version" : "2.9.6"
},
"dashboard" : {
"name" : "Spring Cloud Dataflow UI",
"version" : "3.2.6"
},
"shell" : {
"name" : "Spring Cloud Data Flow Shell",
"version" : "2.9.6",
"url" : "https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dataflow-shell/2.9.6/spring-cloud-dataflow-shell-2.9.6.jar"
}
},
"securityInfo" : {
"authenticationEnabled" : false,
"authenticated" : false,
"username" : null,
"roles" : [ ]
},
"runtimeEnvironment" : {
"appDeployer" : {
"deployerImplementationVersion" : "Test Version",
"deployerName" : "Test Server",
"deployerSpiVersion" : "2.8.6",
"javaVersion" : "1.8.0_345",
"platformApiVersion" : "",
"platformClientVersion" : "",
"platformHostVersion" : "",
"platformSpecificInfo" : {
"default" : "local"
},
"platformType" : "Skipper Managed",
"springBootVersion" : "2.5.14",
"springVersion" : "5.3.20"
},
"taskLaunchers" : [ {
"deployerImplementationVersion" : "2.7.6",
"deployerName" : "LocalTaskLauncher",
"deployerSpiVersion" : "2.7.6",
"javaVersion" : "1.8.0_345",
"platformApiVersion" : "Linux 5.15.0-1019-azure",
"platformClientVersion" : "5.15.0-1019-azure",
"platformHostVersion" : "5.15.0-1019-azure",
"platformSpecificInfo" : { },
"platformType" : "Local",
"springBootVersion" : "2.5.14",
"springVersion" : "5.3.20"
}, {
"deployerImplementationVersion" : "2.7.6",
"deployerName" : "LocalTaskLauncher",
"deployerSpiVersion" : "2.7.6",
"javaVersion" : "1.8.0_345",
"platformApiVersion" : "Linux 5.15.0-1019-azure",
"platformClientVersion" : "5.15.0-1019-azure",
"platformHostVersion" : "5.15.0-1019-azure",
"platformSpecificInfo" : { },
"platformType" : "Local",
"springBootVersion" : "2.5.14",
"springVersion" : "5.3.20"
} ]
},
"monitoringDashboardInfo" : {
"url" : "",
"refreshInterval" : 15,
"dashboardType" : "NONE",
"source" : "default-scdf-source"
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/about"
}
}
}

44.3. 注册的应用程序

已注册的应用程序端点提供有关已注册到 Spring 云数据流服务器的应用程序的信息。 以下主题提供了更多详细信息:

  • 获取有关特定应用程序的信息
  • 注册新应用程序
  • 使用版本注册新应用程序
  • 批量注册应用程序
  • 设置默认应用程序版本
  • 取消注册应用程序
  • 取消注册所有应用程序

44.3.1. 列出应用程序

Arequest列出了Spring Cloud Data Flow已知的所有应用程序。 以下主题提供了更多详细信息:GET

GET /apps?search=&type=source&defaultVersion=true&page=0&size=10&sort=name%2CASC HTTP/1.1
Accept: application/json
Host: localhost:9393

​search​

对名称执行的搜索字符串(可选)

​type​

将返回的应用限制为应用的类型。[应用、源、处理器、接收器、任务]之一

​defaultVersion​

要设置为仅检索默认版本的应用的布尔标志(可选)

​page​

从零开始的页码(可选)

​sort​

列表上的排序(可选)

​size​

请求的页面大小(可选)

$ curl 'http://localhost:9393/apps?search=&type=source&defaultVersion=true&page=0&size=10&sort=name%2CASC' -i -X GET \
-H 'Accept: application/json'
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1097

{
"_embedded" : {
"appRegistrationResourceList" : [ {
"name" : "http",
"type" : "source",
"uri" : "maven://org.springframework.cloud.stream.app:http-source-rabbit:1.2.0.RELEASE",
"version" : "1.2.0.RELEASE",
"defaultVersion" : true,
"versions" : [ "1.2.0.RELEASE" ],
"label" : null,
"_links" : {
"self" : {
"href" : "http://localhost:9393/apps/source/http/1.2.0.RELEASE"
}
}
}, {
"name" : "time",
"type" : "source",
"uri" : "maven://org.springframework.cloud.stream.app:time-source-rabbit:1.2.0.RELEASE",
"version" : "1.2.0.RELEASE",
"defaultVersion" : true,
"versions" : [ "1.2.0.RELEASE" ],
"label" : null,
"_links" : {
"self" : {
"href" : "http://localhost:9393/apps/source/time/1.2.0.RELEASE"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/apps?page=0&size=10&sort=name,asc"
}
},
"page" : {
"size" : 10,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}

44.3.2. 获取特定应用程序的信息

请求获取有关特定应用程序的信息。 以下主题提供了更多详细信息:​​GET​​​​/apps/<type>/<name>​

GET /apps/source/http?exhaustive=false HTTP/1.1
Accept: application/json
Host: localhost:9393

​exhaustive​

返回所有应用程序属性,包括常见的 Spring 引导属性

/apps/{type}/{name}

​type​

要查询的应用程序的类型。[应用、源、处理器、接收器、任务]之一

​name​

要查询的应用程序的名称

$ curl 'http://localhost:9393/apps/source/http?exhaustive=false' -i -X GET \
-H 'Accept: application/json'
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2100

{
"name" : "http",
"type" : "source",
"uri" : "maven://org.springframework.cloud.stream.app:http-source-rabbit:1.2.0.RELEASE",
"version" : "1.2.0.RELEASE",
"defaultVersion" : true,
"versions" : null,
"label" : null,
"options" : [ {
"id" : "http.path-pattern",
"name" : "path-pattern",
"type" : "java.lang.String",
"description" : "An Ant-Style pattern to determine which http requests will be captured.",
"shortDescription" : "An Ant-Style pattern to determine which http requests will be captured.",
"defaultValue" : "/",
"hints" : {
"keyHints" : [ ],
"keyProviders" : [ ],
"valueHints" : [ ],
"valueProviders" : [ ]
},
"deprecation" : null,
"deprecated" : false
}, {
"id" : "http.mapped-request-headers",
"name" : "mapped-request-headers",
"type" : "java.lang.String[]",
"description" : "Headers that will be mapped.",
"shortDescription" : "Headers that will be mapped.",
"defaultValue" : null,
"hints" : {
"keyHints" : [ ],
"keyProviders" : [ ],
"valueHints" : [ ],
"valueProviders" : [ ]
},
"deprecation" : null,
"deprecated" : false
}, {
"id" : "http.secured",
"name" : "secured",
"type" : "java.lang.Boolean",
"description" : "Secure or not HTTP source path.",
"shortDescription" : "Secure or not HTTP source path.",
"defaultValue" : false,
"hints" : {
"keyHints" : [ ],
"keyProviders" : [ ],
"valueHints" : [ ],
"valueProviders" : [ ]
},
"deprecation" : null,
"deprecated" : false
}, {
"id" : "server.port",
"name" : "port",
"type" : "java.lang.Integer",
"description" : "Server HTTP port.",
"shortDescription" : "Server HTTP port.",
"defaultValue" : null,
"hints" : {
"keyHints" : [ ],
"keyProviders" : [ ],
"valueHints" : [ ],
"valueProviders" : [ ]
},
"deprecation" : null,
"deprecated" : false
} ],
"shortDescription" : null,
"inboundPortNames" : [ ],
"outboundPortNames" : [ ],
"optionGroups" : { }
}

44.3.3. 注册新应用程序

请求允许注册新应用程序。 以下主题提供了更多详细信息:​​POST​​​​/apps/<type>/<name>​

POST /apps/source/http HTTP/1.1
Host: localhost:9393
Content-Type: application/x-www-form-urlencoded

uri=maven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE

​uri​

应用程序位所在的 URI

​metadata-uri​

可在其中找到应用程序元数据 jar 的 URI

​force​

如果已存在具有相同名称和类型的注册,则必须为 true,否则将发生错误

/apps/{type}/{name}

​type​

要注册的应用程序的类型。[应用、源、处理器、接收器、任务]之一

​name​

要注册的应用程序的名称

$ curl 'http://localhost:9393/apps/source/http' -i -X POST \
-d 'uri=maven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE'
HTTP/1.1 201 Created

44.3.4. 使用版本注册新应用程序

请求允许注册新应用程序。 以下主题提供了更多详细信息:​​POST​​​​/apps/<type>/<name>/<version>​

POST /apps/source/http/1.1.0.RELEASE HTTP/1.1
Host: localhost:9393
Content-Type: application/x-www-form-urlencoded

uri=maven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE

​uri​

应用程序位所在的 URI

​metadata-uri​

可在其中找到应用程序元数据 jar 的 URI

​force​

如果已存在具有相同名称和类型的注册,则必须为 true,否则将发生错误

/apps/{type}/{name}/{version:.+}

​type​

要注册的应用程序的类型。[应用、源、处理器、接收器、任务]之一(可选)

​name​

要注册的应用程序的名称

​version​

要注册的应用程序的版本

$ curl 'http://localhost:9393/apps/source/http/1.1.0.RELEASE' -i -X POST \
-d 'uri=maven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE'
HTTP/1.1 201 Created

44.3.5. 批量注册应用程序

请求允许一次注册多个应用程序。 以下主题提供了更多详细信息:​​POST​​​​/apps​

POST /apps HTTP/1.1
Host: localhost:9393
Content-Type: application/x-www-form-urlencoded

apps=source.http%3Dmaven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE&force=false

​uri​

URI,可在其中提取包含注册的属性文件。独家与。​​apps​

​apps​

内联注册集。独家与。​​uri​

​force​

如果已存在具有相同名称和类型的注册,则必须为 true,否则将发生错误

$ curl 'http://localhost:9393/apps' -i -X POST \
-d 'apps=source.http%3Dmaven%3A%2F%2Forg.springframework.cloud.stream.app%3Ahttp-source-rabbit%3A1.1.0.RELEASE&force=false'
HTTP/1.1 201 Created
Content-Type: application/hal+json
Content-Length: 658

{
"_embedded" : {
"appRegistrationResourceList" : [ {
"name" : "http",
"type" : "source",
"uri" : "maven://org.springframework.cloud.stream.app:http-source-rabbit:1.1.0.RELEASE",
"version" : "1.1.0.RELEASE",
"defaultVersion" : true,
"versions" : null,
"label" : null,
"_links" : {
"self" : {
"href" : "http://localhost:9393/apps/source/http/1.1.0.RELEASE"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/apps?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}

44.3.6. 设置默认应用程序版本

对于具有相同和的应用程序,您可以注册多个版本。 在这种情况下,您可以选择其中一个版本作为默认应用程序。nametype

以下主题提供了更多详细信息:

PUT /apps/source/http/1.2.0.RELEASE HTTP/1.1
Accept: application/json
Host: localhost:9393

/apps/{type}/{name}/{version:.+}

​type​

应用程序的类型。[应用、源、处理器、接收器、任务]之一

​name​

应用程序的名称

​version​

应用程序的版本

$ curl 'http://localhost:9393/apps/source/http/1.2.0.RELEASE' -i -X PUT \
-H 'Accept: application/json'
HTTP/1.1 202 Accepted

44.3.7. 注销应用程序

请求取消注册以前注册的应用程序。 以下主题提供了更多详细信息:​​DELETE​​​​/apps/<type>/<name>​

DELETE /apps/source/http/1.2.0.RELEASE HTTP/1.1
Host: localhost:9393

/apps/{type}/{name}/{version}

​type​

要注销的应用程序的类型。[应用、源、处理器、接收器、任务]之一

​name​

要注销的应用程序的名称

​version​

要注销的应用程序的版本(可选)

$ curl 'http://localhost:9393/apps/source/http/1.2.0.RELEASE' -i -X DELETE
HTTP/1.1 200 OK

44.3.8. 注销所有应用程序

请求取消注册所有应用程序。 以下主题提供了更多详细信息:​​DELETE​​​​/apps​

DELETE /apps HTTP/1.1
Host: localhost:9393
$ curl 'http://localhost:9393/apps' -i -X DELETE
HTTP/1.1 200 OK

44.4. 审计记录

审核记录终结点提供有关审核记录的信息。以下主题提供了更多详细信息:

  • 列出所有审核记录
  • 检索审核记录详细信息
  • 列出所有审核操作类型
  • 列出所有审核操作类型

44.4.1. 列出所有审计记录

审核记录终结点允许您检索审核跟踪信息。

以下主题提供了更多详细信息:

GET /audit-records?page=0&size=10&operations=STREAM&actions=CREATE&fromDate=2000-01-01T00%3A00%3A00&toDate=2099-01-01T00%3A00%3A00 HTTP/1.1
Host: localhost:9393

​page​

从零开始的页码(可选)

​size​

请求的页面大小(可选)

​operations​

以逗号分隔的审核操作列表(可选)

​actions​

以逗号分隔的审核操作列表(可选)

​fromDate​

从日期筛选器(例如:2019-02-03T00:00:30)(可选)

​toDate​

迄今为止的筛选器(例如:2019-02-03T00:00:30)(可选)

$ curl 'http://localhost:9393/audit-records?page=0&size=10&operations=STREAM&actions=CREATE&fromDate=2000-01-01T00%3A00%3A00&toDate=2099-01-01T00%3A00%3A00' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 680

{
"_embedded" : {
"auditRecordResourceList" : [ {
"auditRecordId" : 5,
"createdBy" : null,
"correlationId" : "timelog",
"auditData" : "time --format='YYYY MM DD' | log",
"createdOn" : "2022-09-13T10:53:13.261Z",
"auditAction" : "CREATE",
"auditOperation" : "STREAM",
"platformName" : null,
"_links" : {
"self" : {
"href" : "http://localhost:9393/audit-records/5"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/audit-records?page=0&size=10"
}
},
"page" : {
"size" : 10,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}

44.4.2. 检索审计记录详细信息

审核记录终结点允许获取单个审核记录。以下主题提供了更多详细信息:

GET /audit-records/5 HTTP/1.1
Host: localhost:9393

/audit-records/{id}

​id​

要查询的审核记录的 ID(必填)

$ curl 'http://localhost:9393/audit-records/5' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 354

{
"auditRecordId" : 5,
"createdBy" : null,
"correlationId" : "timelog",
"auditData" : "time --format='YYYY MM DD' | log",
"createdOn" : "2022-09-13T10:53:13.261Z",
"auditAction" : "CREATE",
"auditOperation" : "STREAM",
"platformName" : null,
"_links" : {
"self" : {
"href" : "http://localhost:9393/audit-records/5"
}
}
}

44.4.3. 列出所有审计操作类型

审核记录终结点允许获取操作类型。以下主题提供了更多详细信息:

GET /audit-records/audit-action-types HTTP/1.1
Host: localhost:9393
$ curl 'http://localhost:9393/audit-records/audit-action-types' -i -X GET
Response Structure
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1111

[ {
"id" : 100,
"name" : "Create",
"description" : "Create an Entity",
"key" : "CREATE",
"nameWithDescription" : "Create (Create an Entity)"
}, {
"id" : 200,
"name" : "Delete",
"description" : "Delete an Entity",
"key" : "DELETE",
"nameWithDescription" : "Delete (Delete an Entity)"
}, {
"id" : 300,
"name" : "Deploy",
"description" : "Deploy an Entity",
"key" : "DEPLOY",
"nameWithDescription" : "Deploy (Deploy an Entity)"
}, {
"id" : 400,
"name" : "Rollback",
"description" : "Rollback an Entity",
"key" : "ROLLBACK",
"nameWithDescription" : "Rollback (Rollback an Entity)"
}, {
"id" : 500,
"name" : "Undeploy",
"description" : "Undeploy an Entity",
"key" : "UNDEPLOY",
"nameWithDescription" : "Undeploy (Undeploy an Entity)"
}, {
"id" : 600,
"name" : "Update",
"description" : "Update an Entity",
"key" : "UPDATE",
"nameWithDescription" : "Update (Update an Entity)"
}, {
"id" : 700,
"name" : "SuccessfulLogin",
"description" : "Successful login",
"key" : "LOGIN_SUCCESS",
"nameWithDescription" : "SuccessfulLogin (Successful login)"
} ]

44.4.4. 列出所有审计操作类型

审核记录终结点允许你获取操作类型。以下主题提供了更多详细信息:

GET /audit-records/audit-operation-types HTTP/1.1
Host: localhost:9393
$ curl 'http://localhost:9393/audit-records/audit-operation-types' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 315

[ {
"id" : 100,
"name" : "App Registration",
"key" : "APP_REGISTRATION"
}, {
"id" : 200,
"name" : "Schedule",
"key" : "SCHEDULE"
}, {
"id" : 300,
"name" : "Stream",
"key" : "STREAM"
}, {
"id" : 400,
"name" : "Task",
"key" : "TASK"
}, {
"id" : 500,
"name" : "Login",
"key" : "LOGIN"
} ]

44.5. 流定义

已注册的应用程序端点提供有关向 Spring 云数据流服务器注册的流定义的信息。 以下主题提供了更多详细信息:

  • 创建新的流定义
  • 列出所有流定义
  • 列出相关流定义
  • 检索流定义详细信息
  • 删除单个流定义
  • 删除所有流定义
  • 部署流定义
  • 取消部署流定义
  • 取消部署所有流定义

44.5.1. 创建新的流定义

创建流定义是通过创建对流定义终结点的 POST 请求来实现的。 流的 curl 请求可能类似于以下内容:​​ticktock​

curl -X POST -d "name=ticktock&definition=time | log" localhost:9393/streams/definitions?deploy=false

流定义还可以包含其他参数。 例如,在“请求结构”下显示的示例中,我们还提供了日期时间格式。

以下主题提供了更多详细信息:

POST /streams/definitions HTTP/1.1
Host: localhost:9393
Content-Type: application/x-www-form-urlencoded

name=timelog&definition=time+--format%3D%27YYYY+MM+DD%27+%7C+log&description=Demo+stream+for+testing&deploy=false

​name​

创建的任务定义的名称

​definition​

使用数据流 DSL 的流的定义

​description​

流定义的说明

​deploy​

如果为 true,则在创建时部署流(默认值为 false)

$ curl 'http://localhost:9393/streams/definitions' -i -X POST \
-d 'name=timelog&definition=time+--format%3D%27YYYY+MM+DD%27+%7C+log&description=Demo+stream+for+testing&deploy=false'
HTTP/1.1 201 Created
Content-Type: application/hal+json
Content-Length: 410

{
"name" : "timelog",
"dslText" : "time --format='YYYY MM DD' | log",
"originalDslText" : "time --format='YYYY MM DD' | log",
"status" : "undeployed",
"description" : "Demo stream for testing",
"statusDescription" : "The app or group is known to the system, but is not currently deployed",
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/timelog"
}
}
}

44.5.2. 列出所有流定义

流终结点允许您列出所有流定义。 以下主题提供了更多详细信息:

GET /streams/definitions?page=0&sort=name%2CASC&search=&size=10 HTTP/1.1
Host: localhost:9393

​page​

从零开始的页码(可选)

​search​

对名称执行的搜索字符串(可选)

​sort​

列表上的排序(可选)

​size​

请求的页面大小(可选)

$ curl 'http://localhost:9393/streams/definitions?page=0&sort=name%2CASC&search=&size=10' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 1160

{
"_embedded" : {
"streamDefinitionResourceList" : [ {
"name" : "mysamplestream",
"dslText" : "time | log",
"originalDslText" : "time | log",
"status" : "undeployed",
"description" : "",
"statusDescription" : "The app or group is known to the system, but is not currently deployed",
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/mysamplestream"
}
}
}, {
"name" : "timelog",
"dslText" : "time --format='YYYY MM DD' | log",
"originalDslText" : "time --format='YYYY MM DD' | log",
"status" : "undeployed",
"description" : "Demo stream for testing",
"statusDescription" : "The app or group is known to the system, but is not currently deployed",
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/timelog"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions?page=0&size=10&sort=name,asc"
}
},
"page" : {
"size" : 10,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}

44.5.3. 列出相关的流定义

流终结点允许您列出相关的流定义。 以下主题提供了更多详细信息:

GET /streams/definitions/timelog/related?page=0&sort=name%2CASC&search=&size=10&nested=true HTTP/1.1
Host: localhost:9393

​nested​

我们是否应该递归地查找相关流定义的ByTaskNameContains(可选)

​page​

从零开始的页码(可选)

​search​

对名称执行的搜索字符串(可选)

​sort​

列表上的排序(可选)

​size​

请求的页面大小(可选)

$ curl 'http://localhost:9393/streams/definitions/timelog/related?page=0&sort=name%2CASC&search=&size=10&nested=true' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 769

{
"_embedded" : {
"streamDefinitionResourceList" : [ {
"name" : "timelog",
"dslText" : "time --format='YYYY MM DD' | log",
"originalDslText" : "time --format='YYYY MM DD' | log",
"status" : "undeployed",
"description" : "Demo stream for testing",
"statusDescription" : "The app or group is known to the system, but is not currently deployed",
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/timelog"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/timelog/related?page=0&size=10&sort=name,asc"
}
},
"page" : {
"size" : 10,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}

44.5.4. 检索流定义详细信息

流定义终结点允许获取单个流定义。 以下主题提供了更多详细信息:

GET /streams/definitions/timelog HTTP/1.1
Host: localhost:9393

/streams/definitions/{name}

​name​

要查询的流定义的名称(必需)

$ curl 'http://localhost:9393/streams/definitions/timelog' -i -X GET
HTTP/1.1 200 OK
Content-Type: application/hal+json
Content-Length: 410

{
"name" : "timelog",
"dslText" : "time --format='YYYY MM DD' | log",
"originalDslText" : "time --format='YYYY MM DD' | log",
"status" : "undeployed",
"description" : "Demo stream for testing",
"statusDescription" : "The app or group is known to the system, but is not currently deployed",
"_links" : {
"self" : {
"href" : "http://localhost:9393/streams/definitions/timelog"
}
}
}
  • 打赏
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK