-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Action and WorkflowRule definitions (#554)
<!-- Describe what has changed in this PR --> **What changed?** * Add Action proto definition * Add WorkflowRuleSpec/WorkflowRule proto definitions <!-- Tell your future self why have you made these changes --> **Why?** Part of WorkflowRules workstream. Changes are reviewed in [this PR](#554)
- Loading branch information
1 parent
add5b50
commit e942bf1
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2025 Temporal Technologies Inc. All rights reserved. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
syntax = "proto3"; | ||
|
||
package temporal.api.rules.v1; | ||
|
||
option go_package = "go.temporal.io/api/rules/v1;rules"; | ||
option java_package = "io.temporal.api.rules.v1"; | ||
option java_multiple_files = true; | ||
option java_outer_classname = "MessageProto"; | ||
option ruby_package = "Temporalio::Api::Rules::V1"; | ||
option csharp_namespace = "Temporalio.Api.Rules.V1"; | ||
|
||
|
||
import "google/protobuf/timestamp.proto"; | ||
import "temporal/api/enums/v1/common.proto"; | ||
|
||
message Action { | ||
// Pause action. | ||
message ActionPause { | ||
// Indicates what should be paused. Depending on the scope value, the action | ||
// will pause the entire workflow or a specific activity (additional entities | ||
// may be supported in the future). | ||
temporal.api.enums.v1.RuleActionScope scope = 1; | ||
} | ||
|
||
// Supported actions. | ||
oneof variant { | ||
ActionPause pause = 1; | ||
} | ||
} | ||
|
||
message WorkflowRuleSpec { | ||
// The id of the new workflow rule. Must be unique within the namespace. | ||
string id = 1; | ||
|
||
// Activity trigger will be triggered when an activity is about to start. | ||
message ActivityStartTrigger { | ||
// Activity predicate is used to match against workflow data, based on rule trigger type. | ||
// The following activity attributes are supported as part of the predicate: | ||
// - ActivityType: The type of the activity. | ||
// - ActivityId: The ID of the activity. | ||
// - ActivityAttempt: The number attempts of the activity. | ||
// - BackoffInterval: The current backoff interval of the activity. | ||
// - ActivityStatus: The status of the activity. Can be one of "scheduled", "started", "paused". | ||
// - TaskQueue: The name of the task queue of the activity. | ||
string predicate = 1; | ||
} | ||
|
||
// Specifies how the rule should be triggered and evaluated. | ||
// Currently, only "activity start" type is supported. | ||
oneof trigger { | ||
ActivityStartTrigger activity_start = 2; | ||
} | ||
|
||
// Restricted Visibility query. | ||
// The following activity attributes are supported as part of the predicate: | ||
// - WorkflowType | ||
// - WorkflowId | ||
// - StartTime | ||
// - ExecutionStatus | ||
string visibility_query = 3; | ||
|
||
// Action to be taken when the rule is triggered and predicate is matched. | ||
repeated Action actions = 4; | ||
|
||
// Expiration time of the rule. After this time, the rule will be deleted. | ||
// Can be empty if the rule should never expire. | ||
google.protobuf.Timestamp expiration_time = 5; | ||
} | ||
|
||
// WorkflowRule describes a rule that can be applied to any workflow in this namespace. | ||
message WorkflowRule { | ||
// Rule creation date. | ||
google.protobuf.Timestamp create_time = 1; | ||
|
||
// Rule specification | ||
WorkflowRuleSpec spec = 2; | ||
} |