diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 63495301613..d563c093f32 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "6f28d23893aaf63bbe89601f0db40c031af5726e", + SHA1: "5201efa69c895405f0918c59807ba2e89193c711", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nenum ArchivalStatus {\n NEVER_ENABLED,\n DISABLED,\n ENABLED,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n 30: optional string archivalBucketName\n 40: optional i32 archivalRetentionPeriodInDays\n 50: optional ArchivalStatus archivalStatus\n 60: optional string archivalBucketOwner\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n 100: optional bool enableArchival\n 110: optional string customArchivalBucketName\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 14bb55c33bc..6a6a57c2137 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -2370,6 +2370,190 @@ func (v *ActivityType) GetName() (o string) { return } +type ArchivalStatus int32 + +const ( + ArchivalStatusNeverEnabled ArchivalStatus = 0 + ArchivalStatusDisabled ArchivalStatus = 1 + ArchivalStatusEnabled ArchivalStatus = 2 +) + +// ArchivalStatus_Values returns all recognized values of ArchivalStatus. +func ArchivalStatus_Values() []ArchivalStatus { + return []ArchivalStatus{ + ArchivalStatusNeverEnabled, + ArchivalStatusDisabled, + ArchivalStatusEnabled, + } +} + +// UnmarshalText tries to decode ArchivalStatus from a byte slice +// containing its name. +// +// var v ArchivalStatus +// err := v.UnmarshalText([]byte("NEVER_ENABLED")) +func (v *ArchivalStatus) UnmarshalText(value []byte) error { + switch s := string(value); s { + case "NEVER_ENABLED": + *v = ArchivalStatusNeverEnabled + return nil + case "DISABLED": + *v = ArchivalStatusDisabled + return nil + case "ENABLED": + *v = ArchivalStatusEnabled + return nil + default: + val, err := strconv.ParseInt(s, 10, 32) + if err != nil { + return fmt.Errorf("unknown enum value %q for %q: %v", s, "ArchivalStatus", err) + } + *v = ArchivalStatus(val) + return nil + } +} + +// MarshalText encodes ArchivalStatus to text. +// +// If the enum value is recognized, its name is returned. Otherwise, +// its integer value is returned. +// +// This implements the TextMarshaler interface. +func (v ArchivalStatus) MarshalText() ([]byte, error) { + switch int32(v) { + case 0: + return []byte("NEVER_ENABLED"), nil + case 1: + return []byte("DISABLED"), nil + case 2: + return []byte("ENABLED"), nil + } + return []byte(strconv.FormatInt(int64(v), 10)), nil +} + +// MarshalLogObject implements zapcore.ObjectMarshaler, enabling +// fast logging of ArchivalStatus. +// Enums are logged as objects, where the value is logged with key "value", and +// if this value's name is known, the name is logged with key "name". +func (v ArchivalStatus) MarshalLogObject(enc zapcore.ObjectEncoder) error { + enc.AddInt32("value", int32(v)) + switch int32(v) { + case 0: + enc.AddString("name", "NEVER_ENABLED") + case 1: + enc.AddString("name", "DISABLED") + case 2: + enc.AddString("name", "ENABLED") + } + return nil +} + +// Ptr returns a pointer to this enum value. +func (v ArchivalStatus) Ptr() *ArchivalStatus { + return &v +} + +// ToWire translates ArchivalStatus into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// Enums are represented as 32-bit integers over the wire. +func (v ArchivalStatus) ToWire() (wire.Value, error) { + return wire.NewValueI32(int32(v)), nil +} + +// FromWire deserializes ArchivalStatus from its Thrift-level +// representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TI32) +// if err != nil { +// return ArchivalStatus(0), err +// } +// +// var v ArchivalStatus +// if err := v.FromWire(x); err != nil { +// return ArchivalStatus(0), err +// } +// return v, nil +func (v *ArchivalStatus) FromWire(w wire.Value) error { + *v = (ArchivalStatus)(w.GetI32()) + return nil +} + +// String returns a readable string representation of ArchivalStatus. +func (v ArchivalStatus) String() string { + w := int32(v) + switch w { + case 0: + return "NEVER_ENABLED" + case 1: + return "DISABLED" + case 2: + return "ENABLED" + } + return fmt.Sprintf("ArchivalStatus(%d)", w) +} + +// Equals returns true if this ArchivalStatus value matches the provided +// value. +func (v ArchivalStatus) Equals(rhs ArchivalStatus) bool { + return v == rhs +} + +// MarshalJSON serializes ArchivalStatus into JSON. +// +// If the enum value is recognized, its name is returned. Otherwise, +// its integer value is returned. +// +// This implements json.Marshaler. +func (v ArchivalStatus) MarshalJSON() ([]byte, error) { + switch int32(v) { + case 0: + return ([]byte)("\"NEVER_ENABLED\""), nil + case 1: + return ([]byte)("\"DISABLED\""), nil + case 2: + return ([]byte)("\"ENABLED\""), nil + } + return ([]byte)(strconv.FormatInt(int64(v), 10)), nil +} + +// UnmarshalJSON attempts to decode ArchivalStatus from its JSON +// representation. +// +// This implementation supports both, numeric and string inputs. If a +// string is provided, it must be a known enum name. +// +// This implements json.Unmarshaler. +func (v *ArchivalStatus) UnmarshalJSON(text []byte) error { + d := json.NewDecoder(bytes.NewReader(text)) + d.UseNumber() + t, err := d.Token() + if err != nil { + return err + } + + switch w := t.(type) { + case json.Number: + x, err := w.Int64() + if err != nil { + return err + } + if x > math.MaxInt32 { + return fmt.Errorf("enum overflow from JSON %q for %q", text, "ArchivalStatus") + } + if x < math.MinInt32 { + return fmt.Errorf("enum underflow from JSON %q for %q", text, "ArchivalStatus") + } + *v = (ArchivalStatus)(x) + return nil + case string: + return v.UnmarshalText([]byte(w)) + default: + return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "ArchivalStatus") + } +} + type BadRequestError struct { Message string `json:"message,required"` } @@ -11682,8 +11866,12 @@ func (v *DomainCacheInfo) GetNumOfItemsInCacheByName() (o int64) { } type DomainConfiguration struct { - WorkflowExecutionRetentionPeriodInDays *int32 `json:"workflowExecutionRetentionPeriodInDays,omitempty"` - EmitMetric *bool `json:"emitMetric,omitempty"` + WorkflowExecutionRetentionPeriodInDays *int32 `json:"workflowExecutionRetentionPeriodInDays,omitempty"` + EmitMetric *bool `json:"emitMetric,omitempty"` + ArchivalBucketName *string `json:"archivalBucketName,omitempty"` + ArchivalRetentionPeriodInDays *int32 `json:"archivalRetentionPeriodInDays,omitempty"` + ArchivalStatus *ArchivalStatus `json:"archivalStatus,omitempty"` + ArchivalBucketOwner *string `json:"archivalBucketOwner,omitempty"` } // ToWire translates a DomainConfiguration struct into a Thrift-level intermediate @@ -11703,7 +11891,7 @@ type DomainConfiguration struct { // } func (v *DomainConfiguration) ToWire() (wire.Value, error) { var ( - fields [2]wire.Field + fields [6]wire.Field i int = 0 w wire.Value err error @@ -11725,10 +11913,48 @@ func (v *DomainConfiguration) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 20, Value: w} i++ } + if v.ArchivalBucketName != nil { + w, err = wire.NewValueString(*(v.ArchivalBucketName)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + if v.ArchivalRetentionPeriodInDays != nil { + w, err = wire.NewValueI32(*(v.ArchivalRetentionPeriodInDays)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } + if v.ArchivalStatus != nil { + w, err = v.ArchivalStatus.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } + if v.ArchivalBucketOwner != nil { + w, err = wire.NewValueString(*(v.ArchivalBucketOwner)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } +func _ArchivalStatus_Read(w wire.Value) (ArchivalStatus, error) { + var v ArchivalStatus + err := v.FromWire(w) + return v, err +} + // FromWire deserializes a DomainConfiguration struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. @@ -11770,6 +11996,46 @@ func (v *DomainConfiguration) FromWire(w wire.Value) error { return err } + } + case 30: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ArchivalBucketName = &x + if err != nil { + return err + } + + } + case 40: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.ArchivalRetentionPeriodInDays = &x + if err != nil { + return err + } + + } + case 50: + if field.Value.Type() == wire.TI32 { + var x ArchivalStatus + x, err = _ArchivalStatus_Read(field.Value) + v.ArchivalStatus = &x + if err != nil { + return err + } + + } + case 60: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.ArchivalBucketOwner = &x + if err != nil { + return err + } + } } } @@ -11784,7 +12050,7 @@ func (v *DomainConfiguration) String() string { return "" } - var fields [2]string + var fields [6]string i := 0 if v.WorkflowExecutionRetentionPeriodInDays != nil { fields[i] = fmt.Sprintf("WorkflowExecutionRetentionPeriodInDays: %v", *(v.WorkflowExecutionRetentionPeriodInDays)) @@ -11794,10 +12060,36 @@ func (v *DomainConfiguration) String() string { fields[i] = fmt.Sprintf("EmitMetric: %v", *(v.EmitMetric)) i++ } + if v.ArchivalBucketName != nil { + fields[i] = fmt.Sprintf("ArchivalBucketName: %v", *(v.ArchivalBucketName)) + i++ + } + if v.ArchivalRetentionPeriodInDays != nil { + fields[i] = fmt.Sprintf("ArchivalRetentionPeriodInDays: %v", *(v.ArchivalRetentionPeriodInDays)) + i++ + } + if v.ArchivalStatus != nil { + fields[i] = fmt.Sprintf("ArchivalStatus: %v", *(v.ArchivalStatus)) + i++ + } + if v.ArchivalBucketOwner != nil { + fields[i] = fmt.Sprintf("ArchivalBucketOwner: %v", *(v.ArchivalBucketOwner)) + i++ + } return fmt.Sprintf("DomainConfiguration{%v}", strings.Join(fields[:i], ", ")) } +func _ArchivalStatus_EqualsPtr(lhs, rhs *ArchivalStatus) bool { + if lhs != nil && rhs != nil { + + x := *lhs + y := *rhs + return x.Equals(y) + } + return lhs == nil && rhs == nil +} + // Equals returns true if all the fields of this DomainConfiguration match the // provided DomainConfiguration. // @@ -11814,6 +12106,18 @@ func (v *DomainConfiguration) Equals(rhs *DomainConfiguration) bool { if !_Bool_EqualsPtr(v.EmitMetric, rhs.EmitMetric) { return false } + if !_String_EqualsPtr(v.ArchivalBucketName, rhs.ArchivalBucketName) { + return false + } + if !_I32_EqualsPtr(v.ArchivalRetentionPeriodInDays, rhs.ArchivalRetentionPeriodInDays) { + return false + } + if !_ArchivalStatus_EqualsPtr(v.ArchivalStatus, rhs.ArchivalStatus) { + return false + } + if !_String_EqualsPtr(v.ArchivalBucketOwner, rhs.ArchivalBucketOwner) { + return false + } return true } @@ -11830,6 +12134,18 @@ func (v *DomainConfiguration) MarshalLogObject(enc zapcore.ObjectEncoder) (err e if v.EmitMetric != nil { enc.AddBool("emitMetric", *v.EmitMetric) } + if v.ArchivalBucketName != nil { + enc.AddString("archivalBucketName", *v.ArchivalBucketName) + } + if v.ArchivalRetentionPeriodInDays != nil { + enc.AddInt32("archivalRetentionPeriodInDays", *v.ArchivalRetentionPeriodInDays) + } + if v.ArchivalStatus != nil { + err = multierr.Append(err, enc.AddObject("archivalStatus", *v.ArchivalStatus)) + } + if v.ArchivalBucketOwner != nil { + enc.AddString("archivalBucketOwner", *v.ArchivalBucketOwner) + } return err } @@ -11853,6 +12169,46 @@ func (v *DomainConfiguration) GetEmitMetric() (o bool) { return } +// GetArchivalBucketName returns the value of ArchivalBucketName if it is set or its +// zero value if it is unset. +func (v *DomainConfiguration) GetArchivalBucketName() (o string) { + if v.ArchivalBucketName != nil { + return *v.ArchivalBucketName + } + + return +} + +// GetArchivalRetentionPeriodInDays returns the value of ArchivalRetentionPeriodInDays if it is set or its +// zero value if it is unset. +func (v *DomainConfiguration) GetArchivalRetentionPeriodInDays() (o int32) { + if v.ArchivalRetentionPeriodInDays != nil { + return *v.ArchivalRetentionPeriodInDays + } + + return +} + +// GetArchivalStatus returns the value of ArchivalStatus if it is set or its +// zero value if it is unset. +func (v *DomainConfiguration) GetArchivalStatus() (o ArchivalStatus) { + if v.ArchivalStatus != nil { + return *v.ArchivalStatus + } + + return +} + +// GetArchivalBucketOwner returns the value of ArchivalBucketOwner if it is set or its +// zero value if it is unset. +func (v *DomainConfiguration) GetArchivalBucketOwner() (o string) { + if v.ArchivalBucketOwner != nil { + return *v.ArchivalBucketOwner + } + + return +} + type DomainInfo struct { Name *string `json:"name,omitempty"` Status *DomainStatus `json:"status,omitempty"` @@ -24088,6 +24444,8 @@ type RegisterDomainRequest struct { ActiveClusterName *string `json:"activeClusterName,omitempty"` Data map[string]string `json:"data,omitempty"` SecurityToken *string `json:"securityToken,omitempty"` + EnableArchival *bool `json:"enableArchival,omitempty"` + CustomArchivalBucketName *string `json:"customArchivalBucketName,omitempty"` } // ToWire translates a RegisterDomainRequest struct into a Thrift-level intermediate @@ -24107,7 +24465,7 @@ type RegisterDomainRequest struct { // } func (v *RegisterDomainRequest) ToWire() (wire.Value, error) { var ( - fields [9]wire.Field + fields [11]wire.Field i int = 0 w wire.Value err error @@ -24185,6 +24543,22 @@ func (v *RegisterDomainRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 90, Value: w} i++ } + if v.EnableArchival != nil { + w, err = wire.NewValueBool(*(v.EnableArchival)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 100, Value: w} + i++ + } + if v.CustomArchivalBucketName != nil { + w, err = wire.NewValueString(*(v.CustomArchivalBucketName)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 110, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -24296,6 +24670,26 @@ func (v *RegisterDomainRequest) FromWire(w wire.Value) error { return err } + } + case 100: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.EnableArchival = &x + if err != nil { + return err + } + + } + case 110: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.CustomArchivalBucketName = &x + if err != nil { + return err + } + } } } @@ -24310,7 +24704,7 @@ func (v *RegisterDomainRequest) String() string { return "" } - var fields [9]string + var fields [11]string i := 0 if v.Name != nil { fields[i] = fmt.Sprintf("Name: %v", *(v.Name)) @@ -24348,6 +24742,14 @@ func (v *RegisterDomainRequest) String() string { fields[i] = fmt.Sprintf("SecurityToken: %v", *(v.SecurityToken)) i++ } + if v.EnableArchival != nil { + fields[i] = fmt.Sprintf("EnableArchival: %v", *(v.EnableArchival)) + i++ + } + if v.CustomArchivalBucketName != nil { + fields[i] = fmt.Sprintf("CustomArchivalBucketName: %v", *(v.CustomArchivalBucketName)) + i++ + } return fmt.Sprintf("RegisterDomainRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -24389,6 +24791,12 @@ func (v *RegisterDomainRequest) Equals(rhs *RegisterDomainRequest) bool { if !_String_EqualsPtr(v.SecurityToken, rhs.SecurityToken) { return false } + if !_Bool_EqualsPtr(v.EnableArchival, rhs.EnableArchival) { + return false + } + if !_String_EqualsPtr(v.CustomArchivalBucketName, rhs.CustomArchivalBucketName) { + return false + } return true } @@ -24426,6 +24834,12 @@ func (v *RegisterDomainRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err if v.SecurityToken != nil { enc.AddString("securityToken", *v.SecurityToken) } + if v.EnableArchival != nil { + enc.AddBool("enableArchival", *v.EnableArchival) + } + if v.CustomArchivalBucketName != nil { + enc.AddString("customArchivalBucketName", *v.CustomArchivalBucketName) + } return err } @@ -24519,6 +24933,26 @@ func (v *RegisterDomainRequest) GetSecurityToken() (o string) { return } +// GetEnableArchival returns the value of EnableArchival if it is set or its +// zero value if it is unset. +func (v *RegisterDomainRequest) GetEnableArchival() (o bool) { + if v.EnableArchival != nil { + return *v.EnableArchival + } + + return +} + +// GetCustomArchivalBucketName returns the value of CustomArchivalBucketName if it is set or its +// zero value if it is unset. +func (v *RegisterDomainRequest) GetCustomArchivalBucketName() (o string) { + if v.CustomArchivalBucketName != nil { + return *v.CustomArchivalBucketName + } + + return +} + type ReplicationInfo struct { Version *int64 `json:"version,omitempty"` LastEventId *int64 `json:"lastEventId,omitempty"` diff --git a/cmd/server/server.go b/cmd/server/server.go index 26e148a553e..6ef11a90295 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -128,6 +128,7 @@ func (s *server) startService() common.Daemon { s.cfg.ClustersInfo.CurrentClusterName, s.cfg.ClustersInfo.ClusterInitialFailoverVersions, s.cfg.ClustersInfo.ClusterAddress, + s.cfg.ClustersInfo.DeploymentGroup, ) params.DispatcherProvider = client.NewIPYarpcDispatcherProvider() // TODO: We need to switch Cadence to use zap logger, until then just pass zap.NewNop diff --git a/common/cluster/metadata.go b/common/cluster/metadata.go index 44a802d7d41..13f5025f533 100644 --- a/common/cluster/metadata.go +++ b/common/cluster/metadata.go @@ -49,6 +49,8 @@ type ( ClusterNameForFailoverVersion(failoverVersion int64) string // GetAllClientAddress return the frontend address for each cluster name GetAllClientAddress() map[string]config.Address + // GetDeploymentGroup returns the deployment group of cluster + GetDeploymentGroup() string } metadataImpl struct { @@ -68,6 +70,8 @@ type ( initialFailoverVersionClusters map[int64]string // clusterToAddress contains the cluster name to corresponding frontend client clusterToAddress map[string]config.Address + // deploymentGroup is the deployment group name of cluster + deploymentGroup string } ) @@ -75,7 +79,7 @@ type ( func NewMetadata(enableGlobalDomain dynamicconfig.BoolPropertyFn, failoverVersionIncrement int64, masterClusterName string, currentClusterName string, clusterInitialFailoverVersions map[string]int64, - clusterToAddress map[string]config.Address) Metadata { + clusterToAddress map[string]config.Address, deploymentGroup string) Metadata { if len(clusterInitialFailoverVersions) < 0 { panic("Empty initial failover versions for cluster") @@ -83,6 +87,8 @@ func NewMetadata(enableGlobalDomain dynamicconfig.BoolPropertyFn, failoverVersio panic("Master cluster name is empty") } else if len(currentClusterName) == 0 { panic("Current cluster name is empty") + } else if len(deploymentGroup) == 0 { + panic("Deployment group name is empty") } initialFailoverVersionClusters := make(map[int64]string) for clusterName, initialFailoverVersion := range clusterInitialFailoverVersions { @@ -120,6 +126,7 @@ func NewMetadata(enableGlobalDomain dynamicconfig.BoolPropertyFn, failoverVersio clusterInitialFailoverVersions: clusterInitialFailoverVersions, initialFailoverVersionClusters: initialFailoverVersionClusters, clusterToAddress: clusterToAddress, + deploymentGroup: deploymentGroup, } } @@ -189,3 +196,8 @@ func (metadata *metadataImpl) ClusterNameForFailoverVersion(failoverVersion int6 func (metadata *metadataImpl) GetAllClientAddress() map[string]config.Address { return metadata.clusterToAddress } + +// GetDeploymentGroup returns the deployment group name for cluster +func (metadata *metadataImpl) GetDeploymentGroup() string { + return metadata.deploymentGroup +} diff --git a/common/cluster/metadataTestBase.go b/common/cluster/metadataTestBase.go index d3e33f4247e..012433c4217 100644 --- a/common/cluster/metadataTestBase.go +++ b/common/cluster/metadataTestBase.go @@ -41,6 +41,8 @@ const ( TestCurrentClusterFrontendAddress = "127.0.0.1:7104" // TestAlternativeClusterFrontendAddress is the ip port address of alternative cluster TestAlternativeClusterFrontendAddress = "127.0.0.1:8104" + // TestDeploymentGroup is alternative deployment group used for test + TestDeploymentGroup = "test" ) var ( @@ -69,5 +71,6 @@ func GetTestClusterMetadata(enableGlobalDomain bool, isMasterCluster bool) Metad TestCurrentClusterName: config.Address{RPCName: common.FrontendServiceName, RPCAddress: TestCurrentClusterFrontendAddress}, TestAlternativeClusterName: config.Address{RPCName: common.FrontendServiceName, RPCAddress: TestAlternativeClusterFrontendAddress}, }, + TestDeploymentGroup, ) } diff --git a/common/convert.go b/common/convert.go index 1b1f4c04860..b21b6ef0bbc 100644 --- a/common/convert.go +++ b/common/convert.go @@ -129,6 +129,11 @@ func ChildWorkflowExecutionFailedCausePtr(t s.ChildWorkflowExecutionFailedCause) return &t } +// ArchivalStatusPtr makes a copy and returns the pointer to an ArchivalStatus. +func ArchivalStatusPtr(t s.ArchivalStatus) *s.ArchivalStatus { + return &t +} + // StringDefault returns value if string pointer is set otherwise default value of string func StringDefault(v *string) string { var defaultString string diff --git a/common/mocks/ClusterMetadata.go b/common/mocks/ClusterMetadata.go index b88c41d3333..45136a5edd5 100644 --- a/common/mocks/ClusterMetadata.go +++ b/common/mocks/ClusterMetadata.go @@ -88,6 +88,20 @@ func (_m *ClusterMetadata) GetMasterClusterName() string { return r0 } +// GetDeploymentGroup provides a mock function with given fields: +func (_m *ClusterMetadata) GetDeploymentGroup() string { + ret := _m.Called() + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // GetNextFailoverVersion provides a mock function with given fields: _a0, _a1 func (_m *ClusterMetadata) GetNextFailoverVersion(_a0 string, _a1 int64) int64 { ret := _m.Called(_a0, _a1) diff --git a/common/persistence/cassandra/cassandraMetadataPersistence.go b/common/persistence/cassandra/cassandraMetadataPersistence.go index 03cc1f9ab61..4cdff60a940 100644 --- a/common/persistence/cassandra/cassandraMetadataPersistence.go +++ b/common/persistence/cassandra/cassandraMetadataPersistence.go @@ -42,7 +42,9 @@ const ( templateDomainConfigType = `{` + `retention: ?, ` + - `emit_metric: ?` + + `emit_metric: ?, ` + + `archival_bucket: ?, ` + + `archival_status: ?` + `}` templateDomainReplicationConfigType = `{` + @@ -64,6 +66,7 @@ const ( templateGetDomainByNameQuery = `SELECT domain.id, domain.name, domain.status, domain.description, ` + `domain.owner_email, domain.data, config.retention, config.emit_metric, ` + + `config.archival_bucket, config.archival_status, ` + `replication_config.active_cluster_name, replication_config.clusters, ` + `is_global_domain, ` + `config_version, ` + @@ -152,6 +155,8 @@ func (m *cassandraMetadataPersistence) CreateDomain(request *p.CreateDomainReque request.Info.Data, request.Config.Retention, request.Config.EmitMetric, + request.Config.ArchivalBucket, + request.Config.ArchivalStatus, request.ReplicationConfig.ActiveClusterName, p.SerializeClusterConfigs(request.ReplicationConfig.Clusters), request.IsGlobalDomain, @@ -245,6 +250,8 @@ func (m *cassandraMetadataPersistence) GetDomain(request *p.GetDomainRequest) (* &info.Data, &config.Retention, &config.EmitMetric, + &config.ArchivalBucket, + &config.ArchivalStatus, &replicationConfig.ActiveClusterName, &replicationClusters, &isGlobalDomain, @@ -289,6 +296,8 @@ func (m *cassandraMetadataPersistence) UpdateDomain(request *p.UpdateDomainReque request.Info.Data, request.Config.Retention, request.Config.EmitMetric, + request.Config.ArchivalBucket, + request.Config.ArchivalStatus, request.ReplicationConfig.ActiveClusterName, p.SerializeClusterConfigs(request.ReplicationConfig.Clusters), request.ConfigVersion, @@ -330,7 +339,7 @@ func (m *cassandraMetadataPersistence) DeleteDomain(request *p.DeleteDomainReque func (m *cassandraMetadataPersistence) DeleteDomainByName(request *p.DeleteDomainByNameRequest) error { var ID string query := m.session.Query(templateGetDomainByNameQuery, request.Name) - err := query.Scan(&ID, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) + err := query.Scan(&ID, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) if err != nil { if err == gocql.ErrNotFound { return nil diff --git a/common/persistence/cassandra/cassandraMetadataPersistenceV2.go b/common/persistence/cassandra/cassandraMetadataPersistenceV2.go index 837df140fee..76cae17c2ee 100644 --- a/common/persistence/cassandra/cassandraMetadataPersistenceV2.go +++ b/common/persistence/cassandra/cassandraMetadataPersistenceV2.go @@ -40,6 +40,7 @@ const ( templateGetDomainByNameQueryV2 = `SELECT domain.id, domain.name, domain.status, domain.description, ` + `domain.owner_email, domain.data, config.retention, config.emit_metric, ` + + `config.archival_bucket, config.archival_status, ` + `replication_config.active_cluster_name, replication_config.clusters, ` + `is_global_domain, ` + `config_version, ` + @@ -78,6 +79,7 @@ const ( templateListDomainQueryV2 = `SELECT name, domain.id, domain.name, domain.status, domain.description, ` + `domain.owner_email, domain.data, config.retention, config.emit_metric, ` + + `config.archival_bucket, config.archival_status, ` + `replication_config.active_cluster_name, replication_config.clusters, ` + `is_global_domain, ` + `config_version, ` + @@ -157,6 +159,8 @@ func (m *cassandraMetadataPersistenceV2) CreateDomain(request *p.CreateDomainReq request.Info.Data, request.Config.Retention, request.Config.EmitMetric, + request.Config.ArchivalBucket, + request.Config.ArchivalStatus, request.ReplicationConfig.ActiveClusterName, p.SerializeClusterConfigs(request.ReplicationConfig.Clusters), request.IsGlobalDomain, @@ -213,6 +217,8 @@ func (m *cassandraMetadataPersistenceV2) UpdateDomain(request *p.UpdateDomainReq request.Info.Data, request.Config.Retention, request.Config.EmitMetric, + request.Config.ArchivalBucket, + request.Config.ArchivalStatus, request.ReplicationConfig.ActiveClusterName, p.SerializeClusterConfigs(request.ReplicationConfig.Clusters), request.ConfigVersion, @@ -303,6 +309,8 @@ func (m *cassandraMetadataPersistenceV2) GetDomain(request *p.GetDomainRequest) &info.Data, &config.Retention, &config.EmitMetric, + &config.ArchivalBucket, + &config.ArchivalStatus, &replicationConfig.ActiveClusterName, &replicationClusters, &isGlobalDomain, @@ -360,12 +368,13 @@ func (m *cassandraMetadataPersistenceV2) ListDomains(request *p.ListDomainsReque &name, &domain.Info.ID, &domain.Info.Name, &domain.Info.Status, &domain.Info.Description, &domain.Info.OwnerEmail, &domain.Info.Data, &domain.Config.Retention, &domain.Config.EmitMetric, + &domain.Config.ArchivalBucket, &domain.Config.ArchivalStatus, &domain.ReplicationConfig.ActiveClusterName, &replicationClusters, &domain.IsGlobalDomain, &domain.ConfigVersion, &domain.FailoverVersion, &domain.FailoverNotificationVersion, &domain.NotificationVersion, ) { if name != domainMetadataRecordName { - // do not inlcude the metadata record + // do not include the metadata record if domain.Info.Data == nil { domain.Info.Data = map[string]string{} } @@ -411,7 +420,7 @@ func (m *cassandraMetadataPersistenceV2) DeleteDomain(request *p.DeleteDomainReq func (m *cassandraMetadataPersistenceV2) DeleteDomainByName(request *p.DeleteDomainByNameRequest) error { var ID string query := m.session.Query(templateGetDomainByNameQueryV2, constDomainPartition, request.Name) - err := query.Scan(&ID, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) + err := query.Scan(&ID, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil) if err != nil { if err == gocql.ErrNotFound { return nil diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index f88cc37e91a..d43f2e1ba7b 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -969,8 +969,10 @@ type ( // DomainConfig describes the domain configuration DomainConfig struct { // NOTE: this retention is in days, not in seconds - Retention int32 - EmitMetric bool + Retention int32 + EmitMetric bool + ArchivalBucket string + ArchivalStatus workflow.ArchivalStatus } // DomainReplicationConfig describes the cross DC domain replication configuration diff --git a/common/persistence/persistence-tests/metadataPersistenceTest.go b/common/persistence/persistence-tests/metadataPersistenceTest.go index 03de1e6e3b8..87d3fa19cac 100644 --- a/common/persistence/persistence-tests/metadataPersistenceTest.go +++ b/common/persistence/persistence-tests/metadataPersistenceTest.go @@ -75,6 +75,8 @@ func (m *MetadataPersistenceSuite) TestCreateDomain() { owner := "create-domain-test-owner" retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled isGlobalDomain := false configVersion := int64(0) failoverVersion := int64(0) @@ -90,8 +92,10 @@ func (m *MetadataPersistenceSuite) TestCreateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{}, isGlobalDomain, @@ -116,6 +120,8 @@ func (m *MetadataPersistenceSuite) TestCreateDomain() { m.Equal(data, resp1.Info.Data) m.Equal(retention, resp1.Config.Retention) m.Equal(emitMetric, resp1.Config.EmitMetric) + m.Equal(archivalBucketName, resp1.Config.ArchivalBucket) + m.Equal(archivalStatus, resp1.Config.ArchivalStatus) m.Equal(cluster.TestCurrentClusterName, resp1.ReplicationConfig.ActiveClusterName) m.Equal(1, len(resp1.ReplicationConfig.Clusters)) m.Equal(isGlobalDomain, resp1.IsGlobalDomain) @@ -134,8 +140,10 @@ func (m *MetadataPersistenceSuite) TestCreateDomain() { Data: map[string]string{}, }, &p.DomainConfig{ - Retention: 100, - EmitMetric: false, + Retention: 100, + EmitMetric: false, + ArchivalBucket: "", + ArchivalStatus: gen.ArchivalStatusNeverEnabled, }, &p.DomainReplicationConfig{}, isGlobalDomain, @@ -162,6 +170,8 @@ func (m *MetadataPersistenceSuite) TestGetDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -192,8 +202,10 @@ func (m *MetadataPersistenceSuite) TestGetDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -218,6 +230,8 @@ func (m *MetadataPersistenceSuite) TestGetDomain() { m.Equal(data, resp2.Info.Data) m.Equal(retention, resp2.Config.Retention) m.Equal(emitMetric, resp2.Config.EmitMetric) + m.Equal(archivalBucketName, resp2.Config.ArchivalBucket) + m.Equal(archivalStatus, resp2.Config.ArchivalStatus) m.Equal(clusterActive, resp2.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp2.ReplicationConfig.Clusters)) for index := range clusters { @@ -239,6 +253,8 @@ func (m *MetadataPersistenceSuite) TestGetDomain() { m.Equal(data, resp3.Info.Data) m.Equal(retention, resp3.Config.Retention) m.Equal(emitMetric, resp3.Config.EmitMetric) + m.Equal(archivalBucketName, resp3.Config.ArchivalBucket) + m.Equal(archivalStatus, resp3.Config.ArchivalStatus) m.Equal(clusterActive, resp3.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp3.ReplicationConfig.Clusters)) for index := range clusters { @@ -265,6 +281,8 @@ func (m *MetadataPersistenceSuite) TestConcurrentCreateDomain() { owner := "create-domain-test-owner" retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -297,8 +315,10 @@ func (m *MetadataPersistenceSuite) TestConcurrentCreateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -326,6 +346,8 @@ func (m *MetadataPersistenceSuite) TestConcurrentCreateDomain() { m.Equal(owner, resp.Info.OwnerEmail) m.Equal(retention, resp.Config.Retention) m.Equal(emitMetric, resp.Config.EmitMetric) + m.Equal(archivalBucketName, resp.Config.ArchivalBucket) + m.Equal(archivalStatus, resp.Config.ArchivalStatus) m.Equal(clusterActive, resp.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp.ReplicationConfig.Clusters)) for index := range clusters { @@ -354,6 +376,8 @@ func (m *MetadataPersistenceSuite) TestConcurrentUpdateDomain() { data := map[string]string{"k0": "v0"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -384,8 +408,10 @@ func (m *MetadataPersistenceSuite) TestConcurrentUpdateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -422,8 +448,10 @@ func (m *MetadataPersistenceSuite) TestConcurrentUpdateDomain() { Data: updatedData, }, &p.DomainConfig{ - Retention: resp2.Config.Retention, - EmitMetric: resp2.Config.EmitMetric, + Retention: resp2.Config.Retention, + EmitMetric: resp2.Config.EmitMetric, + ArchivalBucket: resp2.Config.ArchivalBucket, + ArchivalStatus: resp2.Config.ArchivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: resp2.ReplicationConfig.ActiveClusterName, @@ -454,6 +482,8 @@ func (m *MetadataPersistenceSuite) TestConcurrentUpdateDomain() { m.Equal(owner, resp3.Info.OwnerEmail) m.Equal(retention, resp3.Config.Retention) m.Equal(emitMetric, resp3.Config.EmitMetric) + m.Equal(archivalBucketName, resp3.Config.ArchivalBucket) + m.Equal(archivalStatus, resp3.Config.ArchivalStatus) m.Equal(clusterActive, resp3.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp3.ReplicationConfig.Clusters)) for index := range clusters { @@ -482,6 +512,8 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -507,8 +539,10 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -529,6 +563,7 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { updatedData := map[string]string{"k1": "v2"} updatedRetention := int32(20) updatedEmitMetric := false + updatedArchivalStatus := gen.ArchivalStatusDisabled updateClusterActive := "other random active cluster name" updateClusterStandby := "other random standby cluster name" @@ -553,8 +588,10 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { Data: updatedData, }, &p.DomainConfig{ - Retention: updatedRetention, - EmitMetric: updatedEmitMetric, + Retention: updatedRetention, + EmitMetric: updatedEmitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: updatedArchivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: updateClusterActive, @@ -578,6 +615,8 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { m.Equal(updatedData, resp4.Info.Data) m.Equal(updatedRetention, resp4.Config.Retention) m.Equal(updatedEmitMetric, resp4.Config.EmitMetric) + m.Equal(archivalBucketName, resp4.Config.ArchivalBucket) + m.Equal(updatedArchivalStatus, resp4.Config.ArchivalStatus) m.Equal(updateClusterActive, resp4.ReplicationConfig.ActiveClusterName) m.Equal(len(updateClusters), len(resp4.ReplicationConfig.Clusters)) for index := range clusters { @@ -598,6 +637,8 @@ func (m *MetadataPersistenceSuite) TestUpdateDomain() { m.Equal(updatedData, resp5.Info.Data) m.Equal(updatedRetention, resp5.Config.Retention) m.Equal(updatedEmitMetric, resp5.Config.EmitMetric) + m.Equal(archivalBucketName, resp5.Config.ArchivalBucket) + m.Equal(updatedArchivalStatus, resp5.Config.ArchivalStatus) m.Equal(updateClusterActive, resp5.ReplicationConfig.ActiveClusterName) m.Equal(len(updateClusters), len(resp5.ReplicationConfig.Clusters)) for index := range clusters { @@ -618,6 +659,8 @@ func (m *MetadataPersistenceSuite) TestDeleteDomain() { data := map[string]string{"k1": "v1"} retention := 10 emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -643,8 +686,10 @@ func (m *MetadataPersistenceSuite) TestDeleteDomain() { Data: data, }, &p.DomainConfig{ - Retention: int32(retention), - EmitMetric: emitMetric, + Retention: int32(retention), + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -685,8 +730,10 @@ func (m *MetadataPersistenceSuite) TestDeleteDomain() { Data: data, }, &p.DomainConfig{ - Retention: int32(retention), - EmitMetric: emitMetric, + Retention: int32(retention), + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, diff --git a/common/persistence/persistence-tests/metadataPersistenceV2Test.go b/common/persistence/persistence-tests/metadataPersistenceV2Test.go index 55df6556af9..7c4bd138675 100644 --- a/common/persistence/persistence-tests/metadataPersistenceV2Test.go +++ b/common/persistence/persistence-tests/metadataPersistenceV2Test.go @@ -96,6 +96,8 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled isGlobalDomain := false configVersion := int64(0) failoverVersion := int64(0) @@ -110,8 +112,10 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{}, isGlobalDomain, @@ -135,6 +139,8 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { m.Equal(data, resp1.Info.Data) m.Equal(retention, resp1.Config.Retention) m.Equal(emitMetric, resp1.Config.EmitMetric) + m.Equal(archivalBucketName, resp1.Config.ArchivalBucket) + m.Equal(archivalStatus, resp1.Config.ArchivalStatus) m.Equal(cluster.TestCurrentClusterName, resp1.ReplicationConfig.ActiveClusterName) m.Equal(1, len(resp1.ReplicationConfig.Clusters)) m.Equal(isGlobalDomain, resp1.IsGlobalDomain) @@ -153,8 +159,10 @@ func (m *MetadataPersistenceSuiteV2) TestCreateDomain() { Data: map[string]string{}, }, &p.DomainConfig{ - Retention: 100, - EmitMetric: false, + Retention: 100, + EmitMetric: false, + ArchivalBucket: "", + ArchivalStatus: gen.ArchivalStatusNeverEnabled, }, &p.DomainReplicationConfig{}, isGlobalDomain, @@ -176,6 +184,8 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -206,8 +216,10 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -232,6 +244,8 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { m.Equal(data, resp2.Info.Data) m.Equal(retention, resp2.Config.Retention) m.Equal(emitMetric, resp2.Config.EmitMetric) + m.Equal(archivalBucketName, resp2.Config.ArchivalBucket) + m.Equal(archivalStatus, resp2.Config.ArchivalStatus) m.Equal(clusterActive, resp2.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp2.ReplicationConfig.Clusters)) for index := range clusters { @@ -253,6 +267,8 @@ func (m *MetadataPersistenceSuiteV2) TestGetDomain() { m.Equal(data, resp3.Info.Data) m.Equal(retention, resp3.Config.Retention) m.Equal(emitMetric, resp3.Config.EmitMetric) + m.Equal(archivalBucketName, resp3.Config.ArchivalBucket) + m.Equal(archivalStatus, resp3.Config.ArchivalStatus) m.Equal(clusterActive, resp3.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp3.ReplicationConfig.Clusters)) for index := range clusters { @@ -283,6 +299,8 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentCreateDomain() { owner := "create-domain-test-owner" retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -315,8 +333,10 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentCreateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -344,6 +364,8 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentCreateDomain() { m.Equal(owner, resp.Info.OwnerEmail) m.Equal(retention, resp.Config.Retention) m.Equal(emitMetric, resp.Config.EmitMetric) + m.Equal(archivalBucketName, resp.Config.ArchivalBucket) + m.Equal(archivalStatus, resp.Config.ArchivalStatus) m.Equal(clusterActive, resp.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp.ReplicationConfig.Clusters)) for index := range clusters { @@ -371,6 +393,8 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -396,8 +420,10 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -433,8 +459,10 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { Data: updatedData, }, &p.DomainConfig{ - Retention: resp2.Config.Retention, - EmitMetric: resp2.Config.EmitMetric, + Retention: resp2.Config.Retention, + EmitMetric: resp2.Config.EmitMetric, + ArchivalBucket: resp2.Config.ArchivalBucket, + ArchivalStatus: resp2.Config.ArchivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: resp2.ReplicationConfig.ActiveClusterName, @@ -465,6 +493,8 @@ func (m *MetadataPersistenceSuiteV2) TestConcurrentUpdateDomain() { m.Equal(retention, resp3.Config.Retention) m.Equal(emitMetric, resp3.Config.EmitMetric) + m.Equal(archivalBucketName, resp3.Config.ArchivalBucket) + m.Equal(archivalStatus, resp3.Config.ArchivalStatus) m.Equal(clusterActive, resp3.ReplicationConfig.ActiveClusterName) m.Equal(len(clusters), len(resp3.ReplicationConfig.Clusters)) for index := range clusters { @@ -492,6 +522,8 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { data := map[string]string{"k1": "v1"} retention := int32(10) emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -517,8 +549,10 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { Data: data, }, &p.DomainConfig{ - Retention: retention, - EmitMetric: emitMetric, + Retention: retention, + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -544,6 +578,7 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { updatedData := map[string]string{"k1": "v2"} updatedRetention := int32(20) updatedEmitMetric := false + updatedArchivalStatus := gen.ArchivalStatusDisabled updateClusterActive := "other random active cluster name" updateClusterStandby := "other random standby cluster name" @@ -569,8 +604,10 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { Data: updatedData, }, &p.DomainConfig{ - Retention: updatedRetention, - EmitMetric: updatedEmitMetric, + Retention: updatedRetention, + EmitMetric: updatedEmitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: updatedArchivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: updateClusterActive, @@ -594,6 +631,8 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { m.Equal(updatedData, resp4.Info.Data) m.Equal(updatedRetention, resp4.Config.Retention) m.Equal(updatedEmitMetric, resp4.Config.EmitMetric) + m.Equal(archivalBucketName, resp4.Config.ArchivalBucket) + m.Equal(updatedArchivalStatus, resp4.Config.ArchivalStatus) m.Equal(updateClusterActive, resp4.ReplicationConfig.ActiveClusterName) m.Equal(len(updateClusters), len(resp4.ReplicationConfig.Clusters)) for index := range clusters { @@ -615,6 +654,8 @@ func (m *MetadataPersistenceSuiteV2) TestUpdateDomain() { m.Equal(updatedData, resp5.Info.Data) m.Equal(updatedRetention, resp5.Config.Retention) m.Equal(updatedEmitMetric, resp5.Config.EmitMetric) + m.Equal(archivalBucketName, resp5.Config.ArchivalBucket) + m.Equal(updatedArchivalStatus, resp5.Config.ArchivalStatus) m.Equal(updateClusterActive, resp5.ReplicationConfig.ActiveClusterName) m.Equal(len(updateClusters), len(resp5.ReplicationConfig.Clusters)) for index := range clusters { @@ -636,6 +677,8 @@ func (m *MetadataPersistenceSuiteV2) TestDeleteDomain() { data := map[string]string{"k1": "v1"} retention := 10 emitMetric := true + archivalBucketName := "bucket-test-name" + archivalStatus := gen.ArchivalStatusEnabled clusterActive := "some random active cluster name" clusterStandby := "some random standby cluster name" @@ -661,8 +704,10 @@ func (m *MetadataPersistenceSuiteV2) TestDeleteDomain() { Data: data, }, &p.DomainConfig{ - Retention: int32(retention), - EmitMetric: emitMetric, + Retention: int32(retention), + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -703,8 +748,10 @@ func (m *MetadataPersistenceSuiteV2) TestDeleteDomain() { Data: data, }, &p.DomainConfig{ - Retention: int32(retention), - EmitMetric: emitMetric, + Retention: int32(retention), + EmitMetric: emitMetric, + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, &p.DomainReplicationConfig{ ActiveClusterName: clusterActive, @@ -766,8 +813,10 @@ func (m *MetadataPersistenceSuiteV2) TestListDomains() { Data: map[string]string{"k1": "v1"}, }, Config: &p.DomainConfig{ - Retention: 109, - EmitMetric: true, + Retention: 109, + EmitMetric: true, + ArchivalBucket: "bucket-test-name", + ArchivalStatus: gen.ArchivalStatusEnabled, }, ReplicationConfig: &p.DomainReplicationConfig{ ActiveClusterName: clusterActive1, @@ -788,8 +837,10 @@ func (m *MetadataPersistenceSuiteV2) TestListDomains() { Data: map[string]string{"k1": "v2"}, }, Config: &p.DomainConfig{ - Retention: 326, - EmitMetric: false, + Retention: 326, + EmitMetric: false, + ArchivalBucket: "", + ArchivalStatus: gen.ArchivalStatusNeverEnabled, }, ReplicationConfig: &p.DomainReplicationConfig{ ActiveClusterName: clusterActive2, diff --git a/common/persistence/sql/sqlMetadataManagerV2.go b/common/persistence/sql/sqlMetadataManagerV2.go index 8f48d4b29f1..a86b0b937f5 100644 --- a/common/persistence/sql/sqlMetadataManagerV2.go +++ b/common/persistence/sql/sqlMetadataManagerV2.go @@ -80,6 +80,8 @@ const ( name, retention, emit_metric, + archival_bucket, + archival_status, config_version, status, description, @@ -97,6 +99,8 @@ const ( :name, :retention, :emit_metric, + :archival_bucket, + :archival_status, :config_version, :status, :description, @@ -114,6 +118,8 @@ const ( id, retention, emit_metric, + archival_bucket, + archival_status, config_version, name, status, @@ -137,6 +143,8 @@ FROM domains SET retention = :retention, emit_metric = :emit_metric, + archival_bucket = :archival_bucket, + archival_status = :archival_status, config_version = :config_version, status = :status, description = :description, diff --git a/common/service/config/config.go b/common/service/config/config.go index 0f5afea72e6..08882d57b1c 100644 --- a/common/service/config/config.go +++ b/common/service/config/config.go @@ -199,6 +199,8 @@ type ( ClusterInitialFailoverVersions map[string]int64 `yaml:"clusterInitialFailoverVersion"` // ClusterAddress contains all cluster names to corresponding address ClusterAddress map[string]Address `yaml:"clusterAddress"` + // DeploymentGroup contains the deployment group name + DeploymentGroup string `yaml:"deploymentGroup"` } // Address indicate the remote cluster's service name and address diff --git a/config/development.yaml b/config/development.yaml index f50fd6e9bfb..de2c9f1623f 100644 --- a/config/development.yaml +++ b/config/development.yaml @@ -76,6 +76,7 @@ clustersInfo: active: rpcName: "cadence-frontend" rpcAddress: "127.0.0.1:7933" + deploymentGroup: "development" kafka: clusters: diff --git a/config/development_active.yaml b/config/development_active.yaml index 056a56e8c0a..30de97f7ad2 100644 --- a/config/development_active.yaml +++ b/config/development_active.yaml @@ -80,6 +80,7 @@ clustersInfo: standby: rpcName: "cadence-frontend" rpcAddress: "127.0.0.1:8933" + deploymentGroup: "development" kafka: clusters: diff --git a/config/development_standby.yaml b/config/development_standby.yaml index ae674be607e..5c96a59c3aa 100644 --- a/config/development_standby.yaml +++ b/config/development_standby.yaml @@ -80,6 +80,7 @@ clustersInfo: standby: rpcName: "cadence-frontend" rpcAddress: "127.0.0.1:8933" + deploymentGroup: "development" kafka: clusters: diff --git a/docker/config_template.yaml b/docker/config_template.yaml index 779490308ba..06a3dc1a7ff 100644 --- a/docker/config_template.yaml +++ b/docker/config_template.yaml @@ -72,3 +72,4 @@ clustersInfo: active: rpcName: "cadence-frontend" rpcAddress: "127.0.0.1:7933" + deploymentGroup: "development" diff --git a/hostxdc/Integration_domain_failover_test.go b/hostxdc/Integration_domain_failover_test.go index 5fd1ccef9cd..5e27e694822 100644 --- a/hostxdc/Integration_domain_failover_test.go +++ b/hostxdc/Integration_domain_failover_test.go @@ -100,6 +100,7 @@ var ( clusterName[0]: config.Address{RPCName: common.FrontendServiceName, RPCAddress: clusterAddress[0]}, clusterName[1]: config.Address{RPCName: common.FrontendServiceName, RPCAddress: clusterAddress[1]}, }, + DeploymentGroup: "test", }, { EnableGlobalDomain: true, @@ -111,6 +112,7 @@ var ( clusterName[0]: config.Address{RPCName: common.FrontendServiceName, RPCAddress: clusterAddress[0]}, clusterName[1]: config.Address{RPCName: common.FrontendServiceName, RPCAddress: clusterAddress[1]}, }, + DeploymentGroup: "test", }, } clusterReplicationConfig = []*workflow.ClusterReplicationConfiguration{ @@ -140,6 +142,7 @@ func (s *testCluster) setupCluster(no int, enableEventsV2 bool) { clusterInfo.CurrentClusterName, clusterInfo.ClusterInitialFailoverVersions, clusterInfo.ClusterAddress, + clusterInfo.DeploymentGroup, ) s.TestBase = persistencetests.NewTestBaseWithCassandra(&options) s.TestBase.Setup() diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 844490bd9fb..4e5a2d47ef3 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -241,6 +241,12 @@ enum TaskListKind { STICKY, } +enum ArchivalStatus { + NEVER_ENABLED, + DISABLED, + ENABLED, +} + struct Header { 10: optional map fields } @@ -825,6 +831,10 @@ struct DomainInfo { struct DomainConfiguration { 10: optional i32 workflowExecutionRetentionPeriodInDays 20: optional bool emitMetric + 30: optional string archivalBucketName + 40: optional i32 archivalRetentionPeriodInDays + 50: optional ArchivalStatus archivalStatus + 60: optional string archivalBucketOwner } struct UpdateDomainInfo { @@ -854,6 +864,8 @@ struct RegisterDomainRequest { // A key-value map for any customized purpose 80: optional map data 90: optional string securityToken + 100: optional bool enableArchival + 110: optional string customArchivalBucketName } struct ListDomainsRequest { diff --git a/schema/cassandra/cadence/schema.cql b/schema/cassandra/cadence/schema.cql index 2d87ac90caa..41a71defd63 100644 --- a/schema/cassandra/cadence/schema.cql +++ b/schema/cassandra/cadence/schema.cql @@ -230,7 +230,9 @@ CREATE TYPE domain ( CREATE TYPE domain_config ( retention int, - emit_metric boolean + emit_metric boolean, + archival_bucket text, + archival_status int ); CREATE TYPE cluster_replication_config ( diff --git a/schema/cassandra/cadence/versioned/v0.13/add_archival_config.cql b/schema/cassandra/cadence/versioned/v0.13/add_archival_config.cql new file mode 100644 index 00000000000..bd0faab8cc2 --- /dev/null +++ b/schema/cassandra/cadence/versioned/v0.13/add_archival_config.cql @@ -0,0 +1,2 @@ +ALTER TYPE domain_config ADD archival_bucket text; +ALTER TYPE domain_config ADD archival_status int; diff --git a/schema/cassandra/cadence/versioned/v0.13/manifest.json b/schema/cassandra/cadence/versioned/v0.13/manifest.json new file mode 100644 index 00000000000..7179f6e5946 --- /dev/null +++ b/schema/cassandra/cadence/versioned/v0.13/manifest.json @@ -0,0 +1,8 @@ +{ + "CurrVersion": "0.13", + "MinCompatibleVersion": "0.13", + "Description": "Add archival config to domain config", + "SchemaUpdateCqlFiles": [ + "add_archival_config.cql" + ] +} \ No newline at end of file diff --git a/schema/mysql/v56/cadence/schema.sql b/schema/mysql/v56/cadence/schema.sql index b436706db54..19e3460fc7d 100644 --- a/schema/mysql/v56/cadence/schema.sql +++ b/schema/mysql/v56/cadence/schema.sql @@ -9,6 +9,8 @@ CREATE TABLE domains( /* end domain */ retention INT NOT NULL, emit_metric TINYINT(1) NOT NULL, + archival_bucket VARCHAR(255) NOT NULL, + archival_status TINYINT NOT NULL, /* end domain_config */ config_version BIGINT NOT NULL, notification_version BIGINT NOT NULL, diff --git a/schema/mysql/v57/cadence/schema.sql b/schema/mysql/v57/cadence/schema.sql index d72c554c5a4..0df8770e385 100644 --- a/schema/mysql/v57/cadence/schema.sql +++ b/schema/mysql/v57/cadence/schema.sql @@ -9,6 +9,8 @@ CREATE TABLE domains( /* end domain */ retention INT NOT NULL, emit_metric TINYINT(1) NOT NULL, + archival_bucket VARCHAR(255) NOT NULL, + archival_status TINYINT NOT NULL, /* end domain_config */ config_version BIGINT NOT NULL, notification_version BIGINT NOT NULL, diff --git a/service/frontend/workflowHandler.go b/service/frontend/workflowHandler.go index daf429e55d0..fbfb08cbb7f 100644 --- a/service/frontend/workflowHandler.go +++ b/service/frontend/workflowHandler.go @@ -112,6 +112,13 @@ var ( errInvalidExecutionStartToCloseTimeoutSeconds = &gen.BadRequestError{Message: "A valid ExecutionStartToCloseTimeoutSeconds is not set on request."} errInvalidTaskStartToCloseTimeoutSeconds = &gen.BadRequestError{Message: "A valid TaskStartToCloseTimeoutSeconds is not set on request."} + // archival errors + errSettingBucketNameWithoutEnabling = &gen.BadRequestError{Message: "Request specifies custom bucket without enabling archival."} + errDisallowedStatusChange = &gen.BadRequestError{Message: "Disallowed archival status change. Allowable changes are: never_enabled->enabled, enabled->disabled and disabled->enabled."} + errDisallowedBucketMetadata = &gen.BadRequestError{Message: "Cannot set bucket owner or bucket retention (must update bucket manually)."} + errBucketNameUpdate = &gen.BadRequestError{Message: "Cannot update bucket name after after archival has been enabled for the first time."} + errUnknownArchivalStatus = &gen.BadRequestError{Message: "Got unknown archival status."} + // err indicating that this cluster is not the master, so cannot do domain registration or update errNotMasterCluster = &gen.BadRequestError{Message: "Cluster is not master cluster, cannot do domain registration or domain update."} errCannotAddClusterToLocalDomain = &gen.BadRequestError{Message: "Cannot add more replicated cluster to local domain."} @@ -209,6 +216,10 @@ func (wh *WorkflowHandler) RegisterDomain(ctx context.Context, registerRequest * return wh.error(errRequestNotSet, scope) } + if wh.customBucketNameProvided(registerRequest.CustomArchivalBucketName) && !registerRequest.GetEnableArchival() { + return wh.error(errSettingBucketNameWithoutEnabling, scope) + } + if err := wh.checkPermission(registerRequest.SecurityToken, scope); err != nil { return err } @@ -227,13 +238,13 @@ func (wh *WorkflowHandler) RegisterDomain(ctx context.Context, registerRequest * return wh.error(errDomainNotSet, scope) } - // first check if the name is already resigered as the local domain + // first check if the name is already registered as the local domain _, err := wh.metadataMgr.GetDomain(&persistence.GetDomainRequest{Name: registerRequest.GetName()}) if err != nil { if _, ok := err.(*gen.EntityNotExistsError); !ok { return wh.error(err, scope) } - // extity not exists, we can proceed to create the domain + // entity not exists, we can proceed to create the domain } else { // domain already exists, cannot proceed return wh.error(&gen.DomainAlreadyExistsError{Message: "Domain already exists."}, scope) @@ -269,6 +280,13 @@ func (wh *WorkflowHandler) RegisterDomain(ctx context.Context, registerRequest * return wh.error(errActiveClusterNotInClusters, scope) } + archivalBucketName := "" + archivalStatus := gen.ArchivalStatusNeverEnabled + if registerRequest.GetEnableArchival() { + archivalBucketName = wh.bucketName(registerRequest.CustomArchivalBucketName) + archivalStatus = gen.ArchivalStatusEnabled + } + domainRequest := &persistence.CreateDomainRequest{ Info: &persistence.DomainInfo{ ID: uuid.New(), @@ -279,8 +297,10 @@ func (wh *WorkflowHandler) RegisterDomain(ctx context.Context, registerRequest * Data: registerRequest.Data, }, Config: &persistence.DomainConfig{ - Retention: registerRequest.GetWorkflowExecutionRetentionPeriodInDays(), - EmitMetric: registerRequest.GetEmitMetric(), + Retention: registerRequest.GetWorkflowExecutionRetentionPeriodInDays(), + EmitMetric: registerRequest.GetEmitMetric(), + ArchivalBucket: archivalBucketName, + ArchivalStatus: archivalStatus, }, ReplicationConfig: &persistence.DomainReplicationConfig{ ActiveClusterName: activeClusterName, @@ -341,7 +361,7 @@ func (wh *WorkflowHandler) ListDomains(ctx context.Context, IsGlobalDomain: common.BoolPtr(d.IsGlobalDomain), FailoverVersion: common.Int64Ptr(d.FailoverVersion), } - desc.DomainInfo, desc.Configuration, desc.ReplicationConfiguration = createDomainResponse(d.Info, d.Config, d.ReplicationConfig) + desc.DomainInfo, desc.Configuration, desc.ReplicationConfiguration = wh.createDomainResponse(d.Info, d.Config, d.ReplicationConfig) domains = append(domains, desc) } @@ -379,7 +399,7 @@ func (wh *WorkflowHandler) DescribeDomain(ctx context.Context, IsGlobalDomain: common.BoolPtr(resp.IsGlobalDomain), FailoverVersion: common.Int64Ptr(resp.FailoverVersion), } - response.DomainInfo, response.Configuration, response.ReplicationConfiguration = createDomainResponse( + response.DomainInfo, response.Configuration, response.ReplicationConfiguration = wh.createDomainResponse( resp.Info, resp.Config, resp.ReplicationConfig) return response, nil @@ -397,6 +417,21 @@ func (wh *WorkflowHandler) UpdateDomain(ctx context.Context, return nil, wh.error(errRequestNotSet, scope) } + if updateRequest.Configuration != nil { + cfg := updateRequest.Configuration + + // ensure intended archival state transition is to either enable or disable archival + if cfg.ArchivalStatus != nil && cfg.GetArchivalStatus() == gen.ArchivalStatusNeverEnabled { + return nil, wh.error(errDisallowedStatusChange, scope) + } + if cfg.ArchivalBucketOwner != nil || cfg.ArchivalRetentionPeriodInDays != nil { + return nil, wh.error(errDisallowedBucketMetadata, scope) + } + if wh.customBucketNameProvided(cfg.ArchivalBucketName) && cfg.GetArchivalStatus() != gen.ArchivalStatusEnabled { + return nil, wh.error(errSettingBucketNameWithoutEnabling, scope) + } + } + // don't require permission for failover request if !isFailoverRequest(updateRequest) { if err := wh.checkPermission(updateRequest.SecurityToken, scope); err != nil { @@ -435,6 +470,11 @@ func (wh *WorkflowHandler) UpdateDomain(ctx context.Context, failoverVersion := getResponse.FailoverVersion failoverNotificationVersion := getResponse.FailoverNotificationVersion + // ensure that if bucket is already set it cannot be updated + if len(config.ArchivalBucket) != 0 && updateRequest.Configuration != nil && wh.customBucketNameProvided(updateRequest.Configuration.ArchivalBucketName) { + return nil, wh.error(errBucketNameUpdate, scope) + } + // whether active cluster is changed activeClusterChanged := false // whether anything other than active cluster is changed @@ -533,6 +573,35 @@ func (wh *WorkflowHandler) UpdateDomain(ctx context.Context, configurationChanged = true config.Retention = updatedConfig.GetWorkflowExecutionRetentionPeriodInDays() } + if updatedConfig.ArchivalStatus != nil { + name := "" + status := gen.ArchivalStatusNeverEnabled + + switch config.ArchivalStatus { + case gen.ArchivalStatusNeverEnabled: + if updatedConfig.GetArchivalStatus() != gen.ArchivalStatusEnabled { + return nil, wh.error(errDisallowedStatusChange, scope) + } + name = wh.bucketName(updatedConfig.ArchivalBucketName) + status = gen.ArchivalStatusEnabled + case gen.ArchivalStatusDisabled: + if updatedConfig.GetArchivalStatus() != gen.ArchivalStatusEnabled { + return nil, wh.error(errDisallowedStatusChange, scope) + } + name = config.ArchivalBucket + status = gen.ArchivalStatusEnabled + case gen.ArchivalStatusEnabled: + if updatedConfig.GetArchivalStatus() != gen.ArchivalStatusDisabled { + return nil, wh.error(errDisallowedStatusChange, scope) + } + name = config.ArchivalBucket + status = gen.ArchivalStatusDisabled + default: + return nil, wh.error(errUnknownArchivalStatus, scope) + } + config.ArchivalBucket = name + config.ArchivalStatus = status + } } if updateRequest.ReplicationConfiguration != nil { updateReplicationConfig := updateRequest.ReplicationConfiguration @@ -599,7 +668,7 @@ func (wh *WorkflowHandler) UpdateDomain(ctx context.Context, IsGlobalDomain: common.BoolPtr(getResponse.IsGlobalDomain), FailoverVersion: common.Int64Ptr(failoverVersion), } - response.DomainInfo, response.Configuration, response.ReplicationConfiguration = createDomainResponse( + response.DomainInfo, response.Configuration, response.ReplicationConfiguration = wh.createDomainResponse( info, config, replicationConfig) return response, nil } @@ -2731,7 +2800,7 @@ func getDomainStatus(info *persistence.DomainInfo) *gen.DomainStatus { return nil } -func createDomainResponse(info *persistence.DomainInfo, config *persistence.DomainConfig, +func (wh *WorkflowHandler) createDomainResponse(info *persistence.DomainInfo, config *persistence.DomainConfig, replicationConfig *persistence.DomainReplicationConfig) (*gen.DomainInfo, *gen.DomainConfiguration, *gen.DomainReplicationConfiguration) { @@ -2746,6 +2815,19 @@ func createDomainResponse(info *persistence.DomainInfo, config *persistence.Doma configResult := &gen.DomainConfiguration{ EmitMetric: common.BoolPtr(config.EmitMetric), WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(config.Retention), + ArchivalStatus: common.ArchivalStatusPtr(config.ArchivalStatus), + } + + if configResult.GetArchivalStatus() != gen.ArchivalStatusNeverEnabled { + bucketName := config.ArchivalBucket + configResult.ArchivalBucketName = common.StringPtr(bucketName) + metadata, err := wh.blobstoreClient.BucketMetadata(context.Background(), bucketName) + + // TODO: handle error correctly once there is a working implementation of blobstore + if err == nil { + configResult.ArchivalRetentionPeriodInDays = common.Int32Ptr(int32(metadata.RetentionDays)) + configResult.ArchivalBucketOwner = common.StringPtr(metadata.Owner) + } } clusters := []*gen.ClusterReplicationConfiguration{} @@ -2885,3 +2967,14 @@ func (wh *WorkflowHandler) validateClusterName(clusterName string) error { } return nil } + +func (wh *WorkflowHandler) bucketName(customBucketName *string) string { + if wh.customBucketNameProvided(customBucketName) { + return *customBucketName + } + return fmt.Sprintf("cadence_%v", wh.Service.GetClusterMetadata().GetDeploymentGroup()) +} + +func (wh *WorkflowHandler) customBucketNameProvided(customBucketName *string) bool { + return customBucketName != nil && len(*customBucketName) != 0 +} diff --git a/service/frontend/workflowHandler_test.go b/service/frontend/workflowHandler_test.go index b82199c8b92..83895da104c 100644 --- a/service/frontend/workflowHandler_test.go +++ b/service/frontend/workflowHandler_test.go @@ -22,8 +22,11 @@ package frontend import ( "context" + "errors" "github.com/stretchr/testify/suite" + "github.com/uber/cadence/common/blobstore" "github.com/uber/cadence/common/messaging" + "github.com/uber/cadence/common/persistence" "log" "os" "testing" @@ -470,3 +473,520 @@ func (s *workflowHandlerSuite) TestStartWorkflowExecution_Failed_InvalidTaskStar assert.Error(s.T(), err) assert.Equal(s.T(), errInvalidTaskStartToCloseTimeoutSeconds, err) } + +func (s *workflowHandlerSuite) TestRegisterDomain_Failed_CustomBucketGivenButArchivalNotEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + wh := NewWorkflowHandler(s.mockService, config, s.mockMetadataMgr, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := registerDomainRequest(false, common.StringPtr("custom-bucket-name")) + err := wh.RegisterDomain(context.Background(), req) + assert.Error(s.T(), err) + assert.Equal(s.T(), errSettingBucketNameWithoutEnabling, err) + s.mockMetadataMgr.AssertNotCalled(s.T(), "CreateDomain", mock.Anything) +} + +func (s *workflowHandlerSuite) TestRegisterDomain_Success_CustomBucketAndArchivalEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + clusterMetadata.On("GetCurrentClusterName").Return("active") + clusterMetadata.On("GetNextFailoverVersion", mock.Anything, mock.Anything).Return(int64(0)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(nil, &shared.EntityNotExistsError{}) + mMetadataManager.On("CreateDomain", mock.Anything).Return(&persistence.CreateDomainResponse{ + ID: "test-id", + }, nil) + + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := registerDomainRequest(true, common.StringPtr("custom-bucket-name")) + err := wh.RegisterDomain(context.Background(), req) + assert.NoError(s.T(), err) + mMetadataManager.AssertCalled(s.T(), "CreateDomain", mock.Anything) + clusterMetadata.AssertNotCalled(s.T(), "GetDeploymentGroup") +} + +func (s *workflowHandlerSuite) TestRegisterDomain_Success_ArchivalEnabledWithoutCustomBucket() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + clusterMetadata.On("GetCurrentClusterName").Return("active") + clusterMetadata.On("GetNextFailoverVersion", mock.Anything, mock.Anything).Return(int64(0)) + clusterMetadata.On("GetDeploymentGroup").Return("test-deployment-group") + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(nil, &shared.EntityNotExistsError{}) + mMetadataManager.On("CreateDomain", mock.Anything).Return(&persistence.CreateDomainResponse{ + ID: "test-id", + }, nil) + + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := registerDomainRequest(true, common.StringPtr("")) + err := wh.RegisterDomain(context.Background(), req) + assert.NoError(s.T(), err) + mMetadataManager.AssertCalled(s.T(), "CreateDomain", mock.Anything) + clusterMetadata.AssertCalled(s.T(), "GetDeploymentGroup") +} + +func (s *workflowHandlerSuite) TestRegisterDomain_Success_ArchivalNotEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + clusterMetadata.On("GetCurrentClusterName").Return("active") + clusterMetadata.On("GetNextFailoverVersion", mock.Anything, mock.Anything).Return(int64(0)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(nil, &shared.EntityNotExistsError{}) + mMetadataManager.On("CreateDomain", mock.Anything).Return(&persistence.CreateDomainResponse{ + ID: "test-id", + }, nil) + + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := registerDomainRequest(false, common.StringPtr("")) + err := wh.RegisterDomain(context.Background(), req) + assert.NoError(s.T(), err) + mMetadataManager.AssertCalled(s.T(), "CreateDomain", mock.Anything) + clusterMetadata.AssertNotCalled(s.T(), "GetDeploymentGroup") +} + +func (s *workflowHandlerSuite) TestDescribeDomain_Success_ArchivalNeverEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("", shared.ArchivalStatusNeverEnabled), nil) + mBlobstore := &mocks.Client{} + wh := NewWorkflowHandler(s.mockService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr("test-domain"), + } + result, err := wh.DescribeDomain(context.Background(), req) + + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusNeverEnabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(0)) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "") + mBlobstore.AssertNotCalled(s.T(), "BucketMetadata", mock.Anything, mock.Anything) +} + +func (s *workflowHandlerSuite) TestDescribeDomain_Success_ArchivalEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusEnabled), nil) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(s.mockService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr("test-domain"), + } + result, err := wh.DescribeDomain(context.Background(), req) + + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusEnabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "bucket-name") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + mBlobstore.AssertCalled(s.T(), "BucketMetadata", mock.Anything, mock.Anything) +} + +func (s *workflowHandlerSuite) TestDescribeDomain_Success_ArchivalDisabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusDisabled), nil) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(s.mockService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr("test-domain"), + } + result, err := wh.DescribeDomain(context.Background(), req) + + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusDisabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "bucket-name") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + mBlobstore.AssertCalled(s.T(), "BucketMetadata", mock.Anything, mock.Anything) +} + +func (s *workflowHandlerSuite) TestDescribeDomain_Success_BlobstoreReturnsError() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusDisabled), nil) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(nil, errors.New("blobstore error")) + wh := NewWorkflowHandler(s.mockService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr("test-domain"), + } + result, err := wh.DescribeDomain(context.Background(), req) + + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusDisabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "bucket-name") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(0)) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "") + mBlobstore.AssertCalled(s.T(), "BucketMetadata", mock.Anything, mock.Anything) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_StatusChangeToNeverEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + wh := NewWorkflowHandler(s.mockService, config, s.mockMetadataMgr, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + _, err := wh.UpdateDomain(context.Background(), updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusNeverEnabled), nil, nil)) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedStatusChange, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_IllegalBucketOwnerUpdate() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + wh := NewWorkflowHandler(s.mockService, config, s.mockMetadataMgr, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + _, err := wh.UpdateDomain(context.Background(), updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, common.StringPtr("updated-owner"))) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedBucketMetadata, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_IllegalArchivalRetentionUpdate() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + wh := NewWorkflowHandler(s.mockService, config, s.mockMetadataMgr, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + _, err := wh.UpdateDomain(context.Background(), updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), common.Int32Ptr(10), nil)) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedBucketMetadata, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_ProvidedBucketWithoutEnabling() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + wh := NewWorkflowHandler(s.mockService, config, s.mockMetadataMgr, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + _, err := wh.UpdateDomain(context.Background(), updateRequest(common.StringPtr("custom-bucket"), common.ArchivalStatusPtr(shared.ArchivalStatusDisabled), nil, nil)) + assert.Error(s.T(), err) + assert.Equal(s.T(), errSettingBucketNameWithoutEnabling, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_UpdateExistingBucketName() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusDisabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(common.StringPtr("new-bucket"), common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, nil) + _, err := wh.UpdateDomain(context.Background(), updateReq) + assert.Error(s.T(), err) + assert.Equal(s.T(), errBucketNameUpdate, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_ArchivalEnabledToArchivalEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusEnabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, nil) + _, err := wh.UpdateDomain(context.Background(), updateReq) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedStatusChange, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_ArchivalDisabledToArchivalDisabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusDisabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusDisabled), nil, nil) + _, err := wh.UpdateDomain(context.Background(), updateReq) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedStatusChange, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Failure_ArchivalNeverEnabledToArchivalDisabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusNeverEnabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, s.mockBlobstoreClient) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusDisabled), nil, nil) + _, err := wh.UpdateDomain(context.Background(), updateReq) + assert.Error(s.T(), err) + assert.Equal(s.T(), errDisallowedStatusChange, err) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Success_ArchivalEnabledToArchivalDisabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusEnabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusDisabled), nil, nil) + result, err := wh.UpdateDomain(context.Background(), updateReq) + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusDisabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "bucket-name") + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Success_ArchivalDisabledToArchivalEnabled() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("bucket-name", shared.ArchivalStatusDisabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, nil) + result, err := wh.UpdateDomain(context.Background(), updateReq) + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusEnabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "bucket-name") + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Success_ArchivalNeverEnabledToEnabledWithoutCustomBucket() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("", shared.ArchivalStatusNeverEnabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + clusterMetadata.On("GetDeploymentGroup").Return("test-deployment-group") + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(nil, common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, nil) + result, err := wh.UpdateDomain(context.Background(), updateReq) + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusEnabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "cadence_test-deployment-group") + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) +} + +func (s *workflowHandlerSuite) TestUpdateDomain_Success_ArchivalNeverEnabledToEnabledWithCustomBucket() { + config := NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger)) + mMetadataManager := &mocks.MetadataManager{} + mMetadataManager.On("GetMetadata").Return(&persistence.GetMetadataResponse{ + NotificationVersion: int64(0), + }, nil) + mMetadataManager.On("GetDomain", mock.Anything).Return(persistenceGetDomainResponse("", shared.ArchivalStatusNeverEnabled), nil) + clusterMetadata := &mocks.ClusterMetadata{} + clusterMetadata.On("IsGlobalDomainEnabled").Return(false) + mService := cs.NewTestService(clusterMetadata, s.mockMessagingClient, s.mockMetricClient, s.logger) + mBlobstore := &mocks.Client{} + mBlobstore.On("BucketMetadata", mock.Anything, mock.Anything).Return(bucketMetadataResponse("test-owner", 10), nil) + wh := NewWorkflowHandler(mService, config, mMetadataManager, s.mockHistoryMgr, s.mockHistoryV2Mgr, + s.mockVisibilityMgr, s.mockProducer, mBlobstore) + wh.metricsClient = wh.Service.GetMetricsClient() + wh.startWG.Done() + + updateReq := updateRequest(common.StringPtr("custom-bucket"), common.ArchivalStatusPtr(shared.ArchivalStatusEnabled), nil, nil) + result, err := wh.UpdateDomain(context.Background(), updateReq) + assert.NoError(s.T(), err) + assert.NotNil(s.T(), result) + assert.NotNil(s.T(), result.Configuration) + assert.Equal(s.T(), result.Configuration.GetArchivalStatus(), shared.ArchivalStatusEnabled) + assert.Equal(s.T(), result.Configuration.GetArchivalBucketName(), "custom-bucket") + assert.Equal(s.T(), result.Configuration.GetArchivalBucketOwner(), "test-owner") + assert.Equal(s.T(), result.Configuration.GetArchivalRetentionPeriodInDays(), int32(10)) + clusterMetadata.AssertNotCalled(s.T(), "GetDeploymentGroup") +} + +func bucketMetadataResponse(owner string, retentionDays int) *blobstore.BucketMetadataResponse { + return &blobstore.BucketMetadataResponse{ + Owner: owner, + RetentionDays: retentionDays, + } +} + +func updateRequest(archivalBucketName *string, archivalStatus *shared.ArchivalStatus, archivalRetentionDays *int32, archivalOwner *string) *shared.UpdateDomainRequest { + return &shared.UpdateDomainRequest{ + Name: common.StringPtr("test-name"), + Configuration: &shared.DomainConfiguration{ + ArchivalBucketName: archivalBucketName, + ArchivalStatus: archivalStatus, + ArchivalRetentionPeriodInDays: archivalRetentionDays, + ArchivalBucketOwner: archivalOwner, + }, + } +} + +func persistenceGetDomainResponse(archivalBucket string, archivalStatus shared.ArchivalStatus) *persistence.GetDomainResponse { + return &persistence.GetDomainResponse{ + Info: &persistence.DomainInfo{ + ID: "test-id", + Name: "test-name", + Status: 0, + Description: "test-description", + OwnerEmail: "test-owner-email", + Data: make(map[string]string), + }, + Config: &persistence.DomainConfig{ + Retention: 0, + EmitMetric: true, + ArchivalBucket: archivalBucket, + ArchivalStatus: archivalStatus, + }, + ReplicationConfig: &persistence.DomainReplicationConfig{ + ActiveClusterName: "active", + Clusters: []*persistence.ClusterReplicationConfig{ + { + ClusterName: "active", + }, + { + ClusterName: "standby", + }, + }, + }, + IsGlobalDomain: false, + ConfigVersion: 0, + FailoverVersion: 0, + FailoverNotificationVersion: 0, + NotificationVersion: 0, + TableVersion: 0, + } +} + +func registerDomainRequest(enableArchival bool, customBucketName *string) *shared.RegisterDomainRequest { + return &shared.RegisterDomainRequest{ + Name: common.StringPtr("test-domain"), + Description: common.StringPtr("test-description"), + OwnerEmail: common.StringPtr("test-owner-email"), + WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(10), + EmitMetric: common.BoolPtr(true), + Clusters: []*shared.ClusterReplicationConfiguration{ + { + ClusterName: common.StringPtr("active"), + }, + { + ClusterName: common.StringPtr("standby"), + }, + }, + ActiveClusterName: common.StringPtr("active"), + Data: make(map[string]string), + SecurityToken: common.StringPtr("token"), + EnableArchival: common.BoolPtr(enableArchival), + CustomArchivalBucketName: customBucketName, + } +} diff --git a/tools/cassandra/updateTask_test.go b/tools/cassandra/updateTask_test.go index a91af3ad9ec..a81ab06c39a 100644 --- a/tools/cassandra/updateTask_test.go +++ b/tools/cassandra/updateTask_test.go @@ -130,7 +130,7 @@ func (s *UpdateSchemaTestSuite) TestDryrun() { s.Nil(err) // update the version to the latest s.log.Infof("Ver: %v", ver) - s.Equal(0, cmpVersion(ver, "0.12")) + s.Equal(0, cmpVersion(ver, "0.13")) dropAllTablesTypes(client) } diff --git a/tools/cli/admin.go b/tools/cli/admin.go index 8ec146d2ab4..6a1685acd89 100644 --- a/tools/cli/admin.go +++ b/tools/cli/admin.go @@ -238,6 +238,117 @@ func newAdminDomainCommands() []cli.Command { AdminGetDomainIDOrName(c) }, }, + // TODO: remove this command and add archival config options to domains.go once archival is finished + { + Name: "register", + Aliases: []string{"re"}, + Usage: "Register workflow domain", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: FlagDescriptionWithAlias, + Usage: "Domain description", + }, + cli.StringFlag{ + Name: FlagOwnerEmailWithAlias, + Usage: "Owner email", + }, + cli.StringFlag{ + Name: FlagRetentionDaysWithAlias, + Usage: "Workflow execution retention in days", + }, + cli.StringFlag{ + Name: FlagEmitMetricWithAlias, + Usage: "Flag to emit metric", + }, + cli.StringFlag{ + Name: FlagActiveClusterNameWithAlias, + Usage: "Active cluster name", + }, + cli.StringFlag{ // use StringFlag instead of buggy StringSliceFlag + Name: FlagClustersWithAlias, + Usage: "Clusters", + }, + cli.StringFlag{ + Name: FlagDomainDataWithAlias, + Usage: "Domain data of key value pairs, in format of k1:v1,k2:v2,k3:v3", + }, + cli.StringFlag{ + Name: FlagSecurityTokenWithAlias, + Usage: "Security token with permission", + }, + cli.StringFlag{ + Name: FlagEnableArchivalWithAlias, + Usage: "Flag to enable archival", + }, + cli.StringFlag{ + Name: FlagCustomArchivalBucketNameWithAlias, + Usage: "Optional custom bucket to use for archival (cannot be changed once archival is enabled)", + }, + }, + Action: func(c *cli.Context) { + AdminRegisterDomain(c) + }, + }, + // TODO: remove this command and add archival config options to domains.go once archival is finished + { + Name: "update", + Aliases: []string{"up", "u"}, + Usage: "Update existing workflow domain", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: FlagDescriptionWithAlias, + Usage: "Domain description", + }, + cli.StringFlag{ + Name: FlagOwnerEmailWithAlias, + Usage: "Owner email", + }, + cli.StringFlag{ + Name: FlagRetentionDaysWithAlias, + Usage: "Workflow execution retention in days", + }, + cli.StringFlag{ + Name: FlagEmitMetricWithAlias, + Usage: "Flag to emit metric", + }, + cli.StringFlag{ + Name: FlagActiveClusterNameWithAlias, + Usage: "Active cluster name", + }, + cli.StringFlag{ // use StringFlag instead of buggy StringSliceFlag + Name: FlagClustersWithAlias, + Usage: "Clusters", + }, + cli.StringFlag{ + Name: FlagDomainDataWithAlias, + Usage: "Domain data of key value pairs, in format of k1:v1,k2:v2,k3:v3 ", + }, + cli.StringFlag{ + Name: FlagSecurityTokenWithAlias, + Usage: "Security token with permission ", + }, + cli.StringFlag{ + Name: FlagArchivalStatusWithAlias, + Usage: "Flag to update archival status, valid values are: {enabled, disabled}", + }, + cli.StringFlag{ + Name: FlagCustomArchivalBucketNameWithAlias, + Usage: "Optional custom bucket to use for archival (cannot be changed once archival is enabled)", + }, + }, + Action: func(c *cli.Context) { + AdminUpdateDomain(c) + }, + }, + // TODO: remove this command and add archival config options to domains.go once archival is finished + { + Name: "describe", + Aliases: []string{"desc"}, + Usage: "Describe existing workflow domain", + Action: func(c *cli.Context) { + AdminDescribeDomain(c) + }, + }, } } diff --git a/tools/cli/adminDomainCommands.go b/tools/cli/adminDomainCommands.go new file mode 100644 index 00000000000..0b63acf29ec --- /dev/null +++ b/tools/cli/adminDomainCommands.go @@ -0,0 +1,325 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// 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. + +package cli + +import ( + "errors" + "fmt" + "strconv" + + "github.com/uber/cadence/.gen/go/shared" + "github.com/uber/cadence/common" + "github.com/urfave/cli" +) + +/** +TODO: Move changes in this file to commands.go and delete this file once archival is done + +This file contains a copy of the domain level commands in commands.go. +These commands additionally provide options to interact with domain archival config. +Once archival is finished this file should be deleted and archival config changes should be ported to commands.go. +*/ + +// AdminRegisterDomain register a domain +func AdminRegisterDomain(c *cli.Context) { + frontendClient := cFactory.ServerFrontendClient(c) + domain := getRequiredGlobalOption(c, FlagDomain) + + description := c.String(FlagDescription) + ownerEmail := c.String(FlagOwnerEmail) + retentionDays := defaultDomainRetentionDays + + if c.IsSet(FlagRetentionDays) { + retentionDays = c.Int(FlagRetentionDays) + } + securityToken := c.String(FlagSecurityToken) + emitMetric := false + var err error + if c.IsSet(FlagEmitMetric) { + emitMetric, err = strconv.ParseBool(c.String(FlagEmitMetric)) + if err != nil { + ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagEmitMetric), err) + } + } + + domainData := map[string]string{} + if c.IsSet(FlagDomainData) { + domainDataStr := getRequiredOption(c, FlagDomainData) + domainData, err = parseDomainDataKVs(domainDataStr) + if err != nil { + ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagDomainData), err) + } + } + if len(requiredDomainDataKeys) > 0 { + err = checkRequiredDomainDataKVs(domainData) + if err != nil { + ErrorAndExit("Domain data missed required data.", err) + } + } + + var activeClusterName string + if c.IsSet(FlagActiveClusterName) { + activeClusterName = c.String(FlagActiveClusterName) + } + var clusters []*shared.ClusterReplicationConfiguration + if c.IsSet(FlagClusters) { + clusterStr := c.String(FlagClusters) + clusters = append(clusters, &shared.ClusterReplicationConfiguration{ + ClusterName: common.StringPtr(clusterStr), + }) + for _, clusterStr := range c.Args() { + clusters = append(clusters, &shared.ClusterReplicationConfiguration{ + ClusterName: common.StringPtr(clusterStr), + }) + } + } + + if !c.IsSet(FlagEnableArchival) && c.IsSet(FlagCustomArchivalBucketName) { + ErrorAndExit("Option format is invalid.", errors.New("must enable archival if setting custom bucket name")) + } + + enableArchival := false + if c.IsSet(FlagEnableArchival) { + enableArchival, err = strconv.ParseBool(c.String(FlagEnableArchival)) + if err != nil { + ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagEnableArchival), err) + } + } + + customBucketName := "" + if c.IsSet(FlagCustomArchivalBucketName) { + customBucketName = c.String(FlagCustomArchivalBucketName) + } + + request := &shared.RegisterDomainRequest{ + Name: common.StringPtr(domain), + Description: common.StringPtr(description), + OwnerEmail: common.StringPtr(ownerEmail), + Data: domainData, + WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(int32(retentionDays)), + EmitMetric: common.BoolPtr(emitMetric), + Clusters: clusters, + ActiveClusterName: common.StringPtr(activeClusterName), + SecurityToken: common.StringPtr(securityToken), + EnableArchival: common.BoolPtr(enableArchival), + CustomArchivalBucketName: common.StringPtr(customBucketName), + } + + ctx, cancel := newContext() + defer cancel() + err = frontendClient.RegisterDomain(ctx, request) + if err != nil { + if _, ok := err.(*shared.DomainAlreadyExistsError); !ok { + ErrorAndExit("Register Domain operation failed.", err) + } else { + ErrorAndExit(fmt.Sprintf("Domain %s already registered.", domain), err) + } + } else { + fmt.Printf("Domain %s successfully registered.\n", domain) + } +} + +// AdminUpdateDomain updates a domain +func AdminUpdateDomain(c *cli.Context) { + frontendClient := cFactory.ServerFrontendClient(c) + domain := getRequiredGlobalOption(c, FlagDomain) + + var updateRequest *shared.UpdateDomainRequest + ctx, cancel := newContext() + defer cancel() + + if c.IsSet(FlagActiveClusterName) { + activeCluster := c.String(FlagActiveClusterName) + fmt.Printf("Will set active cluster name to: %s, other flag will be omitted.\n", activeCluster) + replicationConfig := &shared.DomainReplicationConfiguration{ + ActiveClusterName: common.StringPtr(activeCluster), + } + updateRequest = &shared.UpdateDomainRequest{ + Name: common.StringPtr(domain), + ReplicationConfiguration: replicationConfig, + } + } else { + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr(domain), + } + resp, err := frontendClient.DescribeDomain(ctx, req) + if err != nil { + if _, ok := err.(*shared.EntityNotExistsError); !ok { + ErrorAndExit("Operation UpdateDomain failed.", err) + } else { + ErrorAndExit(fmt.Sprintf("Domain %s does not exist.", domain), err) + } + return + } + + description := resp.DomainInfo.GetDescription() + ownerEmail := resp.DomainInfo.GetOwnerEmail() + retentionDays := resp.Configuration.GetWorkflowExecutionRetentionPeriodInDays() + emitMetric := resp.Configuration.GetEmitMetric() + var clusters []*shared.ClusterReplicationConfiguration + + if c.IsSet(FlagDescription) { + description = c.String(FlagDescription) + } + if c.IsSet(FlagOwnerEmail) { + ownerEmail = c.String(FlagOwnerEmail) + } + domainData := map[string]string{} + if c.IsSet(FlagDomainData) { + domainDataStr := c.String(FlagDomainData) + domainData, err = parseDomainDataKVs(domainDataStr) + if err != nil { + ErrorAndExit("Domain data format is invalid.", err) + } + } + if c.IsSet(FlagRetentionDays) { + retentionDays = int32(c.Int(FlagRetentionDays)) + } + if c.IsSet(FlagEmitMetric) { + emitMetric, err = strconv.ParseBool(c.String(FlagEmitMetric)) + if err != nil { + ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagEmitMetric), err) + } + } + if c.IsSet(FlagClusters) { + clusterStr := c.String(FlagClusters) + clusters = append(clusters, &shared.ClusterReplicationConfiguration{ + ClusterName: common.StringPtr(clusterStr), + }) + for _, clusterStr := range c.Args() { + clusters = append(clusters, &shared.ClusterReplicationConfiguration{ + ClusterName: common.StringPtr(clusterStr), + }) + } + } + + var archivalStatus *shared.ArchivalStatus + if c.IsSet(FlagArchivalStatus) { + switch c.String(FlagArchivalStatus) { + case "enabled": + archivalStatus = common.ArchivalStatusPtr(shared.ArchivalStatusEnabled) + case "disabled": + archivalStatus = common.ArchivalStatusPtr(shared.ArchivalStatusDisabled) + default: + ErrorAndExit(fmt.Sprintf("Option %s format is invalid.", FlagArchivalStatus), errors.New("invalid status, options are {enabled, disabled}")) + } + } + bucketName := "" + if c.IsSet(FlagCustomArchivalBucketName) { + if archivalStatus == nil || *archivalStatus != shared.ArchivalStatusEnabled { + ErrorAndExit("Option format is invalid.", errors.New("must enable archival if setting custom bucket name")) + } + bucketName = c.String(FlagCustomArchivalBucketName) + } + + updateInfo := &shared.UpdateDomainInfo{ + Description: common.StringPtr(description), + OwnerEmail: common.StringPtr(ownerEmail), + Data: domainData, + } + updateConfig := &shared.DomainConfiguration{ + WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(int32(retentionDays)), + EmitMetric: common.BoolPtr(emitMetric), + ArchivalStatus: archivalStatus, + ArchivalBucketName: common.StringPtr(bucketName), + } + replicationConfig := &shared.DomainReplicationConfiguration{ + Clusters: clusters, + } + updateRequest = &shared.UpdateDomainRequest{ + Name: common.StringPtr(domain), + UpdatedInfo: updateInfo, + Configuration: updateConfig, + ReplicationConfiguration: replicationConfig, + } + } + + securityToken := c.String(FlagSecurityToken) + updateRequest.SecurityToken = common.StringPtr(securityToken) + _, err := frontendClient.UpdateDomain(ctx, updateRequest) + if err != nil { + if _, ok := err.(*shared.EntityNotExistsError); !ok { + ErrorAndExit("Operation UpdateDomain failed.", err) + } else { + ErrorAndExit(fmt.Sprintf("Domain %s does not exist.", domain), err) + } + } else { + fmt.Printf("Domain %s successfully updated.\n", domain) + } +} + +// AdminDescribeDomain updates a domain +func AdminDescribeDomain(c *cli.Context) { + frontendClient := cFactory.ServerFrontendClient(c) + domain := getRequiredGlobalOption(c, FlagDomain) + + ctx, cancel := newContext() + defer cancel() + req := &shared.DescribeDomainRequest{ + Name: common.StringPtr(domain), + } + resp, err := frontendClient.DescribeDomain(ctx, req) + if err != nil { + if _, ok := err.(*shared.EntityNotExistsError); !ok { + ErrorAndExit("Operation DescribeDomain failed.", err) + } else { + ErrorAndExit(fmt.Sprintf("Domain %s does not exist.", domain), err) + } + } else { + archivalStatus := resp.Configuration.GetArchivalStatus() + bucketName := "" + retention := "" + owner := "" + if archivalStatus != shared.ArchivalStatusNeverEnabled { + bucketName = resp.Configuration.GetArchivalBucketName() + retention = fmt.Sprintf("%v", resp.Configuration.GetArchivalRetentionPeriodInDays()) + owner = resp.Configuration.GetArchivalBucketOwner() + } + fmt.Printf("Name: %v\nDescription: %v\nOwnerEmail: %v\nDomainData: %v\nStatus: %v\nRetentionInDays: %v\n"+ + "EmitMetrics: %v\nActiveClusterName: %v\nClusters: %v\nArchivalStatus: %v\n"+ + "BucketName: %v\nArchivalRetentionInDays: %v\nBucketOwner: %v\n", + resp.DomainInfo.GetName(), + resp.DomainInfo.GetDescription(), + resp.DomainInfo.GetOwnerEmail(), + resp.DomainInfo.Data, + resp.DomainInfo.GetStatus(), + resp.Configuration.GetWorkflowExecutionRetentionPeriodInDays(), + resp.Configuration.GetEmitMetric(), + resp.ReplicationConfiguration.GetActiveClusterName(), + serverClustersToString(resp.ReplicationConfiguration.Clusters), + archivalStatus.String(), + bucketName, + retention, + owner) + } +} + +func serverClustersToString(clusters []*shared.ClusterReplicationConfiguration) string { + var res string + for i, cluster := range clusters { + if i == 0 { + res = res + cluster.GetClusterName() + } else { + res = res + ", " + cluster.GetClusterName() + } + } + return res +} diff --git a/tools/cli/commands.go b/tools/cli/commands.go index 2be46dfa1a6..cc18a711599 100644 --- a/tools/cli/commands.go +++ b/tools/cli/commands.go @@ -48,85 +48,92 @@ import ( Flags used to specify cli command line arguments */ const ( - FlagPort = "port" - FlagUsername = "username" - FlagPassword = "password" - FlagKeyspace = "keyspace" - FlagAddress = "address" - FlagAddressWithAlias = FlagAddress + ", ad" - FlagHistoryAddress = "history_address" - FlagHistoryAddressWithAlias = FlagHistoryAddress + ", had" - FlagDomainID = "domain_id" - FlagDomain = "domain" - FlagDomainWithAlias = FlagDomain + ", do" - FlagShardID = "shard_id" - FlagShardIDWithAlias = FlagShardID + ", sid" - FlagWorkflowID = "workflow_id" - FlagWorkflowIDWithAlias = FlagWorkflowID + ", wid, w" - FlagRunID = "run_id" - FlagTreeID = "tree_id" - FlagBranchID = "branch_id" - FlagNumberOfShards = "number_of_shards" - FlagRunIDWithAlias = FlagRunID + ", rid, r" - FlagTargetCluster = "target_cluster" - FlagMinEventID = "min_event_id" - FlagMaxEventID = "max_event_id" - FlagTaskList = "tasklist" - FlagTaskListWithAlias = FlagTaskList + ", tl" - FlagTaskListType = "tasklisttype" - FlagTaskListTypeWithAlias = FlagTaskListType + ", tlt" - FlagWorkflowIDReusePolicy = "workflowidreusepolicy" - FlagWorkflowIDReusePolicyAlias = FlagWorkflowIDReusePolicy + ", wrp" - FlagWorkflowType = "workflow_type" - FlagWorkflowTypeWithAlias = FlagWorkflowType + ", wt" - FlagWorkflowStatus = "status" - FlagWorkflowStatusWithAlias = FlagWorkflowStatus + ", s" - FlagExecutionTimeout = "execution_timeout" - FlagExecutionTimeoutWithAlias = FlagExecutionTimeout + ", et" - FlagDecisionTimeout = "decision_timeout" - FlagDecisionTimeoutWithAlias = FlagDecisionTimeout + ", dt" - FlagContextTimeout = "context_timeout" - FlagContextTimeoutWithAlias = FlagContextTimeout + ", ct" - FlagInput = "input" - FlagInputWithAlias = FlagInput + ", i" - FlagInputFile = "input_file" - FlagInputFileWithAlias = FlagInputFile + ", if" - FlagInputTopic = "input_topic" - FlagInputTopicWithAlias = FlagInputTopic + ", it" - FlagHostFile = "host_file" - FlagCluster = "cluster" - FlagInputCluster = "input_cluster" - FlagStartOffset = "start_offset" - FlagTopic = "topic" - FlagGroup = "group" - FlagReason = "reason" - FlagReasonWithAlias = FlagReason + ", re" - FlagOpen = "open" - FlagOpenWithAlias = FlagOpen + ", op" - FlagMore = "more" - FlagMoreWithAlias = FlagMore + ", m" - FlagPageSize = "pagesize" - FlagPageSizeWithAlias = FlagPageSize + ", ps" - FlagEarliestTime = "earliest_time" - FlagEarliestTimeWithAlias = FlagEarliestTime + ", et" - FlagLatestTime = "latest_time" - FlagLatestTimeWithAlias = FlagLatestTime + ", lt" - FlagPrintEventVersion = "print_event_version" - FlagPrintEventVersionWithAlias = FlagPrintEventVersion + ", pev" - FlagPrintFullyDetail = "print_full" - FlagPrintFullyDetailWithAlias = FlagPrintFullyDetail + ", pf" - FlagPrintRawTime = "print_raw_time" - FlagPrintRawTimeWithAlias = FlagPrintRawTime + ", prt" - FlagPrintDateTime = "print_datetime" - FlagPrintDateTimeWithAlias = FlagPrintDateTime + ", pdt" - FlagDescription = "description" - FlagDescriptionWithAlias = FlagDescription + ", desc" - FlagOwnerEmail = "owner_email" - FlagOwnerEmailWithAlias = FlagOwnerEmail + ", oe" - FlagRetentionDays = "retention" - FlagRetentionDaysWithAlias = FlagRetentionDays + ", rd" - FlagEmitMetric = "emit_metric" - FlagEmitMetricWithAlias = FlagEmitMetric + ", em" + FlagPort = "port" + FlagUsername = "username" + FlagPassword = "password" + FlagKeyspace = "keyspace" + FlagAddress = "address" + FlagAddressWithAlias = FlagAddress + ", ad" + FlagHistoryAddress = "history_address" + FlagHistoryAddressWithAlias = FlagHistoryAddress + ", had" + FlagDomainID = "domain_id" + FlagDomain = "domain" + FlagDomainWithAlias = FlagDomain + ", do" + FlagShardID = "shard_id" + FlagShardIDWithAlias = FlagShardID + ", sid" + FlagWorkflowID = "workflow_id" + FlagWorkflowIDWithAlias = FlagWorkflowID + ", wid, w" + FlagRunID = "run_id" + FlagTreeID = "tree_id" + FlagBranchID = "branch_id" + FlagNumberOfShards = "number_of_shards" + FlagRunIDWithAlias = FlagRunID + ", rid, r" + FlagTargetCluster = "target_cluster" + FlagMinEventID = "min_event_id" + FlagMaxEventID = "max_event_id" + FlagTaskList = "tasklist" + FlagTaskListWithAlias = FlagTaskList + ", tl" + FlagTaskListType = "tasklisttype" + FlagTaskListTypeWithAlias = FlagTaskListType + ", tlt" + FlagWorkflowIDReusePolicy = "workflowidreusepolicy" + FlagWorkflowIDReusePolicyAlias = FlagWorkflowIDReusePolicy + ", wrp" + FlagWorkflowType = "workflow_type" + FlagWorkflowTypeWithAlias = FlagWorkflowType + ", wt" + FlagWorkflowStatus = "status" + FlagWorkflowStatusWithAlias = FlagWorkflowStatus + ", s" + FlagExecutionTimeout = "execution_timeout" + FlagExecutionTimeoutWithAlias = FlagExecutionTimeout + ", et" + FlagDecisionTimeout = "decision_timeout" + FlagDecisionTimeoutWithAlias = FlagDecisionTimeout + ", dt" + FlagContextTimeout = "context_timeout" + FlagContextTimeoutWithAlias = FlagContextTimeout + ", ct" + FlagInput = "input" + FlagInputWithAlias = FlagInput + ", i" + FlagInputFile = "input_file" + FlagInputFileWithAlias = FlagInputFile + ", if" + FlagInputTopic = "input_topic" + FlagInputTopicWithAlias = FlagInputTopic + ", it" + FlagHostFile = "host_file" + FlagCluster = "cluster" + FlagInputCluster = "input_cluster" + FlagStartOffset = "start_offset" + FlagTopic = "topic" + FlagGroup = "group" + FlagReason = "reason" + FlagReasonWithAlias = FlagReason + ", re" + FlagOpen = "open" + FlagOpenWithAlias = FlagOpen + ", op" + FlagMore = "more" + FlagMoreWithAlias = FlagMore + ", m" + FlagPageSize = "pagesize" + FlagPageSizeWithAlias = FlagPageSize + ", ps" + FlagEarliestTime = "earliest_time" + FlagEarliestTimeWithAlias = FlagEarliestTime + ", et" + FlagLatestTime = "latest_time" + FlagLatestTimeWithAlias = FlagLatestTime + ", lt" + FlagPrintEventVersion = "print_event_version" + FlagPrintEventVersionWithAlias = FlagPrintEventVersion + ", pev" + FlagPrintFullyDetail = "print_full" + FlagPrintFullyDetailWithAlias = FlagPrintFullyDetail + ", pf" + FlagPrintRawTime = "print_raw_time" + FlagPrintRawTimeWithAlias = FlagPrintRawTime + ", prt" + FlagPrintDateTime = "print_datetime" + FlagPrintDateTimeWithAlias = FlagPrintDateTime + ", pdt" + FlagDescription = "description" + FlagDescriptionWithAlias = FlagDescription + ", desc" + FlagOwnerEmail = "owner_email" + FlagOwnerEmailWithAlias = FlagOwnerEmail + ", oe" + FlagRetentionDays = "retention" + FlagRetentionDaysWithAlias = FlagRetentionDays + ", rd" + FlagEmitMetric = "emit_metric" + FlagEmitMetricWithAlias = FlagEmitMetric + ", em" + FlagEnableArchival = "enable_archival" + FlagEnableArchivalWithAlias = FlagEnableArchival + ", ea" + FlagArchivalStatus = "archival_status" + FlagArchivalStatusWithAlias = FlagArchivalStatus + ", as" + FlagCustomArchivalBucketName = "custom_bucket" + FlagCustomArchivalBucketNameWithAlias = FlagCustomArchivalBucketName + ", cab" + FlagName = "name" FlagNameWithAlias = FlagName + ", n" FlagOutputFilename = "output_filename"