go.uber.org/cadence@v1.2.9/internal/compatibility/thrift/request.go (about)

     1  // Copyright (c) 2021 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package thrift
    22  
    23  import (
    24  	"go.uber.org/cadence/.gen/go/shared"
    25  
    26  	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
    27  )
    28  
    29  func CountWorkflowExecutionsRequest(t *apiv1.CountWorkflowExecutionsRequest) *shared.CountWorkflowExecutionsRequest {
    30  	if t == nil {
    31  		return nil
    32  	}
    33  	return &shared.CountWorkflowExecutionsRequest{
    34  		Domain: &t.Domain,
    35  		Query:  &t.Query,
    36  	}
    37  }
    38  
    39  func DeprecateDomainRequest(t *apiv1.DeprecateDomainRequest) *shared.DeprecateDomainRequest {
    40  	if t == nil {
    41  		return nil
    42  	}
    43  	return &shared.DeprecateDomainRequest{
    44  		Name:          &t.Name,
    45  		SecurityToken: &t.SecurityToken,
    46  	}
    47  }
    48  
    49  func DescribeDomainRequest(t *apiv1.DescribeDomainRequest) *shared.DescribeDomainRequest {
    50  	if t == nil {
    51  		return nil
    52  	}
    53  
    54  	switch describeBy := t.DescribeBy.(type) {
    55  	case *apiv1.DescribeDomainRequest_Id:
    56  		return &shared.DescribeDomainRequest{UUID: &describeBy.Id}
    57  	case *apiv1.DescribeDomainRequest_Name:
    58  		return &shared.DescribeDomainRequest{Name: &describeBy.Name}
    59  	}
    60  	panic("unknown oneof field is set for DescribeDomainRequest")
    61  }
    62  
    63  func DescribeTaskListRequest(t *apiv1.DescribeTaskListRequest) *shared.DescribeTaskListRequest {
    64  	if t == nil {
    65  		return nil
    66  	}
    67  	return &shared.DescribeTaskListRequest{
    68  		Domain:                &t.Domain,
    69  		TaskList:              TaskList(t.TaskList),
    70  		TaskListType:          TaskListType(t.TaskListType),
    71  		IncludeTaskListStatus: &t.IncludeTaskListStatus,
    72  	}
    73  }
    74  
    75  func DescribeWorkflowExecutionRequest(t *apiv1.DescribeWorkflowExecutionRequest) *shared.DescribeWorkflowExecutionRequest {
    76  	if t == nil {
    77  		return nil
    78  	}
    79  	return &shared.DescribeWorkflowExecutionRequest{
    80  		Domain:    &t.Domain,
    81  		Execution: WorkflowExecution(t.WorkflowExecution),
    82  	}
    83  }
    84  
    85  func GetWorkflowExecutionHistoryRequest(t *apiv1.GetWorkflowExecutionHistoryRequest) *shared.GetWorkflowExecutionHistoryRequest {
    86  	if t == nil {
    87  		return nil
    88  	}
    89  	return &shared.GetWorkflowExecutionHistoryRequest{
    90  		Domain:                 &t.Domain,
    91  		Execution:              WorkflowExecution(t.WorkflowExecution),
    92  		MaximumPageSize:        &t.PageSize,
    93  		NextPageToken:          t.NextPageToken,
    94  		WaitForNewEvent:        &t.WaitForNewEvent,
    95  		HistoryEventFilterType: EventFilterType(t.HistoryEventFilterType),
    96  		SkipArchival:           &t.SkipArchival,
    97  	}
    98  }
    99  
   100  func ListArchivedWorkflowExecutionsRequest(t *apiv1.ListArchivedWorkflowExecutionsRequest) *shared.ListArchivedWorkflowExecutionsRequest {
   101  	if t == nil {
   102  		return nil
   103  	}
   104  	return &shared.ListArchivedWorkflowExecutionsRequest{
   105  		Domain:        &t.Domain,
   106  		PageSize:      &t.PageSize,
   107  		NextPageToken: t.NextPageToken,
   108  		Query:         &t.Query,
   109  	}
   110  }
   111  
   112  func ListDomainsRequest(t *apiv1.ListDomainsRequest) *shared.ListDomainsRequest {
   113  	if t == nil {
   114  		return nil
   115  	}
   116  	return &shared.ListDomainsRequest{
   117  		PageSize:      &t.PageSize,
   118  		NextPageToken: t.NextPageToken,
   119  	}
   120  }
   121  
   122  func ListTaskListPartitionsRequest(t *apiv1.ListTaskListPartitionsRequest) *shared.ListTaskListPartitionsRequest {
   123  	if t == nil {
   124  		return nil
   125  	}
   126  	return &shared.ListTaskListPartitionsRequest{
   127  		Domain:   &t.Domain,
   128  		TaskList: TaskList(t.TaskList),
   129  	}
   130  }
   131  
   132  func ListWorkflowExecutionsRequest(t *apiv1.ListWorkflowExecutionsRequest) *shared.ListWorkflowExecutionsRequest {
   133  	if t == nil {
   134  		return nil
   135  	}
   136  	return &shared.ListWorkflowExecutionsRequest{
   137  		Domain:        &t.Domain,
   138  		PageSize:      &t.PageSize,
   139  		NextPageToken: t.NextPageToken,
   140  		Query:         &t.Query,
   141  	}
   142  }
   143  
   144  func PollForActivityTaskRequest(t *apiv1.PollForActivityTaskRequest) *shared.PollForActivityTaskRequest {
   145  	if t == nil {
   146  		return nil
   147  	}
   148  	return &shared.PollForActivityTaskRequest{
   149  		Domain:           &t.Domain,
   150  		TaskList:         TaskList(t.TaskList),
   151  		Identity:         &t.Identity,
   152  		TaskListMetadata: TaskListMetadata(t.TaskListMetadata),
   153  	}
   154  }
   155  
   156  func PollForDecisionTaskRequest(t *apiv1.PollForDecisionTaskRequest) *shared.PollForDecisionTaskRequest {
   157  	if t == nil {
   158  		return nil
   159  	}
   160  	return &shared.PollForDecisionTaskRequest{
   161  		Domain:         &t.Domain,
   162  		TaskList:       TaskList(t.TaskList),
   163  		Identity:       &t.Identity,
   164  		BinaryChecksum: &t.BinaryChecksum,
   165  	}
   166  }
   167  
   168  func QueryWorkflowRequest(t *apiv1.QueryWorkflowRequest) *shared.QueryWorkflowRequest {
   169  	if t == nil {
   170  		return nil
   171  	}
   172  	return &shared.QueryWorkflowRequest{
   173  		Domain:                &t.Domain,
   174  		Execution:             WorkflowExecution(t.WorkflowExecution),
   175  		Query:                 WorkflowQuery(t.Query),
   176  		QueryRejectCondition:  QueryRejectCondition(t.QueryRejectCondition),
   177  		QueryConsistencyLevel: QueryConsistencyLevel(t.QueryConsistencyLevel),
   178  	}
   179  }
   180  
   181  func RecordActivityTaskHeartbeatByIdRequest(t *apiv1.RecordActivityTaskHeartbeatByIDRequest) *shared.RecordActivityTaskHeartbeatByIDRequest {
   182  	if t == nil {
   183  		return nil
   184  	}
   185  	return &shared.RecordActivityTaskHeartbeatByIDRequest{
   186  		Domain:     &t.Domain,
   187  		WorkflowID: WorkflowId(t.WorkflowExecution),
   188  		RunID:      RunId(t.WorkflowExecution),
   189  		ActivityID: &t.ActivityId,
   190  		Details:    Payload(t.Details),
   191  		Identity:   &t.Identity,
   192  	}
   193  }
   194  
   195  func RecordActivityTaskHeartbeatRequest(t *apiv1.RecordActivityTaskHeartbeatRequest) *shared.RecordActivityTaskHeartbeatRequest {
   196  	if t == nil {
   197  		return nil
   198  	}
   199  	return &shared.RecordActivityTaskHeartbeatRequest{
   200  		TaskToken: t.TaskToken,
   201  		Details:   Payload(t.Details),
   202  		Identity:  &t.Identity,
   203  	}
   204  }
   205  
   206  func RegisterDomainRequest(t *apiv1.RegisterDomainRequest) *shared.RegisterDomainRequest {
   207  	if t == nil {
   208  		return nil
   209  	}
   210  	return &shared.RegisterDomainRequest{
   211  		Name:                                   &t.Name,
   212  		Description:                            &t.Description,
   213  		OwnerEmail:                             &t.OwnerEmail,
   214  		WorkflowExecutionRetentionPeriodInDays: durationToDays(t.WorkflowExecutionRetentionPeriod),
   215  		Clusters:                               ClusterReplicationConfigurationArray(t.Clusters),
   216  		ActiveClusterName:                      &t.ActiveClusterName,
   217  		Data:                                   t.Data,
   218  		SecurityToken:                          &t.SecurityToken,
   219  		IsGlobalDomain:                         &t.IsGlobalDomain,
   220  		HistoryArchivalStatus:                  ArchivalStatus(t.HistoryArchivalStatus),
   221  		HistoryArchivalURI:                     &t.HistoryArchivalUri,
   222  		VisibilityArchivalStatus:               ArchivalStatus(t.VisibilityArchivalStatus),
   223  		VisibilityArchivalURI:                  &t.VisibilityArchivalUri,
   224  	}
   225  }
   226  
   227  func RequestCancelWorkflowExecutionRequest(t *apiv1.RequestCancelWorkflowExecutionRequest) *shared.RequestCancelWorkflowExecutionRequest {
   228  	if t == nil {
   229  		return nil
   230  	}
   231  	return &shared.RequestCancelWorkflowExecutionRequest{
   232  		Domain:            &t.Domain,
   233  		WorkflowExecution: WorkflowExecution(t.WorkflowExecution),
   234  		Identity:          &t.Identity,
   235  		RequestId:         &t.RequestId,
   236  	}
   237  }
   238  
   239  func ResetStickyTaskListRequest(t *apiv1.ResetStickyTaskListRequest) *shared.ResetStickyTaskListRequest {
   240  	if t == nil {
   241  		return nil
   242  	}
   243  	return &shared.ResetStickyTaskListRequest{
   244  		Domain:    &t.Domain,
   245  		Execution: WorkflowExecution(t.WorkflowExecution),
   246  	}
   247  }
   248  
   249  func ResetWorkflowExecutionRequest(t *apiv1.ResetWorkflowExecutionRequest) *shared.ResetWorkflowExecutionRequest {
   250  	if t == nil {
   251  		return nil
   252  	}
   253  	return &shared.ResetWorkflowExecutionRequest{
   254  		Domain:                &t.Domain,
   255  		WorkflowExecution:     WorkflowExecution(t.WorkflowExecution),
   256  		Reason:                &t.Reason,
   257  		DecisionFinishEventId: &t.DecisionFinishEventId,
   258  		RequestId:             &t.RequestId,
   259  		SkipSignalReapply:     &t.SkipSignalReapply,
   260  	}
   261  }
   262  
   263  func RespondActivityTaskCanceledByIdRequest(t *apiv1.RespondActivityTaskCanceledByIDRequest) *shared.RespondActivityTaskCanceledByIDRequest {
   264  	if t == nil {
   265  		return nil
   266  	}
   267  	return &shared.RespondActivityTaskCanceledByIDRequest{
   268  		Domain:     &t.Domain,
   269  		WorkflowID: WorkflowId(t.WorkflowExecution),
   270  		RunID:      RunId(t.WorkflowExecution),
   271  		ActivityID: &t.ActivityId,
   272  		Details:    Payload(t.Details),
   273  		Identity:   &t.Identity,
   274  	}
   275  }
   276  
   277  func RespondActivityTaskCanceledRequest(t *apiv1.RespondActivityTaskCanceledRequest) *shared.RespondActivityTaskCanceledRequest {
   278  	if t == nil {
   279  		return nil
   280  	}
   281  	return &shared.RespondActivityTaskCanceledRequest{
   282  		TaskToken: t.TaskToken,
   283  		Details:   Payload(t.Details),
   284  		Identity:  &t.Identity,
   285  	}
   286  }
   287  
   288  func RespondActivityTaskCompletedByIdRequest(t *apiv1.RespondActivityTaskCompletedByIDRequest) *shared.RespondActivityTaskCompletedByIDRequest {
   289  	if t == nil {
   290  		return nil
   291  	}
   292  	return &shared.RespondActivityTaskCompletedByIDRequest{
   293  		Domain:     &t.Domain,
   294  		WorkflowID: WorkflowId(t.WorkflowExecution),
   295  		RunID:      RunId(t.WorkflowExecution),
   296  		ActivityID: &t.ActivityId,
   297  		Result:     Payload(t.Result),
   298  		Identity:   &t.Identity,
   299  	}
   300  }
   301  
   302  func RespondActivityTaskCompletedRequest(t *apiv1.RespondActivityTaskCompletedRequest) *shared.RespondActivityTaskCompletedRequest {
   303  	if t == nil {
   304  		return nil
   305  	}
   306  	return &shared.RespondActivityTaskCompletedRequest{
   307  		TaskToken: t.TaskToken,
   308  		Result:    Payload(t.Result),
   309  		Identity:  &t.Identity,
   310  	}
   311  }
   312  
   313  func RespondActivityTaskFailedByIdRequest(t *apiv1.RespondActivityTaskFailedByIDRequest) *shared.RespondActivityTaskFailedByIDRequest {
   314  	if t == nil {
   315  		return nil
   316  	}
   317  	return &shared.RespondActivityTaskFailedByIDRequest{
   318  		Domain:     &t.Domain,
   319  		WorkflowID: WorkflowId(t.WorkflowExecution),
   320  		RunID:      RunId(t.WorkflowExecution),
   321  		ActivityID: &t.ActivityId,
   322  		Reason:     FailureReason(t.Failure),
   323  		Details:    FailureDetails(t.Failure),
   324  		Identity:   &t.Identity,
   325  	}
   326  }
   327  
   328  func RespondActivityTaskFailedRequest(t *apiv1.RespondActivityTaskFailedRequest) *shared.RespondActivityTaskFailedRequest {
   329  	if t == nil {
   330  		return nil
   331  	}
   332  	return &shared.RespondActivityTaskFailedRequest{
   333  		TaskToken: t.TaskToken,
   334  		Reason:    FailureReason(t.Failure),
   335  		Details:   FailureDetails(t.Failure),
   336  		Identity:  &t.Identity,
   337  	}
   338  }
   339  
   340  func RespondDecisionTaskCompletedRequest(t *apiv1.RespondDecisionTaskCompletedRequest) *shared.RespondDecisionTaskCompletedRequest {
   341  	if t == nil {
   342  		return nil
   343  	}
   344  	return &shared.RespondDecisionTaskCompletedRequest{
   345  		TaskToken:                  t.TaskToken,
   346  		Decisions:                  DecisionArray(t.Decisions),
   347  		ExecutionContext:           t.ExecutionContext,
   348  		Identity:                   &t.Identity,
   349  		StickyAttributes:           StickyExecutionAttributes(t.StickyAttributes),
   350  		ReturnNewDecisionTask:      &t.ReturnNewDecisionTask,
   351  		ForceCreateNewDecisionTask: &t.ForceCreateNewDecisionTask,
   352  		BinaryChecksum:             &t.BinaryChecksum,
   353  		QueryResults:               WorkflowQueryResultMap(t.QueryResults),
   354  	}
   355  }
   356  
   357  func RespondDecisionTaskFailedRequest(t *apiv1.RespondDecisionTaskFailedRequest) *shared.RespondDecisionTaskFailedRequest {
   358  	if t == nil {
   359  		return nil
   360  	}
   361  	return &shared.RespondDecisionTaskFailedRequest{
   362  		TaskToken:      t.TaskToken,
   363  		Cause:          DecisionTaskFailedCause(t.Cause),
   364  		Details:        Payload(t.Details),
   365  		Identity:       &t.Identity,
   366  		BinaryChecksum: &t.BinaryChecksum,
   367  	}
   368  }
   369  
   370  func RespondQueryTaskCompletedRequest(t *apiv1.RespondQueryTaskCompletedRequest) *shared.RespondQueryTaskCompletedRequest {
   371  	if t == nil {
   372  		return nil
   373  	}
   374  	request := &shared.RespondQueryTaskCompletedRequest{
   375  		TaskToken:         t.TaskToken,
   376  		WorkerVersionInfo: WorkerVersionInfo(t.WorkerVersionInfo),
   377  	}
   378  	if t.Result != nil {
   379  		request.CompletedType = QueryTaskCompletedType(t.Result.ResultType)
   380  		request.QueryResult = Payload(t.Result.Answer)
   381  		request.ErrorMessage = &t.Result.ErrorMessage
   382  	}
   383  	return request
   384  }
   385  
   386  func ScanWorkflowExecutionsRequest(t *apiv1.ScanWorkflowExecutionsRequest) *shared.ListWorkflowExecutionsRequest {
   387  	if t == nil {
   388  		return nil
   389  	}
   390  	return &shared.ListWorkflowExecutionsRequest{
   391  		Domain:        &t.Domain,
   392  		PageSize:      &t.PageSize,
   393  		NextPageToken: t.NextPageToken,
   394  		Query:         &t.Query,
   395  	}
   396  }
   397  
   398  func SignalWithStartWorkflowExecutionRequest(t *apiv1.SignalWithStartWorkflowExecutionRequest) *shared.SignalWithStartWorkflowExecutionRequest {
   399  	if t == nil {
   400  		return nil
   401  	}
   402  	request := &shared.SignalWithStartWorkflowExecutionRequest{
   403  		SignalName:  &t.SignalName,
   404  		SignalInput: Payload(t.SignalInput),
   405  		Control:     t.Control,
   406  	}
   407  
   408  	if t.StartRequest != nil {
   409  		request.Domain = &t.StartRequest.Domain
   410  		request.WorkflowId = &t.StartRequest.WorkflowId
   411  		request.WorkflowType = WorkflowType(t.StartRequest.WorkflowType)
   412  		request.TaskList = TaskList(t.StartRequest.TaskList)
   413  		request.Input = Payload(t.StartRequest.Input)
   414  		request.ExecutionStartToCloseTimeoutSeconds = durationToSeconds(t.StartRequest.ExecutionStartToCloseTimeout)
   415  		request.TaskStartToCloseTimeoutSeconds = durationToSeconds(t.StartRequest.TaskStartToCloseTimeout)
   416  		request.Identity = &t.StartRequest.Identity
   417  		request.RequestId = &t.StartRequest.RequestId
   418  		request.WorkflowIdReusePolicy = WorkflowIdReusePolicy(t.StartRequest.WorkflowIdReusePolicy)
   419  		request.RetryPolicy = RetryPolicy(t.StartRequest.RetryPolicy)
   420  		request.CronSchedule = &t.StartRequest.CronSchedule
   421  		request.Memo = Memo(t.StartRequest.Memo)
   422  		request.SearchAttributes = SearchAttributes(t.StartRequest.SearchAttributes)
   423  		request.Header = Header(t.StartRequest.Header)
   424  	}
   425  
   426  	return request
   427  }
   428  
   429  func SignalWorkflowExecutionRequest(t *apiv1.SignalWorkflowExecutionRequest) *shared.SignalWorkflowExecutionRequest {
   430  	if t == nil {
   431  		return nil
   432  	}
   433  	return &shared.SignalWorkflowExecutionRequest{
   434  		Domain:            &t.Domain,
   435  		WorkflowExecution: WorkflowExecution(t.WorkflowExecution),
   436  		SignalName:        &t.SignalName,
   437  		Input:             Payload(t.SignalInput),
   438  		Identity:          &t.Identity,
   439  		RequestId:         &t.RequestId,
   440  		Control:           t.Control,
   441  	}
   442  }
   443  
   444  func StartWorkflowExecutionRequest(t *apiv1.StartWorkflowExecutionRequest) *shared.StartWorkflowExecutionRequest {
   445  	if t == nil {
   446  		return nil
   447  	}
   448  	return &shared.StartWorkflowExecutionRequest{
   449  		Domain:                              &t.Domain,
   450  		WorkflowId:                          &t.WorkflowId,
   451  		WorkflowType:                        WorkflowType(t.WorkflowType),
   452  		TaskList:                            TaskList(t.TaskList),
   453  		Input:                               Payload(t.Input),
   454  		ExecutionStartToCloseTimeoutSeconds: durationToSeconds(t.ExecutionStartToCloseTimeout),
   455  		TaskStartToCloseTimeoutSeconds:      durationToSeconds(t.TaskStartToCloseTimeout),
   456  		Identity:                            &t.Identity,
   457  		RequestId:                           &t.RequestId,
   458  		WorkflowIdReusePolicy:               WorkflowIdReusePolicy(t.WorkflowIdReusePolicy),
   459  		RetryPolicy:                         RetryPolicy(t.RetryPolicy),
   460  		CronSchedule:                        &t.CronSchedule,
   461  		Memo:                                Memo(t.Memo),
   462  		SearchAttributes:                    SearchAttributes(t.SearchAttributes),
   463  		Header:                              Header(t.Header),
   464  		DelayStartSeconds:                   durationToSeconds(t.DelayStart),
   465  		JitterStartSeconds:                  durationToSeconds(t.JitterStart),
   466  	}
   467  }
   468  
   469  func TerminateWorkflowExecutionRequest(t *apiv1.TerminateWorkflowExecutionRequest) *shared.TerminateWorkflowExecutionRequest {
   470  	if t == nil {
   471  		return nil
   472  	}
   473  	return &shared.TerminateWorkflowExecutionRequest{
   474  		Domain:            &t.Domain,
   475  		WorkflowExecution: WorkflowExecution(t.WorkflowExecution),
   476  		Reason:            &t.Reason,
   477  		Details:           Payload(t.Details),
   478  		Identity:          &t.Identity,
   479  	}
   480  }
   481  
   482  const (
   483  	DomainUpdateDescriptionField              = "description"
   484  	DomainUpdateOwnerEmailField               = "owner_email"
   485  	DomainUpdateDataField                     = "data"
   486  	DomainUpdateRetentionPeriodField          = "workflow_execution_retention_period"
   487  	DomainUpdateBadBinariesField              = "bad_binaries"
   488  	DomainUpdateHistoryArchivalStatusField    = "history_archival_status"
   489  	DomainUpdateHistoryArchivalURIField       = "history_archival_uri"
   490  	DomainUpdateVisibilityArchivalStatusField = "visibility_archival_status"
   491  	DomainUpdateVisibilityArchivalURIField    = "visibility_archival_uri"
   492  	DomainUpdateActiveClusterNameField        = "active_cluster_name"
   493  	DomainUpdateClustersField                 = "clusters"
   494  	DomainUpdateDeleteBadBinaryField          = "delete_bad_binary"
   495  	DomainUpdateFailoverTimeoutField          = "failover_timeout"
   496  )
   497  
   498  func UpdateDomainRequest(t *apiv1.UpdateDomainRequest) *shared.UpdateDomainRequest {
   499  	if t == nil {
   500  		return nil
   501  	}
   502  	request := shared.UpdateDomainRequest{
   503  		Name:                     &t.Name,
   504  		SecurityToken:            &t.SecurityToken,
   505  		UpdatedInfo:              &shared.UpdateDomainInfo{},
   506  		Configuration:            &shared.DomainConfiguration{},
   507  		ReplicationConfiguration: &shared.DomainReplicationConfiguration{},
   508  	}
   509  	fs := newFieldSet(t.UpdateMask)
   510  
   511  	if fs.isSet(DomainUpdateDescriptionField) {
   512  		request.UpdatedInfo.Description = &t.Description
   513  	}
   514  	if fs.isSet(DomainUpdateOwnerEmailField) {
   515  		request.UpdatedInfo.OwnerEmail = &t.OwnerEmail
   516  	}
   517  	if fs.isSet(DomainUpdateDataField) {
   518  		request.UpdatedInfo.Data = t.Data
   519  	}
   520  	if fs.isSet(DomainUpdateRetentionPeriodField) {
   521  		request.Configuration.WorkflowExecutionRetentionPeriodInDays = durationToDays(t.WorkflowExecutionRetentionPeriod)
   522  	}
   523  	if fs.isSet(DomainUpdateBadBinariesField) {
   524  		request.Configuration.BadBinaries = BadBinaries(t.BadBinaries)
   525  	}
   526  	if fs.isSet(DomainUpdateHistoryArchivalStatusField) {
   527  		request.Configuration.HistoryArchivalStatus = ArchivalStatus(t.HistoryArchivalStatus)
   528  	}
   529  	if fs.isSet(DomainUpdateHistoryArchivalURIField) {
   530  		request.Configuration.HistoryArchivalURI = &t.HistoryArchivalUri
   531  	}
   532  	if fs.isSet(DomainUpdateVisibilityArchivalStatusField) {
   533  		request.Configuration.VisibilityArchivalStatus = ArchivalStatus(t.VisibilityArchivalStatus)
   534  	}
   535  	if fs.isSet(DomainUpdateVisibilityArchivalURIField) {
   536  		request.Configuration.VisibilityArchivalURI = &t.VisibilityArchivalUri
   537  	}
   538  	if fs.isSet(DomainUpdateActiveClusterNameField) {
   539  		request.ReplicationConfiguration.ActiveClusterName = &t.ActiveClusterName
   540  	}
   541  	if fs.isSet(DomainUpdateClustersField) {
   542  		request.ReplicationConfiguration.Clusters = ClusterReplicationConfigurationArray(t.Clusters)
   543  	}
   544  
   545  	if fs.isSet(DomainUpdateDeleteBadBinaryField) {
   546  		request.DeleteBadBinary = &t.DeleteBadBinary
   547  	}
   548  	if fs.isSet(DomainUpdateFailoverTimeoutField) {
   549  		request.FailoverTimeoutInSeconds = durationToSeconds(t.FailoverTimeout)
   550  	}
   551  
   552  	return &request
   553  }
   554  
   555  func ListClosedWorkflowExecutionsRequest(r *apiv1.ListClosedWorkflowExecutionsRequest) *shared.ListClosedWorkflowExecutionsRequest {
   556  	if r == nil {
   557  		return nil
   558  	}
   559  	return &shared.ListClosedWorkflowExecutionsRequest{
   560  		Domain:          &r.Domain,
   561  		MaximumPageSize: &r.PageSize,
   562  		NextPageToken:   r.NextPageToken,
   563  		StartTimeFilter: StartTimeFilter(r.StartTimeFilter),
   564  		ExecutionFilter: WorkflowExecutionFilter(r.GetExecutionFilter()),
   565  		TypeFilter:      WorkflowTypeFilter(r.GetTypeFilter()),
   566  		StatusFilter:    WorkflowExecutionCloseStatus(r.GetStatusFilter().GetStatus()),
   567  	}
   568  }
   569  
   570  func ListOpenWorkflowExecutionsRequest(r *apiv1.ListOpenWorkflowExecutionsRequest) *shared.ListOpenWorkflowExecutionsRequest {
   571  	if r == nil {
   572  		return nil
   573  	}
   574  	return &shared.ListOpenWorkflowExecutionsRequest{
   575  		Domain:          &r.Domain,
   576  		MaximumPageSize: &r.PageSize,
   577  		NextPageToken:   r.NextPageToken,
   578  		StartTimeFilter: StartTimeFilter(r.StartTimeFilter),
   579  		ExecutionFilter: WorkflowExecutionFilter(r.GetExecutionFilter()),
   580  		TypeFilter:      WorkflowTypeFilter(r.GetTypeFilter()),
   581  	}
   582  }