diff --git a/discovery/workflowexecutions-v1.json b/discovery/workflowexecutions-v1.json index a4dcac91f0..f34e725c05 100644 --- a/discovery/workflowexecutions-v1.json +++ b/discovery/workflowexecutions-v1.json @@ -110,6 +110,36 @@ "locations": { "resources": { "workflows": { + "methods": { + "triggerPubsubExecution": { + "description": "Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.", + "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/workflows/{workflowsId}:triggerPubsubExecution", + "httpMethod": "POST", + "id": "workflowexecutions.projects.locations.workflows.triggerPubsubExecution", + "parameterOrder": [ + "workflow" + ], + "parameters": { + "workflow": { + "description": "Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow}", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+/workflows/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v1/{+workflow}:triggerPubsubExecution", + "request": { + "$ref": "TriggerPubsubExecutionRequest" + }, + "response": { + "$ref": "Execution" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + }, "resources": { "executions": { "methods": { @@ -269,7 +299,7 @@ } } }, - "revision": "20211019", + "revision": "20220315", "rootUrl": "https://workflowexecutions.googleapis.com/", "schemas": { "CancelExecutionRequest": { @@ -413,6 +443,38 @@ }, "type": "object" }, + "PubsubMessage": { + "description": "A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits.", + "id": "PubsubMessage", + "properties": { + "attributes": { + "additionalProperties": { + "type": "string" + }, + "description": "Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.", + "type": "object" + }, + "data": { + "description": "The message data field. If this field is empty, the message must contain at least one attribute.", + "format": "byte", + "type": "string" + }, + "messageId": { + "description": "ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.", + "type": "string" + }, + "orderingKey": { + "description": "If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value.", + "type": "string" + }, + "publishTime": { + "description": "The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.", + "format": "google-datetime", + "type": "string" + } + }, + "type": "object" + }, "StackTrace": { "description": "A collection of stack elements (frames) where an error occurred.", "id": "StackTrace", @@ -445,6 +507,25 @@ } }, "type": "object" + }, + "TriggerPubsubExecutionRequest": { + "description": "Request for the TriggerPubsubExecution method.", + "id": "TriggerPubsubExecutionRequest", + "properties": { + "GCPCloudEventsMode": { + "description": "Required. LINT: LEGACY_NAMES The query parameter value for __GCP_CloudEventsMode, set by the Eventarc service when configuring triggers.", + "type": "string" + }, + "message": { + "$ref": "PubsubMessage", + "description": "Required. The message of the Pub/Sub push notification." + }, + "subscription": { + "description": "Required. The subscription of the Pub/Sub push notification. Format: projects/{project}/subscriptions/{sub}", + "type": "string" + } + }, + "type": "object" } }, "servicePath": "", diff --git a/src/apis/workflowexecutions/v1.ts b/src/apis/workflowexecutions/v1.ts index c94a28ffe5..47a471d596 100644 --- a/src/apis/workflowexecutions/v1.ts +++ b/src/apis/workflowexecutions/v1.ts @@ -217,6 +217,31 @@ export namespace workflowexecutions_v1 { */ line?: string | null; } + /** + * A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits. + */ + export interface Schema$PubsubMessage { + /** + * Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription. + */ + attributes?: {[key: string]: string} | null; + /** + * The message data field. If this field is empty, the message must contain at least one attribute. + */ + data?: string | null; + /** + * ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call. + */ + messageId?: string | null; + /** + * If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. + */ + orderingKey?: string | null; + /** + * The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call. + */ + publishTime?: string | null; + } /** * A collection of stack elements (frames) where an error occurred. */ @@ -243,6 +268,23 @@ export namespace workflowexecutions_v1 { */ step?: string | null; } + /** + * Request for the TriggerPubsubExecution method. + */ + export interface Schema$TriggerPubsubExecutionRequest { + /** + * Required. LINT: LEGACY_NAMES The query parameter value for __GCP_CloudEventsMode, set by the Eventarc service when configuring triggers. + */ + GCPCloudEventsMode?: string | null; + /** + * Required. The message of the Pub/Sub push notification. + */ + message?: Schema$PubsubMessage; + /** + * Required. The subscription of the Pub/Sub push notification. Format: projects/{project\}/subscriptions/{sub\} + */ + subscription?: string | null; + } export class Resource$Projects { context: APIRequestContext; @@ -271,6 +313,174 @@ export namespace workflowexecutions_v1 { this.context ); } + + /** + * Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification. + * @example + * ```js + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/workflowexecutions.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const workflowexecutions = google.workflowexecutions('v1'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: ['https://www.googleapis.com/auth/cloud-platform'], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = + * await workflowexecutions.projects.locations.workflows.triggerPubsubExecution( + * { + * // Required. Name of the workflow for which an execution should be created. Format: projects/{project\}/locations/{location\}/workflows/{workflow\} + * workflow: + * 'projects/my-project/locations/my-location/workflows/my-workflow', + * + * // Request body metadata + * requestBody: { + * // request body parameters + * // { + * // "GCPCloudEventsMode": "my_GCPCloudEventsMode", + * // "message": {}, + * // "subscription": "my_subscription" + * // } + * }, + * } + * ); + * console.log(res.data); + * + * // Example response + * // { + * // "argument": "my_argument", + * // "callLogLevel": "my_callLogLevel", + * // "endTime": "my_endTime", + * // "error": {}, + * // "name": "my_name", + * // "result": "my_result", + * // "startTime": "my_startTime", + * // "state": "my_state", + * // "workflowRevisionId": "my_workflowRevisionId" + * // } + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * ``` + * + * @param params - Parameters for request + * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. + * @param callback - Optional callback that handles the response. + * @returns A promise if used with async/await, or void if used with a callback. + */ + triggerPubsubExecution( + params: Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution, + options: StreamMethodOptions + ): GaxiosPromise; + triggerPubsubExecution( + params?: Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution, + options?: MethodOptions + ): GaxiosPromise; + triggerPubsubExecution( + params: Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + triggerPubsubExecution( + params: Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution, + options: MethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + triggerPubsubExecution( + params: Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution, + callback: BodyResponseCallback + ): void; + triggerPubsubExecution( + callback: BodyResponseCallback + ): void; + triggerPubsubExecution( + paramsOrCallback?: + | Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): void | GaxiosPromise | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = + {} as Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = + options.rootUrl || 'https://workflowexecutions.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v1/{+workflow}:triggerPubsubExecution').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'POST', + }, + options + ), + params, + requiredParams: ['workflow'], + pathParams: ['workflow'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback + ); + } else { + return createAPIRequest(parameters); + } + } + } + + export interface Params$Resource$Projects$Locations$Workflows$Triggerpubsubexecution + extends StandardParameters { + /** + * Required. Name of the workflow for which an execution should be created. Format: projects/{project\}/locations/{location\}/workflows/{workflow\} + */ + workflow?: string; + + /** + * Request body metadata + */ + requestBody?: Schema$TriggerPubsubExecutionRequest; } export class Resource$Projects$Locations$Workflows$Executions {