From 3ca6451e9b284bfd445f6614c668dbec12b1513a Mon Sep 17 00:00:00 2001 From: Quanzheng Long Date: Tue, 17 Sep 2024 16:23:57 -0700 Subject: [PATCH] Update to latest IDL (add waitForKey and make commandId optional) (#420) --- gen/iwfidl/api/openapi.yaml | 23 ++-- gen/iwfidl/docs/DefaultApi.md | 2 +- gen/iwfidl/docs/InterStateChannelCommand.md | 9 +- gen/iwfidl/docs/InterStateChannelResult.md | 9 +- gen/iwfidl/docs/SignalCommand.md | 9 +- gen/iwfidl/docs/SignalResult.md | 9 +- gen/iwfidl/docs/StateMovement.md | 26 ++++ gen/iwfidl/docs/TimerCommand.md | 9 +- gen/iwfidl/docs/TimerResult.md | 9 +- .../WorkflowWaitForStateCompletionRequest.md | 61 +++++++++- .../model_inter_state_channel_command.go | 41 ++++--- .../model_inter_state_channel_result.go | 35 ++++-- gen/iwfidl/model_signal_command.go | 41 ++++--- gen/iwfidl/model_signal_result.go | 35 ++++-- gen/iwfidl/model_state_movement.go | 36 ++++++ gen/iwfidl/model_timer_command.go | 39 +++--- gen/iwfidl/model_timer_result.go | 35 ++++-- ...kflow_wait_for_state_completion_request.go | 111 +++++++++++++++--- integ/timer_test.go | 6 +- integ/wait_for_state_completion_test.go | 2 +- integ/workflow/any_command_close/routers.go | 4 +- .../any_command_combination/routers.go | 15 ++- integ/workflow/any_timer_signal/routers.go | 2 +- integ/workflow/interstate/routers.go | 5 +- integ/workflow/signal/routers.go | 7 +- integ/workflow/timer/routers.go | 7 +- .../wait_for_state_completion/routers.go | 3 +- iwf-idl | 2 +- service/api/service.go | 8 +- service/interfaces.go | 4 +- service/interpreter/deciderTriggerer.go | 6 +- service/interpreter/workflowImpl.go | 5 +- 32 files changed, 457 insertions(+), 158 deletions(-) diff --git a/gen/iwfidl/api/openapi.yaml b/gen/iwfidl/api/openapi.yaml index 3c991400..f0c16d7e 100644 --- a/gen/iwfidl/api/openapi.yaml +++ b/gen/iwfidl/api/openapi.yaml @@ -1628,6 +1628,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey - stateId: stateId stateOptions: searchAttributesLoadingPolicy: @@ -1695,6 +1696,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey conditionalClose: closeInput: data: data @@ -2084,6 +2086,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey - stateId: stateId stateOptions: searchAttributesLoadingPolicy: @@ -2151,6 +2154,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey conditionalClose: closeInput: data: data @@ -2214,17 +2218,22 @@ components: WorkflowWaitForStateCompletionRequest: example: waitTimeSeconds: 0 + stateId: stateId workflowId: workflowId stateExecutionId: stateExecutionId + waitForKey: waitForKey properties: workflowId: type: string stateExecutionId: type: string + stateId: + type: string + waitForKey: + type: string waitTimeSeconds: type: integer required: - - stateExecutionId - workflowId type: object WorkflowWaitForStateCompletionResponse: @@ -2321,6 +2330,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey - stateId: stateId stateOptions: searchAttributesLoadingPolicy: @@ -2388,6 +2398,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey conditionalClose: closeInput: data: data @@ -2492,6 +2503,7 @@ components: stateInput: data: data encoding: encoding + waitForKey: waitForKey properties: stateId: type: string @@ -2499,6 +2511,8 @@ components: $ref: '#/components/schemas/EncodedObject' stateOptions: $ref: '#/components/schemas/WorkflowStateOptions' + waitForKey: + type: string required: - stateId type: object @@ -2647,8 +2661,6 @@ components: durationSeconds: format: int64 type: integer - required: - - commandId type: object SignalCommand: example: @@ -2666,7 +2678,6 @@ components: atMost: type: integer required: - - commandId - signalChannelName type: object InterStateChannelCommand: @@ -2686,7 +2697,6 @@ components: type: integer required: - channelName - - commandId type: object TimerResult: example: @@ -2698,7 +2708,6 @@ components: timerStatus: $ref: '#/components/schemas/TimerStatus' required: - - commandId - timerStatus type: object TimerStatus: @@ -2724,7 +2733,6 @@ components: signalValue: $ref: '#/components/schemas/EncodedObject' required: - - commandId - signalChannelName - signalRequestStatus type: object @@ -2747,7 +2755,6 @@ components: $ref: '#/components/schemas/EncodedObject' required: - channelName - - commandId - requestStatus type: object ChannelRequestStatus: diff --git a/gen/iwfidl/docs/DefaultApi.md b/gen/iwfidl/docs/DefaultApi.md index 878baaa8..512b8952 100644 --- a/gen/iwfidl/docs/DefaultApi.md +++ b/gen/iwfidl/docs/DefaultApi.md @@ -1059,7 +1059,7 @@ import ( ) func main() { - workflowWaitForStateCompletionRequest := *openapiclient.NewWorkflowWaitForStateCompletionRequest("WorkflowId_example", "StateExecutionId_example") // WorkflowWaitForStateCompletionRequest | (optional) + workflowWaitForStateCompletionRequest := *openapiclient.NewWorkflowWaitForStateCompletionRequest("WorkflowId_example") // WorkflowWaitForStateCompletionRequest | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) diff --git a/gen/iwfidl/docs/InterStateChannelCommand.md b/gen/iwfidl/docs/InterStateChannelCommand.md index aa714b0d..483fd0de 100644 --- a/gen/iwfidl/docs/InterStateChannelCommand.md +++ b/gen/iwfidl/docs/InterStateChannelCommand.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **ChannelName** | **string** | | **AtLeast** | Pointer to **int32** | | [optional] **AtMost** | Pointer to **int32** | | [optional] @@ -13,7 +13,7 @@ Name | Type | Description | Notes ### NewInterStateChannelCommand -`func NewInterStateChannelCommand(commandId string, channelName string, ) *InterStateChannelCommand` +`func NewInterStateChannelCommand(channelName string, ) *InterStateChannelCommand` NewInterStateChannelCommand instantiates a new InterStateChannelCommand object This constructor will assign default values to properties that have it defined, @@ -47,6 +47,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *InterStateChannelCommand) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetChannelName diff --git a/gen/iwfidl/docs/InterStateChannelResult.md b/gen/iwfidl/docs/InterStateChannelResult.md index ba45b580..c37f6790 100644 --- a/gen/iwfidl/docs/InterStateChannelResult.md +++ b/gen/iwfidl/docs/InterStateChannelResult.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **RequestStatus** | [**ChannelRequestStatus**](ChannelRequestStatus.md) | | **ChannelName** | **string** | | **Value** | Pointer to [**EncodedObject**](EncodedObject.md) | | [optional] @@ -13,7 +13,7 @@ Name | Type | Description | Notes ### NewInterStateChannelResult -`func NewInterStateChannelResult(commandId string, requestStatus ChannelRequestStatus, channelName string, ) *InterStateChannelResult` +`func NewInterStateChannelResult(requestStatus ChannelRequestStatus, channelName string, ) *InterStateChannelResult` NewInterStateChannelResult instantiates a new InterStateChannelResult object This constructor will assign default values to properties that have it defined, @@ -47,6 +47,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *InterStateChannelResult) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetRequestStatus diff --git a/gen/iwfidl/docs/SignalCommand.md b/gen/iwfidl/docs/SignalCommand.md index e2345994..130f3d1b 100644 --- a/gen/iwfidl/docs/SignalCommand.md +++ b/gen/iwfidl/docs/SignalCommand.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **SignalChannelName** | **string** | | **AtLeast** | Pointer to **int32** | | [optional] **AtMost** | Pointer to **int32** | | [optional] @@ -13,7 +13,7 @@ Name | Type | Description | Notes ### NewSignalCommand -`func NewSignalCommand(commandId string, signalChannelName string, ) *SignalCommand` +`func NewSignalCommand(signalChannelName string, ) *SignalCommand` NewSignalCommand instantiates a new SignalCommand object This constructor will assign default values to properties that have it defined, @@ -47,6 +47,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *SignalCommand) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetSignalChannelName diff --git a/gen/iwfidl/docs/SignalResult.md b/gen/iwfidl/docs/SignalResult.md index 3c7960ca..d51840db 100644 --- a/gen/iwfidl/docs/SignalResult.md +++ b/gen/iwfidl/docs/SignalResult.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **SignalRequestStatus** | [**ChannelRequestStatus**](ChannelRequestStatus.md) | | **SignalChannelName** | **string** | | **SignalValue** | Pointer to [**EncodedObject**](EncodedObject.md) | | [optional] @@ -13,7 +13,7 @@ Name | Type | Description | Notes ### NewSignalResult -`func NewSignalResult(commandId string, signalRequestStatus ChannelRequestStatus, signalChannelName string, ) *SignalResult` +`func NewSignalResult(signalRequestStatus ChannelRequestStatus, signalChannelName string, ) *SignalResult` NewSignalResult instantiates a new SignalResult object This constructor will assign default values to properties that have it defined, @@ -47,6 +47,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *SignalResult) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetSignalRequestStatus diff --git a/gen/iwfidl/docs/StateMovement.md b/gen/iwfidl/docs/StateMovement.md index c602175e..24e7fb88 100644 --- a/gen/iwfidl/docs/StateMovement.md +++ b/gen/iwfidl/docs/StateMovement.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **StateId** | **string** | | **StateInput** | Pointer to [**EncodedObject**](EncodedObject.md) | | [optional] **StateOptions** | Pointer to [**WorkflowStateOptions**](WorkflowStateOptions.md) | | [optional] +**WaitForKey** | Pointer to **string** | | [optional] ## Methods @@ -97,6 +98,31 @@ SetStateOptions sets StateOptions field to given value. HasStateOptions returns a boolean if a field has been set. +### GetWaitForKey + +`func (o *StateMovement) GetWaitForKey() string` + +GetWaitForKey returns the WaitForKey field if non-nil, zero value otherwise. + +### GetWaitForKeyOk + +`func (o *StateMovement) GetWaitForKeyOk() (*string, bool)` + +GetWaitForKeyOk returns a tuple with the WaitForKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWaitForKey + +`func (o *StateMovement) SetWaitForKey(v string)` + +SetWaitForKey sets WaitForKey field to given value. + +### HasWaitForKey + +`func (o *StateMovement) HasWaitForKey() bool` + +HasWaitForKey returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/gen/iwfidl/docs/TimerCommand.md b/gen/iwfidl/docs/TimerCommand.md index 74f3c61a..2cb1a7a9 100644 --- a/gen/iwfidl/docs/TimerCommand.md +++ b/gen/iwfidl/docs/TimerCommand.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **FiringUnixTimestampSeconds** | Pointer to **int64** | | [optional] **DurationSeconds** | Pointer to **int64** | | [optional] @@ -12,7 +12,7 @@ Name | Type | Description | Notes ### NewTimerCommand -`func NewTimerCommand(commandId string, ) *TimerCommand` +`func NewTimerCommand() *TimerCommand` NewTimerCommand instantiates a new TimerCommand object This constructor will assign default values to properties that have it defined, @@ -46,6 +46,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *TimerCommand) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetFiringUnixTimestampSeconds diff --git a/gen/iwfidl/docs/TimerResult.md b/gen/iwfidl/docs/TimerResult.md index 1087b1c9..38c8951e 100644 --- a/gen/iwfidl/docs/TimerResult.md +++ b/gen/iwfidl/docs/TimerResult.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**CommandId** | **string** | | +**CommandId** | Pointer to **string** | | [optional] **TimerStatus** | [**TimerStatus**](TimerStatus.md) | | ## Methods ### NewTimerResult -`func NewTimerResult(commandId string, timerStatus TimerStatus, ) *TimerResult` +`func NewTimerResult(timerStatus TimerStatus, ) *TimerResult` NewTimerResult instantiates a new TimerResult object This constructor will assign default values to properties that have it defined, @@ -45,6 +45,11 @@ and a boolean to check if the value has been set. SetCommandId sets CommandId field to given value. +### HasCommandId + +`func (o *TimerResult) HasCommandId() bool` + +HasCommandId returns a boolean if a field has been set. ### GetTimerStatus diff --git a/gen/iwfidl/docs/WorkflowWaitForStateCompletionRequest.md b/gen/iwfidl/docs/WorkflowWaitForStateCompletionRequest.md index 114a63af..7a1005dc 100644 --- a/gen/iwfidl/docs/WorkflowWaitForStateCompletionRequest.md +++ b/gen/iwfidl/docs/WorkflowWaitForStateCompletionRequest.md @@ -5,14 +5,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **WorkflowId** | **string** | | -**StateExecutionId** | **string** | | +**StateExecutionId** | Pointer to **string** | | [optional] +**StateId** | Pointer to **string** | | [optional] +**WaitForKey** | Pointer to **string** | | [optional] **WaitTimeSeconds** | Pointer to **int32** | | [optional] ## Methods ### NewWorkflowWaitForStateCompletionRequest -`func NewWorkflowWaitForStateCompletionRequest(workflowId string, stateExecutionId string, ) *WorkflowWaitForStateCompletionRequest` +`func NewWorkflowWaitForStateCompletionRequest(workflowId string, ) *WorkflowWaitForStateCompletionRequest` NewWorkflowWaitForStateCompletionRequest instantiates a new WorkflowWaitForStateCompletionRequest object This constructor will assign default values to properties that have it defined, @@ -66,6 +68,61 @@ and a boolean to check if the value has been set. SetStateExecutionId sets StateExecutionId field to given value. +### HasStateExecutionId + +`func (o *WorkflowWaitForStateCompletionRequest) HasStateExecutionId() bool` + +HasStateExecutionId returns a boolean if a field has been set. + +### GetStateId + +`func (o *WorkflowWaitForStateCompletionRequest) GetStateId() string` + +GetStateId returns the StateId field if non-nil, zero value otherwise. + +### GetStateIdOk + +`func (o *WorkflowWaitForStateCompletionRequest) GetStateIdOk() (*string, bool)` + +GetStateIdOk returns a tuple with the StateId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStateId + +`func (o *WorkflowWaitForStateCompletionRequest) SetStateId(v string)` + +SetStateId sets StateId field to given value. + +### HasStateId + +`func (o *WorkflowWaitForStateCompletionRequest) HasStateId() bool` + +HasStateId returns a boolean if a field has been set. + +### GetWaitForKey + +`func (o *WorkflowWaitForStateCompletionRequest) GetWaitForKey() string` + +GetWaitForKey returns the WaitForKey field if non-nil, zero value otherwise. + +### GetWaitForKeyOk + +`func (o *WorkflowWaitForStateCompletionRequest) GetWaitForKeyOk() (*string, bool)` + +GetWaitForKeyOk returns a tuple with the WaitForKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetWaitForKey + +`func (o *WorkflowWaitForStateCompletionRequest) SetWaitForKey(v string)` + +SetWaitForKey sets WaitForKey field to given value. + +### HasWaitForKey + +`func (o *WorkflowWaitForStateCompletionRequest) HasWaitForKey() bool` + +HasWaitForKey returns a boolean if a field has been set. ### GetWaitTimeSeconds diff --git a/gen/iwfidl/model_inter_state_channel_command.go b/gen/iwfidl/model_inter_state_channel_command.go index bec5ee7c..c15401b3 100644 --- a/gen/iwfidl/model_inter_state_channel_command.go +++ b/gen/iwfidl/model_inter_state_channel_command.go @@ -19,19 +19,18 @@ var _ MappedNullable = &InterStateChannelCommand{} // InterStateChannelCommand struct for InterStateChannelCommand type InterStateChannelCommand struct { - CommandId string `json:"commandId"` - ChannelName string `json:"channelName"` - AtLeast *int32 `json:"atLeast,omitempty"` - AtMost *int32 `json:"atMost,omitempty"` + CommandId *string `json:"commandId,omitempty"` + ChannelName string `json:"channelName"` + AtLeast *int32 `json:"atLeast,omitempty"` + AtMost *int32 `json:"atMost,omitempty"` } // NewInterStateChannelCommand instantiates a new InterStateChannelCommand object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewInterStateChannelCommand(commandId string, channelName string) *InterStateChannelCommand { +func NewInterStateChannelCommand(channelName string) *InterStateChannelCommand { this := InterStateChannelCommand{} - this.CommandId = commandId this.ChannelName = channelName return &this } @@ -44,28 +43,36 @@ func NewInterStateChannelCommandWithDefaults() *InterStateChannelCommand { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *InterStateChannelCommand) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *InterStateChannelCommand) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *InterStateChannelCommand) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *InterStateChannelCommand) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetChannelName returns the ChannelName field value @@ -166,7 +173,9 @@ func (o InterStateChannelCommand) MarshalJSON() ([]byte, error) { func (o InterStateChannelCommand) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } toSerialize["channelName"] = o.ChannelName if !IsNil(o.AtLeast) { toSerialize["atLeast"] = o.AtLeast diff --git a/gen/iwfidl/model_inter_state_channel_result.go b/gen/iwfidl/model_inter_state_channel_result.go index 1e6ff3a3..05ac77a3 100644 --- a/gen/iwfidl/model_inter_state_channel_result.go +++ b/gen/iwfidl/model_inter_state_channel_result.go @@ -19,7 +19,7 @@ var _ MappedNullable = &InterStateChannelResult{} // InterStateChannelResult struct for InterStateChannelResult type InterStateChannelResult struct { - CommandId string `json:"commandId"` + CommandId *string `json:"commandId,omitempty"` RequestStatus ChannelRequestStatus `json:"requestStatus"` ChannelName string `json:"channelName"` Value *EncodedObject `json:"value,omitempty"` @@ -29,9 +29,8 @@ type InterStateChannelResult struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewInterStateChannelResult(commandId string, requestStatus ChannelRequestStatus, channelName string) *InterStateChannelResult { +func NewInterStateChannelResult(requestStatus ChannelRequestStatus, channelName string) *InterStateChannelResult { this := InterStateChannelResult{} - this.CommandId = commandId this.RequestStatus = requestStatus this.ChannelName = channelName return &this @@ -45,28 +44,36 @@ func NewInterStateChannelResultWithDefaults() *InterStateChannelResult { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *InterStateChannelResult) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *InterStateChannelResult) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *InterStateChannelResult) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *InterStateChannelResult) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetRequestStatus returns the RequestStatus field value @@ -159,7 +166,9 @@ func (o InterStateChannelResult) MarshalJSON() ([]byte, error) { func (o InterStateChannelResult) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } toSerialize["requestStatus"] = o.RequestStatus toSerialize["channelName"] = o.ChannelName if !IsNil(o.Value) { diff --git a/gen/iwfidl/model_signal_command.go b/gen/iwfidl/model_signal_command.go index 1fde8750..2ad636a7 100644 --- a/gen/iwfidl/model_signal_command.go +++ b/gen/iwfidl/model_signal_command.go @@ -19,19 +19,18 @@ var _ MappedNullable = &SignalCommand{} // SignalCommand struct for SignalCommand type SignalCommand struct { - CommandId string `json:"commandId"` - SignalChannelName string `json:"signalChannelName"` - AtLeast *int32 `json:"atLeast,omitempty"` - AtMost *int32 `json:"atMost,omitempty"` + CommandId *string `json:"commandId,omitempty"` + SignalChannelName string `json:"signalChannelName"` + AtLeast *int32 `json:"atLeast,omitempty"` + AtMost *int32 `json:"atMost,omitempty"` } // NewSignalCommand instantiates a new SignalCommand object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSignalCommand(commandId string, signalChannelName string) *SignalCommand { +func NewSignalCommand(signalChannelName string) *SignalCommand { this := SignalCommand{} - this.CommandId = commandId this.SignalChannelName = signalChannelName return &this } @@ -44,28 +43,36 @@ func NewSignalCommandWithDefaults() *SignalCommand { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *SignalCommand) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SignalCommand) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *SignalCommand) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *SignalCommand) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetSignalChannelName returns the SignalChannelName field value @@ -166,7 +173,9 @@ func (o SignalCommand) MarshalJSON() ([]byte, error) { func (o SignalCommand) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } toSerialize["signalChannelName"] = o.SignalChannelName if !IsNil(o.AtLeast) { toSerialize["atLeast"] = o.AtLeast diff --git a/gen/iwfidl/model_signal_result.go b/gen/iwfidl/model_signal_result.go index 5aea632c..dc9d3650 100644 --- a/gen/iwfidl/model_signal_result.go +++ b/gen/iwfidl/model_signal_result.go @@ -19,7 +19,7 @@ var _ MappedNullable = &SignalResult{} // SignalResult struct for SignalResult type SignalResult struct { - CommandId string `json:"commandId"` + CommandId *string `json:"commandId,omitempty"` SignalRequestStatus ChannelRequestStatus `json:"signalRequestStatus"` SignalChannelName string `json:"signalChannelName"` SignalValue *EncodedObject `json:"signalValue,omitempty"` @@ -29,9 +29,8 @@ type SignalResult struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSignalResult(commandId string, signalRequestStatus ChannelRequestStatus, signalChannelName string) *SignalResult { +func NewSignalResult(signalRequestStatus ChannelRequestStatus, signalChannelName string) *SignalResult { this := SignalResult{} - this.CommandId = commandId this.SignalRequestStatus = signalRequestStatus this.SignalChannelName = signalChannelName return &this @@ -45,28 +44,36 @@ func NewSignalResultWithDefaults() *SignalResult { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *SignalResult) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *SignalResult) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *SignalResult) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *SignalResult) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetSignalRequestStatus returns the SignalRequestStatus field value @@ -159,7 +166,9 @@ func (o SignalResult) MarshalJSON() ([]byte, error) { func (o SignalResult) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } toSerialize["signalRequestStatus"] = o.SignalRequestStatus toSerialize["signalChannelName"] = o.SignalChannelName if !IsNil(o.SignalValue) { diff --git a/gen/iwfidl/model_state_movement.go b/gen/iwfidl/model_state_movement.go index 46e60062..8c79f9c7 100644 --- a/gen/iwfidl/model_state_movement.go +++ b/gen/iwfidl/model_state_movement.go @@ -22,6 +22,7 @@ type StateMovement struct { StateId string `json:"stateId"` StateInput *EncodedObject `json:"stateInput,omitempty"` StateOptions *WorkflowStateOptions `json:"stateOptions,omitempty"` + WaitForKey *string `json:"waitForKey,omitempty"` } // NewStateMovement instantiates a new StateMovement object @@ -130,6 +131,38 @@ func (o *StateMovement) SetStateOptions(v WorkflowStateOptions) { o.StateOptions = &v } +// GetWaitForKey returns the WaitForKey field value if set, zero value otherwise. +func (o *StateMovement) GetWaitForKey() string { + if o == nil || IsNil(o.WaitForKey) { + var ret string + return ret + } + return *o.WaitForKey +} + +// GetWaitForKeyOk returns a tuple with the WaitForKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StateMovement) GetWaitForKeyOk() (*string, bool) { + if o == nil || IsNil(o.WaitForKey) { + return nil, false + } + return o.WaitForKey, true +} + +// HasWaitForKey returns a boolean if a field has been set. +func (o *StateMovement) HasWaitForKey() bool { + if o != nil && !IsNil(o.WaitForKey) { + return true + } + + return false +} + +// SetWaitForKey gets a reference to the given string and assigns it to the WaitForKey field. +func (o *StateMovement) SetWaitForKey(v string) { + o.WaitForKey = &v +} + func (o StateMovement) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -147,6 +180,9 @@ func (o StateMovement) ToMap() (map[string]interface{}, error) { if !IsNil(o.StateOptions) { toSerialize["stateOptions"] = o.StateOptions } + if !IsNil(o.WaitForKey) { + toSerialize["waitForKey"] = o.WaitForKey + } return toSerialize, nil } diff --git a/gen/iwfidl/model_timer_command.go b/gen/iwfidl/model_timer_command.go index f9bd3297..f028957e 100644 --- a/gen/iwfidl/model_timer_command.go +++ b/gen/iwfidl/model_timer_command.go @@ -19,18 +19,17 @@ var _ MappedNullable = &TimerCommand{} // TimerCommand struct for TimerCommand type TimerCommand struct { - CommandId string `json:"commandId"` - FiringUnixTimestampSeconds *int64 `json:"firingUnixTimestampSeconds,omitempty"` - DurationSeconds *int64 `json:"durationSeconds,omitempty"` + CommandId *string `json:"commandId,omitempty"` + FiringUnixTimestampSeconds *int64 `json:"firingUnixTimestampSeconds,omitempty"` + DurationSeconds *int64 `json:"durationSeconds,omitempty"` } // NewTimerCommand instantiates a new TimerCommand object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewTimerCommand(commandId string) *TimerCommand { +func NewTimerCommand() *TimerCommand { this := TimerCommand{} - this.CommandId = commandId return &this } @@ -42,28 +41,36 @@ func NewTimerCommandWithDefaults() *TimerCommand { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *TimerCommand) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TimerCommand) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *TimerCommand) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *TimerCommand) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetFiringUnixTimestampSeconds returns the FiringUnixTimestampSeconds field value if set, zero value otherwise. @@ -140,7 +147,9 @@ func (o TimerCommand) MarshalJSON() ([]byte, error) { func (o TimerCommand) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } if !IsNil(o.FiringUnixTimestampSeconds) { toSerialize["firingUnixTimestampSeconds"] = o.FiringUnixTimestampSeconds } diff --git a/gen/iwfidl/model_timer_result.go b/gen/iwfidl/model_timer_result.go index db4380b5..cdbae6aa 100644 --- a/gen/iwfidl/model_timer_result.go +++ b/gen/iwfidl/model_timer_result.go @@ -19,7 +19,7 @@ var _ MappedNullable = &TimerResult{} // TimerResult struct for TimerResult type TimerResult struct { - CommandId string `json:"commandId"` + CommandId *string `json:"commandId,omitempty"` TimerStatus TimerStatus `json:"timerStatus"` } @@ -27,9 +27,8 @@ type TimerResult struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewTimerResult(commandId string, timerStatus TimerStatus) *TimerResult { +func NewTimerResult(timerStatus TimerStatus) *TimerResult { this := TimerResult{} - this.CommandId = commandId this.TimerStatus = timerStatus return &this } @@ -42,28 +41,36 @@ func NewTimerResultWithDefaults() *TimerResult { return &this } -// GetCommandId returns the CommandId field value +// GetCommandId returns the CommandId field value if set, zero value otherwise. func (o *TimerResult) GetCommandId() string { - if o == nil { + if o == nil || IsNil(o.CommandId) { var ret string return ret } - - return o.CommandId + return *o.CommandId } -// GetCommandIdOk returns a tuple with the CommandId field value +// GetCommandIdOk returns a tuple with the CommandId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *TimerResult) GetCommandIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CommandId) { return nil, false } - return &o.CommandId, true + return o.CommandId, true +} + +// HasCommandId returns a boolean if a field has been set. +func (o *TimerResult) HasCommandId() bool { + if o != nil && !IsNil(o.CommandId) { + return true + } + + return false } -// SetCommandId sets field value +// SetCommandId gets a reference to the given string and assigns it to the CommandId field. func (o *TimerResult) SetCommandId(v string) { - o.CommandId = v + o.CommandId = &v } // GetTimerStatus returns the TimerStatus field value @@ -100,7 +107,9 @@ func (o TimerResult) MarshalJSON() ([]byte, error) { func (o TimerResult) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["commandId"] = o.CommandId + if !IsNil(o.CommandId) { + toSerialize["commandId"] = o.CommandId + } toSerialize["timerStatus"] = o.TimerStatus return toSerialize, nil } diff --git a/gen/iwfidl/model_workflow_wait_for_state_completion_request.go b/gen/iwfidl/model_workflow_wait_for_state_completion_request.go index d123eacd..610a12f6 100644 --- a/gen/iwfidl/model_workflow_wait_for_state_completion_request.go +++ b/gen/iwfidl/model_workflow_wait_for_state_completion_request.go @@ -19,19 +19,20 @@ var _ MappedNullable = &WorkflowWaitForStateCompletionRequest{} // WorkflowWaitForStateCompletionRequest struct for WorkflowWaitForStateCompletionRequest type WorkflowWaitForStateCompletionRequest struct { - WorkflowId string `json:"workflowId"` - StateExecutionId string `json:"stateExecutionId"` - WaitTimeSeconds *int32 `json:"waitTimeSeconds,omitempty"` + WorkflowId string `json:"workflowId"` + StateExecutionId *string `json:"stateExecutionId,omitempty"` + StateId *string `json:"stateId,omitempty"` + WaitForKey *string `json:"waitForKey,omitempty"` + WaitTimeSeconds *int32 `json:"waitTimeSeconds,omitempty"` } // NewWorkflowWaitForStateCompletionRequest instantiates a new WorkflowWaitForStateCompletionRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWorkflowWaitForStateCompletionRequest(workflowId string, stateExecutionId string) *WorkflowWaitForStateCompletionRequest { +func NewWorkflowWaitForStateCompletionRequest(workflowId string) *WorkflowWaitForStateCompletionRequest { this := WorkflowWaitForStateCompletionRequest{} this.WorkflowId = workflowId - this.StateExecutionId = stateExecutionId return &this } @@ -67,28 +68,100 @@ func (o *WorkflowWaitForStateCompletionRequest) SetWorkflowId(v string) { o.WorkflowId = v } -// GetStateExecutionId returns the StateExecutionId field value +// GetStateExecutionId returns the StateExecutionId field value if set, zero value otherwise. func (o *WorkflowWaitForStateCompletionRequest) GetStateExecutionId() string { - if o == nil { + if o == nil || IsNil(o.StateExecutionId) { var ret string return ret } - - return o.StateExecutionId + return *o.StateExecutionId } -// GetStateExecutionIdOk returns a tuple with the StateExecutionId field value +// GetStateExecutionIdOk returns a tuple with the StateExecutionId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *WorkflowWaitForStateCompletionRequest) GetStateExecutionIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.StateExecutionId) { return nil, false } - return &o.StateExecutionId, true + return o.StateExecutionId, true +} + +// HasStateExecutionId returns a boolean if a field has been set. +func (o *WorkflowWaitForStateCompletionRequest) HasStateExecutionId() bool { + if o != nil && !IsNil(o.StateExecutionId) { + return true + } + + return false } -// SetStateExecutionId sets field value +// SetStateExecutionId gets a reference to the given string and assigns it to the StateExecutionId field. func (o *WorkflowWaitForStateCompletionRequest) SetStateExecutionId(v string) { - o.StateExecutionId = v + o.StateExecutionId = &v +} + +// GetStateId returns the StateId field value if set, zero value otherwise. +func (o *WorkflowWaitForStateCompletionRequest) GetStateId() string { + if o == nil || IsNil(o.StateId) { + var ret string + return ret + } + return *o.StateId +} + +// GetStateIdOk returns a tuple with the StateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowWaitForStateCompletionRequest) GetStateIdOk() (*string, bool) { + if o == nil || IsNil(o.StateId) { + return nil, false + } + return o.StateId, true +} + +// HasStateId returns a boolean if a field has been set. +func (o *WorkflowWaitForStateCompletionRequest) HasStateId() bool { + if o != nil && !IsNil(o.StateId) { + return true + } + + return false +} + +// SetStateId gets a reference to the given string and assigns it to the StateId field. +func (o *WorkflowWaitForStateCompletionRequest) SetStateId(v string) { + o.StateId = &v +} + +// GetWaitForKey returns the WaitForKey field value if set, zero value otherwise. +func (o *WorkflowWaitForStateCompletionRequest) GetWaitForKey() string { + if o == nil || IsNil(o.WaitForKey) { + var ret string + return ret + } + return *o.WaitForKey +} + +// GetWaitForKeyOk returns a tuple with the WaitForKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowWaitForStateCompletionRequest) GetWaitForKeyOk() (*string, bool) { + if o == nil || IsNil(o.WaitForKey) { + return nil, false + } + return o.WaitForKey, true +} + +// HasWaitForKey returns a boolean if a field has been set. +func (o *WorkflowWaitForStateCompletionRequest) HasWaitForKey() bool { + if o != nil && !IsNil(o.WaitForKey) { + return true + } + + return false +} + +// SetWaitForKey gets a reference to the given string and assigns it to the WaitForKey field. +func (o *WorkflowWaitForStateCompletionRequest) SetWaitForKey(v string) { + o.WaitForKey = &v } // GetWaitTimeSeconds returns the WaitTimeSeconds field value if set, zero value otherwise. @@ -134,7 +207,15 @@ func (o WorkflowWaitForStateCompletionRequest) MarshalJSON() ([]byte, error) { func (o WorkflowWaitForStateCompletionRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["workflowId"] = o.WorkflowId - toSerialize["stateExecutionId"] = o.StateExecutionId + if !IsNil(o.StateExecutionId) { + toSerialize["stateExecutionId"] = o.StateExecutionId + } + if !IsNil(o.StateId) { + toSerialize["stateId"] = o.StateId + } + if !IsNil(o.WaitForKey) { + toSerialize["waitForKey"] = o.WaitForKey + } if !IsNil(o.WaitTimeSeconds) { toSerialize["waitTimeSeconds"] = o.WaitTimeSeconds } diff --git a/integ/timer_test.go b/integ/timer_test.go index 45592b95..e62dd843 100644 --- a/integ/timer_test.go +++ b/integ/timer_test.go @@ -98,12 +98,12 @@ func doTestTimerWorkflow(t *testing.T, backendType service.BackendType, config * } assertions := assert.New(t) timer2 := &service.TimerInfo{ - CommandId: "timer-cmd-id-2", + CommandId: ptr.Any("timer-cmd-id-2"), FiringUnixTimestampSeconds: nowTimestamp + 86400, Status: service.TimerPending, } timer3 := &service.TimerInfo{ - CommandId: "timer-cmd-id-3", + CommandId: ptr.Any("timer-cmd-id-3"), FiringUnixTimestampSeconds: nowTimestamp + 86400*365, Status: service.TimerPending, } @@ -111,7 +111,7 @@ func doTestTimerWorkflow(t *testing.T, backendType service.BackendType, config * StateExecutionCurrentTimerInfos: map[string][]*service.TimerInfo{ "S1-1": { { - CommandId: "timer-cmd-id", + CommandId: ptr.Any("timer-cmd-id"), FiringUnixTimestampSeconds: nowTimestamp + 10, Status: service.TimerPending, }, diff --git a/integ/wait_for_state_completion_test.go b/integ/wait_for_state_completion_test.go index f408ca38..b23e68f5 100644 --- a/integ/wait_for_state_completion_test.go +++ b/integ/wait_for_state_completion_test.go @@ -86,7 +86,7 @@ func doTestWaitForStateCompletion( _, httpResp, err = req1.WorkflowWaitForStateCompletionRequest( iwfidl.WorkflowWaitForStateCompletionRequest{ WorkflowId: wfId, - StateExecutionId: "S1-1", + StateExecutionId: ptr.Any("S1-1"), WaitTimeSeconds: iwfidl.PtrInt32(30), }).Execute() panicAtHttpError(err, httpResp) diff --git a/integ/workflow/any_command_close/routers.go b/integ/workflow/any_command_close/routers.go index 12470aa7..4887850d 100644 --- a/integ/workflow/any_command_close/routers.go +++ b/integ/workflow/any_command_close/routers.go @@ -46,11 +46,11 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { CommandRequest: &iwfidl.CommandRequest{ SignalCommands: []iwfidl.SignalCommand{ { - CommandId: "signal-cmd-id1", + CommandId: ptr.Any("signal-cmd-id1"), SignalChannelName: SignalName1, }, { - CommandId: "signal-cmd-id2", + CommandId: ptr.Any("signal-cmd-id2"), SignalChannelName: SignalName2, }, }, diff --git a/integ/workflow/any_command_combination/routers.go b/integ/workflow/any_command_combination/routers.go index d40dab4a..bf0af376 100644 --- a/integ/workflow/any_command_combination/routers.go +++ b/integ/workflow/any_command_combination/routers.go @@ -5,6 +5,7 @@ import ( "github.com/indeedeng/iwf/gen/iwfidl" "github.com/indeedeng/iwf/integ/workflow/common" "github.com/indeedeng/iwf/service" + "github.com/indeedeng/iwf/service/common/ptr" "log" "net/http" "time" @@ -48,41 +49,39 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { invalidTimerCommands := []iwfidl.TimerCommand{ { - CommandId: "", FiringUnixTimestampSeconds: iwfidl.PtrInt64(time.Now().Unix() + 86400*365), // one year later }, } validTimerCommands := []iwfidl.TimerCommand{ { - CommandId: TimerId1, + CommandId: ptr.Any(TimerId1), FiringUnixTimestampSeconds: iwfidl.PtrInt64(time.Now().Unix() + 86400*365), // one year later }, } invalidSignalCommands := []iwfidl.SignalCommand{ { - CommandId: "", SignalChannelName: SignalNameAndId1, }, { - CommandId: SignalNameAndId2, + CommandId: ptr.Any(SignalNameAndId2), SignalChannelName: SignalNameAndId2, }, } validSignalCommands := []iwfidl.SignalCommand{ { - CommandId: SignalNameAndId1, + CommandId: ptr.Any(SignalNameAndId1), SignalChannelName: SignalNameAndId1, }, { - CommandId: SignalNameAndId1, + CommandId: ptr.Any(SignalNameAndId1), SignalChannelName: SignalNameAndId1, }, { - CommandId: SignalNameAndId2, + CommandId: ptr.Any(SignalNameAndId2), SignalChannelName: SignalNameAndId2, }, { - CommandId: SignalNameAndId3, + CommandId: ptr.Any(SignalNameAndId3), SignalChannelName: SignalNameAndId3, }, } diff --git a/integ/workflow/any_timer_signal/routers.go b/integ/workflow/any_timer_signal/routers.go index 1a66dd10..e0be00aa 100644 --- a/integ/workflow/any_timer_signal/routers.go +++ b/integ/workflow/any_timer_signal/routers.go @@ -57,7 +57,7 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { CommandRequest: &iwfidl.CommandRequest{ SignalCommands: []iwfidl.SignalCommand{ { - CommandId: "signal-cmd-id", + CommandId: ptr.Any("signal-cmd-id"), SignalChannelName: SignalName, }, }, diff --git a/integ/workflow/interstate/routers.go b/integ/workflow/interstate/routers.go index 2331c9bb..3986a3c5 100644 --- a/integ/workflow/interstate/routers.go +++ b/integ/workflow/interstate/routers.go @@ -4,6 +4,7 @@ import ( "github.com/gin-gonic/gin" "github.com/indeedeng/iwf/gen/iwfidl" "github.com/indeedeng/iwf/service" + "github.com/indeedeng/iwf/service/common/ptr" "log" "net/http" "time" @@ -68,7 +69,7 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { DeciderTriggerType: iwfidl.ALL_COMMAND_COMPLETED.Ptr(), InterStateChannelCommands: []iwfidl.InterStateChannelCommand{ { - CommandId: "cmd-1", + CommandId: ptr.Any("cmd-1"), ChannelName: channel1, }, }, @@ -82,7 +83,7 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { DeciderTriggerType: iwfidl.ALL_COMMAND_COMPLETED.Ptr(), InterStateChannelCommands: []iwfidl.InterStateChannelCommand{ { - CommandId: "cmd-2", + CommandId: ptr.Any("cmd-2"), ChannelName: channel2, }, }, diff --git a/integ/workflow/signal/routers.go b/integ/workflow/signal/routers.go index 0f703d58..9f082ecf 100644 --- a/integ/workflow/signal/routers.go +++ b/integ/workflow/signal/routers.go @@ -6,6 +6,7 @@ import ( "github.com/indeedeng/iwf/gen/iwfidl" "github.com/indeedeng/iwf/integ/workflow/common" "github.com/indeedeng/iwf/service" + "github.com/indeedeng/iwf/service/common/ptr" "log" "net/http" ) @@ -46,19 +47,17 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { CommandRequest: &iwfidl.CommandRequest{ SignalCommands: []iwfidl.SignalCommand{ { - CommandId: "signal-cmd-id0", + CommandId: ptr.Any("signal-cmd-id0"), SignalChannelName: SignalName, }, { - CommandId: "signal-cmd-id1", + CommandId: ptr.Any("signal-cmd-id1"), SignalChannelName: SignalName, }, { - CommandId: "", SignalChannelName: SignalName, }, { - CommandId: "", SignalChannelName: SignalName, }, }, diff --git a/integ/workflow/timer/routers.go b/integ/workflow/timer/routers.go index 41c5b6ce..62553c00 100644 --- a/integ/workflow/timer/routers.go +++ b/integ/workflow/timer/routers.go @@ -1,6 +1,7 @@ package timer import ( + "github.com/indeedeng/iwf/service/common/ptr" "log" "net/http" "strconv" @@ -52,15 +53,15 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { CommandRequest: &iwfidl.CommandRequest{ TimerCommands: []iwfidl.TimerCommand{ { - CommandId: "timer-cmd-id", + CommandId: ptr.Any("timer-cmd-id"), DurationSeconds: iwfidl.PtrInt64(10), // fire after 10s }, { - CommandId: "timer-cmd-id-2", + CommandId: ptr.Any("timer-cmd-id-2"), DurationSeconds: iwfidl.PtrInt64(86400), // fire after one day }, { - CommandId: "timer-cmd-id-3", + CommandId: ptr.Any("timer-cmd-id-3"), DurationSeconds: iwfidl.PtrInt64(86400 * 365), // fire after one year }, }, diff --git a/integ/workflow/wait_for_state_completion/routers.go b/integ/workflow/wait_for_state_completion/routers.go index 9a8c246b..512c9885 100644 --- a/integ/workflow/wait_for_state_completion/routers.go +++ b/integ/workflow/wait_for_state_completion/routers.go @@ -1,6 +1,7 @@ package wait_for_state_completion import ( + "github.com/indeedeng/iwf/service/common/ptr" "log" "net/http" "strconv" @@ -52,7 +53,7 @@ func (h *handler) ApiV1WorkflowStateStart(c *gin.Context) { CommandRequest: &iwfidl.CommandRequest{ TimerCommands: []iwfidl.TimerCommand{ { - CommandId: "timer-cmd-id", + CommandId: ptr.Any("timer-cmd-id"), FiringUnixTimestampSeconds: iwfidl.PtrInt64(now + 10), // fire after 10s }, }, diff --git a/iwf-idl b/iwf-idl index a972a2a9..257dd6a7 160000 --- a/iwf-idl +++ b/iwf-idl @@ -1 +1 @@ -Subproject commit a972a2a9ccbaf9ad597218a341b984834b04bee9 +Subproject commit 257dd6a7d31d81e20ac54657e524fd8d69d881c0 diff --git a/service/api/service.go b/service/api/service.go index c3ee94df..ccb3410c 100644 --- a/service/api/service.go +++ b/service/api/service.go @@ -151,7 +151,13 @@ func (s *serviceImpl) ApiV1WorkflowWaitForStateCompletion( ) (wresp *iwfidl.WorkflowWaitForStateCompletionResponse, retError *errors.ErrorAndStatus) { defer func() { log.CapturePanic(recover(), s.logger, &retError) }() - workflowId := service.IwfSystemConstPrefix + req.WorkflowId + "_" + req.StateExecutionId + var workflowId string + if req.WaitForKey != nil { + workflowId = service.IwfSystemConstPrefix + req.WorkflowId + "_" + *req.WaitForKey + } else { + workflowId = service.IwfSystemConstPrefix + req.WorkflowId + "_" + *req.StateExecutionId + } + options := uclient.StartWorkflowOptions{ ID: workflowId, TaskQueue: s.taskQueue, diff --git a/service/interfaces.go b/service/interfaces.go index 19ffb00b..65acdd12 100644 --- a/service/interfaces.go +++ b/service/interfaces.go @@ -100,7 +100,7 @@ type ( } TimerInfo struct { - CommandId string + CommandId *string FiringUnixTimestampSeconds int64 Status InternalTimerStatus } @@ -186,7 +186,7 @@ func ValidateTimerSkipRequest( } if timerId != "" { for _, t := range timerInfos { - if t.CommandId == timerId { + if t.CommandId != nil && *t.CommandId == timerId { return t, true } } diff --git a/service/interpreter/deciderTriggerer.go b/service/interpreter/deciderTriggerer.go index f681ae50..fa8f02dd 100644 --- a/service/interpreter/deciderTriggerer.go +++ b/service/interpreter/deciderTriggerer.go @@ -27,15 +27,15 @@ func IsDeciderTriggerConditionMet( var completedCmdIds []string for idx := range completedTimerCmds { cmdId := commandReq.GetTimerCommands()[idx].CommandId - completedCmdIds = append(completedCmdIds, cmdId) + completedCmdIds = append(completedCmdIds, *cmdId) } for idx := range completedSignalCmds { cmdId := commandReq.GetSignalCommands()[idx].CommandId - completedCmdIds = append(completedCmdIds, cmdId) + completedCmdIds = append(completedCmdIds, *cmdId) } for idx := range completedInterStateChannelCmds { cmdId := commandReq.GetInterStateChannelCommands()[idx].CommandId - completedCmdIds = append(completedCmdIds, cmdId) + completedCmdIds = append(completedCmdIds, *cmdId) } for _, acceptedComb := range commandReq.GetCommandCombinations() { diff --git a/service/interpreter/workflowImpl.go b/service/interpreter/workflowImpl.go index 6ca5bd8c..c708d672 100644 --- a/service/interpreter/workflowImpl.go +++ b/service/interpreter/workflowImpl.go @@ -4,6 +4,7 @@ import ( "context" "fmt" uclient "github.com/indeedeng/iwf/service/client" + "github.com/indeedeng/iwf/service/common/ptr" "github.com/indeedeng/iwf/service/interpreter/env" "time" @@ -655,7 +656,7 @@ func executeState( status = iwfidl.FIRED } timerResults = append(timerResults, iwfidl.TimerResult{ - CommandId: cmd.GetCommandId(), + CommandId: ptr.Any(cmd.GetCommandId()), TimerStatus: status, }) } @@ -672,7 +673,7 @@ func executeState( } signalResults = append(signalResults, iwfidl.SignalResult{ - CommandId: cmd.GetCommandId(), + CommandId: ptr.Any(cmd.GetCommandId()), SignalChannelName: cmd.GetSignalChannelName(), SignalValue: result, SignalRequestStatus: status,