• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 0187fdd2-f4a4-4c9a-97b4-6604937bf7be

09 May 2023 12:23AM UTC coverage: 57.253% (-0.002%) from 57.255%
0187fdd2-f4a4-4c9a-97b4-6604937bf7be

Pull #5252

buildkite

David Porter
Merge branch 'master' into feature/zonal-partitioning
Pull Request #5252: Feature/zonal partitioning

1460 of 1460 new or added lines in 51 files covered. (100.0%)

86909 of 151799 relevant lines covered (57.25%)

2482.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.7
/common/types/mapper/proto/admin.go
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 all
11
// 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 THE
19
// SOFTWARE.
20

21
package proto
22

23
import (
24
        "sort"
25

26
        adminv1 "github.com/uber/cadence-idl/go/proto/admin/v1"
27
        apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
28
        "github.com/uber/cadence/common/types"
29
)
30

31
func FromAdminAddSearchAttributeRequest(t *types.AddSearchAttributeRequest) *adminv1.AddSearchAttributeRequest {
3✔
32
        if t == nil {
4✔
33
                return nil
1✔
34
        }
1✔
35
        return &adminv1.AddSearchAttributeRequest{
2✔
36
                SearchAttribute: FromIndexedValueTypeMap(t.SearchAttribute),
2✔
37
                SecurityToken:   t.SecurityToken,
2✔
38
        }
2✔
39
}
40

41
func ToAdminAddSearchAttributeRequest(t *adminv1.AddSearchAttributeRequest) *types.AddSearchAttributeRequest {
3✔
42
        if t == nil {
4✔
43
                return nil
1✔
44
        }
1✔
45
        return &types.AddSearchAttributeRequest{
2✔
46
                SearchAttribute: ToIndexedValueTypeMap(t.SearchAttribute),
2✔
47
                SecurityToken:   t.SecurityToken,
2✔
48
        }
2✔
49
}
50

51
func FromAdminCloseShardRequest(t *types.CloseShardRequest) *adminv1.CloseShardRequest {
3✔
52
        if t == nil {
4✔
53
                return nil
1✔
54
        }
1✔
55
        return &adminv1.CloseShardRequest{
2✔
56
                ShardId: t.ShardID,
2✔
57
        }
2✔
58
}
59

60
func ToAdminCloseShardRequest(t *adminv1.CloseShardRequest) *types.CloseShardRequest {
3✔
61
        if t == nil {
4✔
62
                return nil
1✔
63
        }
1✔
64
        return &types.CloseShardRequest{
2✔
65
                ShardID: t.ShardId,
2✔
66
        }
2✔
67
}
68

69
func FromAdminDescribeClusterResponse(t *types.DescribeClusterResponse) *adminv1.DescribeClusterResponse {
3✔
70
        if t == nil {
4✔
71
                return nil
1✔
72
        }
1✔
73
        return &adminv1.DescribeClusterResponse{
2✔
74
                SupportedClientVersions: FromSupportedClientVersions(t.SupportedClientVersions),
2✔
75
                MembershipInfo:          FromMembershipInfo(t.MembershipInfo),
2✔
76
                PersistenceInfo:         FromPersistenceInfoMap(t.PersistenceInfo),
2✔
77
        }
2✔
78
}
79

80
func ToAdminDescribeClusterResponse(t *adminv1.DescribeClusterResponse) *types.DescribeClusterResponse {
3✔
81
        if t == nil {
4✔
82
                return nil
1✔
83
        }
1✔
84
        return &types.DescribeClusterResponse{
2✔
85
                SupportedClientVersions: ToSupportedClientVersions(t.SupportedClientVersions),
2✔
86
                MembershipInfo:          ToMembershipInfo(t.MembershipInfo),
2✔
87
                PersistenceInfo:         ToPersistenceInfoMap(t.PersistenceInfo),
2✔
88
        }
2✔
89
}
90

91
func FromAdminDescribeShardDistributionRequest(t *types.DescribeShardDistributionRequest) *adminv1.DescribeShardDistributionRequest {
×
92
        if t == nil {
×
93
                return nil
×
94
        }
×
95
        return &adminv1.DescribeShardDistributionRequest{
×
96
                PageSize: t.PageSize,
×
97
                PageId:   t.PageID,
×
98
        }
×
99
}
100

101
func FromAdminDescribeHistoryHostRequest(t *types.DescribeHistoryHostRequest) *adminv1.DescribeHistoryHostRequest {
5✔
102
        if t == nil {
6✔
103
                return nil
1✔
104
        }
1✔
105
        if t.HostAddress != nil {
5✔
106
                return &adminv1.DescribeHistoryHostRequest{
1✔
107
                        DescribeBy: &adminv1.DescribeHistoryHostRequest_HostAddress{HostAddress: *t.HostAddress},
1✔
108
                }
1✔
109
        }
1✔
110
        if t.ShardIDForHost != nil {
4✔
111
                return &adminv1.DescribeHistoryHostRequest{
1✔
112
                        DescribeBy: &adminv1.DescribeHistoryHostRequest_ShardId{ShardId: *t.ShardIDForHost},
1✔
113
                }
1✔
114
        }
1✔
115
        if t.ExecutionForHost != nil {
3✔
116
                return &adminv1.DescribeHistoryHostRequest{
1✔
117
                        DescribeBy: &adminv1.DescribeHistoryHostRequest_WorkflowExecution{WorkflowExecution: FromWorkflowExecution(t.ExecutionForHost)},
1✔
118
                }
1✔
119
        }
1✔
120
        panic("neither oneof field is set for DescribeHistoryHostRequest")
1✔
121
}
122

123
func ToAdminDescribeShardDistributionRequest(t *adminv1.DescribeShardDistributionRequest) *types.DescribeShardDistributionRequest {
×
124
        if t == nil {
×
125
                return nil
×
126
        }
×
127
        return &types.DescribeShardDistributionRequest{
×
128
                PageSize: t.PageSize,
×
129
                PageID:   t.PageId,
×
130
        }
×
131
}
132

133
func ToAdminDescribeHistoryHostRequest(t *adminv1.DescribeHistoryHostRequest) *types.DescribeHistoryHostRequest {
5✔
134
        if t == nil {
6✔
135
                return nil
1✔
136
        }
1✔
137
        switch describeBy := t.DescribeBy.(type) {
4✔
138
        case *adminv1.DescribeHistoryHostRequest_HostAddress:
1✔
139
                return &types.DescribeHistoryHostRequest{HostAddress: &describeBy.HostAddress}
1✔
140
        case *adminv1.DescribeHistoryHostRequest_ShardId:
1✔
141
                return &types.DescribeHistoryHostRequest{ShardIDForHost: &describeBy.ShardId}
1✔
142
        case *adminv1.DescribeHistoryHostRequest_WorkflowExecution:
1✔
143
                return &types.DescribeHistoryHostRequest{ExecutionForHost: ToWorkflowExecution(describeBy.WorkflowExecution)}
1✔
144
        }
145
        panic("neither oneof field is set for DescribeHistoryHostRequest")
1✔
146
}
147

148
func FromAdminDescribeShardDistributionResponse(t *types.DescribeShardDistributionResponse) *adminv1.DescribeShardDistributionResponse {
×
149
        if t == nil {
×
150
                return nil
×
151
        }
×
152
        return &adminv1.DescribeShardDistributionResponse{
×
153
                NumberOfShards: t.NumberOfShards,
×
154
                Shards:         t.Shards,
×
155
        }
×
156
}
157

158
func FromAdminDescribeHistoryHostResponse(t *types.DescribeHistoryHostResponse) *adminv1.DescribeHistoryHostResponse {
3✔
159
        if t == nil {
4✔
160
                return nil
1✔
161
        }
1✔
162
        return &adminv1.DescribeHistoryHostResponse{
2✔
163
                NumberOfShards:        t.NumberOfShards,
2✔
164
                ShardIds:              t.ShardIDs,
2✔
165
                DomainCache:           FromDomainCacheInfo(t.DomainCache),
2✔
166
                ShardControllerStatus: t.ShardControllerStatus,
2✔
167
                Address:               t.Address,
2✔
168
        }
2✔
169
}
170

171
func ToAdminDescribeShardDistributionResponse(t *adminv1.DescribeShardDistributionResponse) *types.DescribeShardDistributionResponse {
×
172
        if t == nil {
×
173
                return nil
×
174
        }
×
175
        return &types.DescribeShardDistributionResponse{
×
176
                NumberOfShards: t.NumberOfShards,
×
177
                Shards:         t.Shards,
×
178
        }
×
179
}
180

181
func ToAdminDescribeHistoryHostResponse(t *adminv1.DescribeHistoryHostResponse) *types.DescribeHistoryHostResponse {
3✔
182
        if t == nil {
4✔
183
                return nil
1✔
184
        }
1✔
185
        return &types.DescribeHistoryHostResponse{
2✔
186
                NumberOfShards:        t.NumberOfShards,
2✔
187
                ShardIDs:              t.ShardIds,
2✔
188
                DomainCache:           ToDomainCacheInfo(t.DomainCache),
2✔
189
                ShardControllerStatus: t.ShardControllerStatus,
2✔
190
                Address:               t.Address,
2✔
191
        }
2✔
192
}
193

194
func FromAdminDescribeQueueRequest(t *types.DescribeQueueRequest) *adminv1.DescribeQueueRequest {
3✔
195
        if t == nil {
4✔
196
                return nil
1✔
197
        }
1✔
198
        return &adminv1.DescribeQueueRequest{
2✔
199
                ShardId:     t.ShardID,
2✔
200
                ClusterName: t.ClusterName,
2✔
201
                TaskType:    FromTaskType(t.Type),
2✔
202
        }
2✔
203
}
204

205
func ToAdminDescribeQueueRequest(t *adminv1.DescribeQueueRequest) *types.DescribeQueueRequest {
3✔
206
        if t == nil {
4✔
207
                return nil
1✔
208
        }
1✔
209
        return &types.DescribeQueueRequest{
2✔
210
                ShardID:     t.ShardId,
2✔
211
                ClusterName: t.ClusterName,
2✔
212
                Type:        ToTaskType(t.TaskType),
2✔
213
        }
2✔
214
}
215

216
func FromAdminDescribeQueueResponse(t *types.DescribeQueueResponse) *adminv1.DescribeQueueResponse {
3✔
217
        if t == nil {
4✔
218
                return nil
1✔
219
        }
1✔
220
        return &adminv1.DescribeQueueResponse{
2✔
221
                ProcessingQueueStates: t.ProcessingQueueStates,
2✔
222
        }
2✔
223
}
224

225
func ToAdminDescribeQueueResponse(t *adminv1.DescribeQueueResponse) *types.DescribeQueueResponse {
3✔
226
        if t == nil {
4✔
227
                return nil
1✔
228
        }
1✔
229
        return &types.DescribeQueueResponse{
2✔
230
                ProcessingQueueStates: t.ProcessingQueueStates,
2✔
231
        }
2✔
232
}
233

234
func FromAdminDescribeWorkflowExecutionRequest(t *types.AdminDescribeWorkflowExecutionRequest) *adminv1.DescribeWorkflowExecutionRequest {
3✔
235
        if t == nil {
4✔
236
                return nil
1✔
237
        }
1✔
238
        return &adminv1.DescribeWorkflowExecutionRequest{
2✔
239
                Domain:            t.Domain,
2✔
240
                WorkflowExecution: FromWorkflowExecution(t.Execution),
2✔
241
        }
2✔
242
}
243

244
func ToAdminDescribeWorkflowExecutionRequest(t *adminv1.DescribeWorkflowExecutionRequest) *types.AdminDescribeWorkflowExecutionRequest {
3✔
245
        if t == nil {
4✔
246
                return nil
1✔
247
        }
1✔
248
        return &types.AdminDescribeWorkflowExecutionRequest{
2✔
249
                Domain:    t.Domain,
2✔
250
                Execution: ToWorkflowExecution(t.WorkflowExecution),
2✔
251
        }
2✔
252
}
253

254
func FromAdminDescribeWorkflowExecutionResponse(t *types.AdminDescribeWorkflowExecutionResponse) *adminv1.DescribeWorkflowExecutionResponse {
3✔
255
        if t == nil {
4✔
256
                return nil
1✔
257
        }
1✔
258
        return &adminv1.DescribeWorkflowExecutionResponse{
2✔
259
                ShardId:                stringToInt32(t.ShardID),
2✔
260
                HistoryAddr:            t.HistoryAddr,
2✔
261
                MutableStateInCache:    t.MutableStateInCache,
2✔
262
                MutableStateInDatabase: t.MutableStateInDatabase,
2✔
263
        }
2✔
264
}
265

266
func ToAdminDescribeWorkflowExecutionResponse(t *adminv1.DescribeWorkflowExecutionResponse) *types.AdminDescribeWorkflowExecutionResponse {
3✔
267
        if t == nil {
4✔
268
                return nil
1✔
269
        }
1✔
270
        return &types.AdminDescribeWorkflowExecutionResponse{
2✔
271
                ShardID:                int32ToString(t.ShardId),
2✔
272
                HistoryAddr:            t.HistoryAddr,
2✔
273
                MutableStateInCache:    t.MutableStateInCache,
2✔
274
                MutableStateInDatabase: t.MutableStateInDatabase,
2✔
275
        }
2✔
276
}
277

278
func FromAdminGetDLQReplicationMessagesRequest(t *types.GetDLQReplicationMessagesRequest) *adminv1.GetDLQReplicationMessagesRequest {
3✔
279
        if t == nil {
4✔
280
                return nil
1✔
281
        }
1✔
282
        return &adminv1.GetDLQReplicationMessagesRequest{
2✔
283
                TaskInfos: FromReplicationTaskInfoArray(t.TaskInfos),
2✔
284
        }
2✔
285
}
286

287
func ToAdminGetDLQReplicationMessagesRequest(t *adminv1.GetDLQReplicationMessagesRequest) *types.GetDLQReplicationMessagesRequest {
3✔
288
        if t == nil {
4✔
289
                return nil
1✔
290
        }
1✔
291
        return &types.GetDLQReplicationMessagesRequest{
2✔
292
                TaskInfos: ToReplicationTaskInfoArray(t.TaskInfos),
2✔
293
        }
2✔
294
}
295

296
func FromAdminGetDLQReplicationMessagesResponse(t *types.GetDLQReplicationMessagesResponse) *adminv1.GetDLQReplicationMessagesResponse {
3✔
297
        if t == nil {
4✔
298
                return nil
1✔
299
        }
1✔
300
        return &adminv1.GetDLQReplicationMessagesResponse{
2✔
301
                ReplicationTasks: FromReplicationTaskArray(t.ReplicationTasks),
2✔
302
        }
2✔
303
}
304

305
func ToAdminGetDLQReplicationMessagesResponse(t *adminv1.GetDLQReplicationMessagesResponse) *types.GetDLQReplicationMessagesResponse {
3✔
306
        if t == nil {
4✔
307
                return nil
1✔
308
        }
1✔
309
        return &types.GetDLQReplicationMessagesResponse{
2✔
310
                ReplicationTasks: ToReplicationTaskArray(t.ReplicationTasks),
2✔
311
        }
2✔
312
}
313

314
func FromAdminGetDomainReplicationMessagesRequest(t *types.GetDomainReplicationMessagesRequest) *adminv1.GetDomainReplicationMessagesRequest {
151✔
315
        if t == nil {
152✔
316
                return nil
1✔
317
        }
1✔
318
        return &adminv1.GetDomainReplicationMessagesRequest{
150✔
319
                LastRetrievedMessageId: fromInt64Value(t.LastRetrievedMessageID),
150✔
320
                LastProcessedMessageId: fromInt64Value(t.LastProcessedMessageID),
150✔
321
                ClusterName:            t.ClusterName,
150✔
322
        }
150✔
323
}
324

325
func ToAdminGetDomainReplicationMessagesRequest(t *adminv1.GetDomainReplicationMessagesRequest) *types.GetDomainReplicationMessagesRequest {
3✔
326
        if t == nil {
4✔
327
                return nil
1✔
328
        }
1✔
329
        return &types.GetDomainReplicationMessagesRequest{
2✔
330
                LastRetrievedMessageID: toInt64Value(t.LastRetrievedMessageId),
2✔
331
                LastProcessedMessageID: toInt64Value(t.LastProcessedMessageId),
2✔
332
                ClusterName:            t.ClusterName,
2✔
333
        }
2✔
334
}
335

336
func FromAdminGetDomainReplicationMessagesResponse(t *types.GetDomainReplicationMessagesResponse) *adminv1.GetDomainReplicationMessagesResponse {
3✔
337
        if t == nil {
4✔
338
                return nil
1✔
339
        }
1✔
340
        return &adminv1.GetDomainReplicationMessagesResponse{
2✔
341
                Messages: FromReplicationMessages(t.Messages),
2✔
342
        }
2✔
343
}
344

345
func ToAdminGetDomainReplicationMessagesResponse(t *adminv1.GetDomainReplicationMessagesResponse) *types.GetDomainReplicationMessagesResponse {
151✔
346
        if t == nil {
152✔
347
                return nil
1✔
348
        }
1✔
349
        return &types.GetDomainReplicationMessagesResponse{
150✔
350
                Messages: ToReplicationMessages(t.Messages),
150✔
351
        }
150✔
352
}
353

354
func FromAdminGetReplicationMessagesRequest(t *types.GetReplicationMessagesRequest) *adminv1.GetReplicationMessagesRequest {
45✔
355
        if t == nil {
46✔
356
                return nil
1✔
357
        }
1✔
358
        return &adminv1.GetReplicationMessagesRequest{
44✔
359
                Tokens:      FromReplicationTokenArray(t.Tokens),
44✔
360
                ClusterName: t.ClusterName,
44✔
361
        }
44✔
362
}
363

364
func ToAdminGetReplicationMessagesRequest(t *adminv1.GetReplicationMessagesRequest) *types.GetReplicationMessagesRequest {
3✔
365
        if t == nil {
4✔
366
                return nil
1✔
367
        }
1✔
368
        return &types.GetReplicationMessagesRequest{
2✔
369
                Tokens:      ToReplicationTokenArray(t.Tokens),
2✔
370
                ClusterName: t.ClusterName,
2✔
371
        }
2✔
372
}
373

374
func FromAdminGetReplicationMessagesResponse(t *types.GetReplicationMessagesResponse) *adminv1.GetReplicationMessagesResponse {
3✔
375
        if t == nil {
4✔
376
                return nil
1✔
377
        }
1✔
378
        return &adminv1.GetReplicationMessagesResponse{
2✔
379
                ShardMessages: FromReplicationMessagesMap(t.MessagesByShard),
2✔
380
        }
2✔
381
}
382

383
func ToAdminGetReplicationMessagesResponse(t *adminv1.GetReplicationMessagesResponse) *types.GetReplicationMessagesResponse {
42✔
384
        if t == nil {
43✔
385
                return nil
1✔
386
        }
1✔
387
        return &types.GetReplicationMessagesResponse{
41✔
388
                MessagesByShard: ToReplicationMessagesMap(t.ShardMessages),
41✔
389
        }
41✔
390
}
391

392
func FromAdminGetWorkflowExecutionRawHistoryV2Request(t *types.GetWorkflowExecutionRawHistoryV2Request) *adminv1.GetWorkflowExecutionRawHistoryV2Request {
3✔
393
        if t == nil {
4✔
394
                return nil
1✔
395
        }
1✔
396
        return &adminv1.GetWorkflowExecutionRawHistoryV2Request{
2✔
397
                Domain:            t.Domain,
2✔
398
                WorkflowExecution: FromWorkflowExecution(t.Execution),
2✔
399
                StartEvent:        FromEventIDVersionPair(t.StartEventID, t.StartEventVersion),
2✔
400
                EndEvent:          FromEventIDVersionPair(t.EndEventID, t.EndEventVersion),
2✔
401
                PageSize:          t.MaximumPageSize,
2✔
402
                NextPageToken:     t.NextPageToken,
2✔
403
        }
2✔
404
}
405

406
func ToAdminGetWorkflowExecutionRawHistoryV2Request(t *adminv1.GetWorkflowExecutionRawHistoryV2Request) *types.GetWorkflowExecutionRawHistoryV2Request {
3✔
407
        if t == nil {
4✔
408
                return nil
1✔
409
        }
1✔
410
        return &types.GetWorkflowExecutionRawHistoryV2Request{
2✔
411
                Domain:            t.Domain,
2✔
412
                Execution:         ToWorkflowExecution(t.WorkflowExecution),
2✔
413
                StartEventID:      ToEventID(t.StartEvent),
2✔
414
                StartEventVersion: ToEventVersion(t.StartEvent),
2✔
415
                EndEventID:        ToEventID(t.EndEvent),
2✔
416
                EndEventVersion:   ToEventVersion(t.EndEvent),
2✔
417
                MaximumPageSize:   t.PageSize,
2✔
418
                NextPageToken:     t.NextPageToken,
2✔
419
        }
2✔
420
}
421

422
func FromAdminGetWorkflowExecutionRawHistoryV2Response(t *types.GetWorkflowExecutionRawHistoryV2Response) *adminv1.GetWorkflowExecutionRawHistoryV2Response {
3✔
423
        if t == nil {
4✔
424
                return nil
1✔
425
        }
1✔
426
        return &adminv1.GetWorkflowExecutionRawHistoryV2Response{
2✔
427
                NextPageToken:  t.NextPageToken,
2✔
428
                HistoryBatches: FromDataBlobArray(t.HistoryBatches),
2✔
429
                VersionHistory: FromVersionHistory(t.VersionHistory),
2✔
430
        }
2✔
431
}
432

433
func ToAdminGetWorkflowExecutionRawHistoryV2Response(t *adminv1.GetWorkflowExecutionRawHistoryV2Response) *types.GetWorkflowExecutionRawHistoryV2Response {
3✔
434
        if t == nil {
4✔
435
                return nil
1✔
436
        }
1✔
437
        return &types.GetWorkflowExecutionRawHistoryV2Response{
2✔
438
                NextPageToken:  t.NextPageToken,
2✔
439
                HistoryBatches: ToDataBlobArray(t.HistoryBatches),
2✔
440
                VersionHistory: ToVersionHistory(t.VersionHistory),
2✔
441
        }
2✔
442
}
443

444
func FromAdminCountDLQMessagesRequest(t *types.CountDLQMessagesRequest) *adminv1.CountDLQMessagesRequest {
3✔
445
        if t == nil {
4✔
446
                return nil
1✔
447
        }
1✔
448
        return &adminv1.CountDLQMessagesRequest{
2✔
449
                ForceFetch: t.ForceFetch,
2✔
450
        }
2✔
451
}
452

453
func ToAdminCountDLQMessagesRequest(t *adminv1.CountDLQMessagesRequest) *types.CountDLQMessagesRequest {
3✔
454
        if t == nil {
4✔
455
                return nil
1✔
456
        }
1✔
457
        return &types.CountDLQMessagesRequest{
2✔
458
                ForceFetch: t.ForceFetch,
2✔
459
        }
2✔
460
}
461

462
func FromAdminCountDLQMessagesResponse(t *types.CountDLQMessagesResponse) *adminv1.CountDLQMessagesResponse {
3✔
463
        if t == nil {
4✔
464
                return nil
1✔
465
        }
1✔
466
        return &adminv1.CountDLQMessagesResponse{
2✔
467
                History: FromHistoryDLQCountEntryMap(t.History),
2✔
468
                Domain:  t.Domain,
2✔
469
        }
2✔
470
}
471

472
func ToAdminCountDLQMessagesResponse(t *adminv1.CountDLQMessagesResponse) *types.CountDLQMessagesResponse {
3✔
473
        if t == nil {
4✔
474
                return nil
1✔
475
        }
1✔
476
        return &types.CountDLQMessagesResponse{
2✔
477
                History: ToHistoryDLQCountEntryMap(t.History),
2✔
478
                Domain:  t.Domain,
2✔
479
        }
2✔
480
}
481

482
func FromAdminMergeDLQMessagesRequest(t *types.MergeDLQMessagesRequest) *adminv1.MergeDLQMessagesRequest {
3✔
483
        if t == nil {
4✔
484
                return nil
1✔
485
        }
1✔
486
        return &adminv1.MergeDLQMessagesRequest{
2✔
487
                Type:                  FromDLQType(t.Type),
2✔
488
                ShardId:               t.ShardID,
2✔
489
                SourceCluster:         t.SourceCluster,
2✔
490
                InclusiveEndMessageId: fromInt64Value(t.InclusiveEndMessageID),
2✔
491
                PageSize:              t.MaximumPageSize,
2✔
492
                NextPageToken:         t.NextPageToken,
2✔
493
        }
2✔
494
}
495

496
func ToAdminMergeDLQMessagesRequest(t *adminv1.MergeDLQMessagesRequest) *types.MergeDLQMessagesRequest {
3✔
497
        if t == nil {
4✔
498
                return nil
1✔
499
        }
1✔
500
        return &types.MergeDLQMessagesRequest{
2✔
501
                Type:                  ToDLQType(t.Type),
2✔
502
                ShardID:               t.ShardId,
2✔
503
                SourceCluster:         t.SourceCluster,
2✔
504
                InclusiveEndMessageID: toInt64Value(t.InclusiveEndMessageId),
2✔
505
                MaximumPageSize:       t.PageSize,
2✔
506
                NextPageToken:         t.NextPageToken,
2✔
507
        }
2✔
508
}
509

510
func FromAdminMergeDLQMessagesResponse(t *types.MergeDLQMessagesResponse) *adminv1.MergeDLQMessagesResponse {
3✔
511
        if t == nil {
4✔
512
                return nil
1✔
513
        }
1✔
514
        return &adminv1.MergeDLQMessagesResponse{
2✔
515
                NextPageToken: t.NextPageToken,
2✔
516
        }
2✔
517
}
518

519
func ToAdminMergeDLQMessagesResponse(t *adminv1.MergeDLQMessagesResponse) *types.MergeDLQMessagesResponse {
3✔
520
        if t == nil {
4✔
521
                return nil
1✔
522
        }
1✔
523
        return &types.MergeDLQMessagesResponse{
2✔
524
                NextPageToken: t.NextPageToken,
2✔
525
        }
2✔
526
}
527

528
func FromAdminPurgeDLQMessagesRequest(t *types.PurgeDLQMessagesRequest) *adminv1.PurgeDLQMessagesRequest {
3✔
529
        if t == nil {
4✔
530
                return nil
1✔
531
        }
1✔
532
        return &adminv1.PurgeDLQMessagesRequest{
2✔
533
                Type:                  FromDLQType(t.Type),
2✔
534
                ShardId:               t.ShardID,
2✔
535
                SourceCluster:         t.SourceCluster,
2✔
536
                InclusiveEndMessageId: fromInt64Value(t.InclusiveEndMessageID),
2✔
537
        }
2✔
538
}
539

540
func ToAdminPurgeDLQMessagesRequest(t *adminv1.PurgeDLQMessagesRequest) *types.PurgeDLQMessagesRequest {
3✔
541
        if t == nil {
4✔
542
                return nil
1✔
543
        }
1✔
544
        return &types.PurgeDLQMessagesRequest{
2✔
545
                Type:                  ToDLQType(t.Type),
2✔
546
                ShardID:               t.ShardId,
2✔
547
                SourceCluster:         t.SourceCluster,
2✔
548
                InclusiveEndMessageID: toInt64Value(t.InclusiveEndMessageId),
2✔
549
        }
2✔
550
}
551

552
func FromAdminReadDLQMessagesRequest(t *types.ReadDLQMessagesRequest) *adminv1.ReadDLQMessagesRequest {
3✔
553
        if t == nil {
4✔
554
                return nil
1✔
555
        }
1✔
556
        return &adminv1.ReadDLQMessagesRequest{
2✔
557
                Type:                  FromDLQType(t.Type),
2✔
558
                ShardId:               t.ShardID,
2✔
559
                SourceCluster:         t.SourceCluster,
2✔
560
                InclusiveEndMessageId: fromInt64Value(t.InclusiveEndMessageID),
2✔
561
                PageSize:              t.MaximumPageSize,
2✔
562
                NextPageToken:         t.NextPageToken,
2✔
563
        }
2✔
564
}
565

566
func ToAdminReadDLQMessagesRequest(t *adminv1.ReadDLQMessagesRequest) *types.ReadDLQMessagesRequest {
3✔
567
        if t == nil {
4✔
568
                return nil
1✔
569
        }
1✔
570
        return &types.ReadDLQMessagesRequest{
2✔
571
                Type:                  ToDLQType(t.Type),
2✔
572
                ShardID:               t.ShardId,
2✔
573
                SourceCluster:         t.SourceCluster,
2✔
574
                InclusiveEndMessageID: toInt64Value(t.InclusiveEndMessageId),
2✔
575
                MaximumPageSize:       t.PageSize,
2✔
576
                NextPageToken:         t.NextPageToken,
2✔
577
        }
2✔
578
}
579

580
func FromAdminReadDLQMessagesResponse(t *types.ReadDLQMessagesResponse) *adminv1.ReadDLQMessagesResponse {
3✔
581
        if t == nil {
4✔
582
                return nil
1✔
583
        }
1✔
584
        return &adminv1.ReadDLQMessagesResponse{
2✔
585
                Type:                 FromDLQType(t.Type),
2✔
586
                ReplicationTasks:     FromReplicationTaskArray(t.ReplicationTasks),
2✔
587
                ReplicationTasksInfo: FromReplicationTaskInfoArray(t.ReplicationTasksInfo),
2✔
588
                NextPageToken:        t.NextPageToken,
2✔
589
        }
2✔
590
}
591

592
func ToAdminReadDLQMessagesResponse(t *adminv1.ReadDLQMessagesResponse) *types.ReadDLQMessagesResponse {
3✔
593
        if t == nil {
4✔
594
                return nil
1✔
595
        }
1✔
596
        return &types.ReadDLQMessagesResponse{
2✔
597
                Type:                 ToDLQType(t.Type),
2✔
598
                ReplicationTasks:     ToReplicationTaskArray(t.ReplicationTasks),
2✔
599
                ReplicationTasksInfo: ToReplicationTaskInfoArray(t.ReplicationTasksInfo),
2✔
600
                NextPageToken:        t.NextPageToken,
2✔
601
        }
2✔
602
}
603

604
func FromAdminReapplyEventsRequest(t *types.ReapplyEventsRequest) *adminv1.ReapplyEventsRequest {
3✔
605
        if t == nil {
4✔
606
                return nil
1✔
607
        }
1✔
608
        return &adminv1.ReapplyEventsRequest{
2✔
609
                Domain:            t.DomainName,
2✔
610
                WorkflowExecution: FromWorkflowExecution(t.WorkflowExecution),
2✔
611
                Events:            FromDataBlob(t.Events),
2✔
612
        }
2✔
613
}
614

615
func ToAdminReapplyEventsRequest(t *adminv1.ReapplyEventsRequest) *types.ReapplyEventsRequest {
3✔
616
        if t == nil {
4✔
617
                return nil
1✔
618
        }
1✔
619
        return &types.ReapplyEventsRequest{
2✔
620
                DomainName:        t.Domain,
2✔
621
                WorkflowExecution: ToWorkflowExecution(t.WorkflowExecution),
2✔
622
                Events:            ToDataBlob(t.Events),
2✔
623
        }
2✔
624
}
625

626
func FromAdminRefreshWorkflowTasksRequest(t *types.RefreshWorkflowTasksRequest) *adminv1.RefreshWorkflowTasksRequest {
3✔
627
        if t == nil {
4✔
628
                return nil
1✔
629
        }
1✔
630
        return &adminv1.RefreshWorkflowTasksRequest{
2✔
631
                Domain:            t.Domain,
2✔
632
                WorkflowExecution: FromWorkflowExecution(t.Execution),
2✔
633
        }
2✔
634
}
635

636
func ToAdminRefreshWorkflowTasksRequest(t *adminv1.RefreshWorkflowTasksRequest) *types.RefreshWorkflowTasksRequest {
3✔
637
        if t == nil {
4✔
638
                return nil
1✔
639
        }
1✔
640
        return &types.RefreshWorkflowTasksRequest{
2✔
641
                Domain:    t.Domain,
2✔
642
                Execution: ToWorkflowExecution(t.WorkflowExecution),
2✔
643
        }
2✔
644
}
645

646
func FromAdminRemoveTaskRequest(t *types.RemoveTaskRequest) *adminv1.RemoveTaskRequest {
3✔
647
        if t == nil {
4✔
648
                return nil
1✔
649
        }
1✔
650
        return &adminv1.RemoveTaskRequest{
2✔
651
                ShardId:        t.ShardID,
2✔
652
                TaskType:       FromTaskType(t.Type),
2✔
653
                TaskId:         t.TaskID,
2✔
654
                VisibilityTime: unixNanoToTime(t.VisibilityTimestamp),
2✔
655
                ClusterName:    t.ClusterName,
2✔
656
        }
2✔
657
}
658

659
func ToAdminRemoveTaskRequest(t *adminv1.RemoveTaskRequest) *types.RemoveTaskRequest {
3✔
660
        if t == nil {
4✔
661
                return nil
1✔
662
        }
1✔
663
        return &types.RemoveTaskRequest{
2✔
664
                ShardID:             t.ShardId,
2✔
665
                Type:                ToTaskType(t.TaskType),
2✔
666
                TaskID:              t.TaskId,
2✔
667
                VisibilityTimestamp: timeToUnixNano(t.VisibilityTime),
2✔
668
                ClusterName:         t.ClusterName,
2✔
669
        }
2✔
670
}
671

672
func FromAdminResendReplicationTasksRequest(t *types.ResendReplicationTasksRequest) *adminv1.ResendReplicationTasksRequest {
3✔
673
        if t == nil {
4✔
674
                return nil
1✔
675
        }
1✔
676
        return &adminv1.ResendReplicationTasksRequest{
2✔
677
                DomainId:          t.DomainID,
2✔
678
                WorkflowExecution: FromWorkflowRunPair(t.WorkflowID, t.RunID),
2✔
679
                RemoteCluster:     t.RemoteCluster,
2✔
680
                StartEvent:        FromEventIDVersionPair(t.StartEventID, t.StartVersion),
2✔
681
                EndEvent:          FromEventIDVersionPair(t.EndEventID, t.EndVersion),
2✔
682
        }
2✔
683
}
684

685
func ToAdminResendReplicationTasksRequest(t *adminv1.ResendReplicationTasksRequest) *types.ResendReplicationTasksRequest {
3✔
686
        if t == nil {
4✔
687
                return nil
1✔
688
        }
1✔
689
        return &types.ResendReplicationTasksRequest{
2✔
690
                DomainID:      t.DomainId,
2✔
691
                WorkflowID:    ToWorkflowID(t.WorkflowExecution),
2✔
692
                RunID:         ToRunID(t.WorkflowExecution),
2✔
693
                RemoteCluster: t.RemoteCluster,
2✔
694
                StartEventID:  ToEventID(t.StartEvent),
2✔
695
                StartVersion:  ToEventVersion(t.StartEvent),
2✔
696
                EndEventID:    ToEventID(t.EndEvent),
2✔
697
                EndVersion:    ToEventVersion(t.EndEvent),
2✔
698
        }
2✔
699
}
700

701
func FromAdminResetQueueRequest(t *types.ResetQueueRequest) *adminv1.ResetQueueRequest {
3✔
702
        if t == nil {
4✔
703
                return nil
1✔
704
        }
1✔
705
        return &adminv1.ResetQueueRequest{
2✔
706
                ShardId:     t.ShardID,
2✔
707
                ClusterName: t.ClusterName,
2✔
708
                TaskType:    FromTaskType(t.Type),
2✔
709
        }
2✔
710
}
711

712
func ToAdminResetQueueRequest(t *adminv1.ResetQueueRequest) *types.ResetQueueRequest {
3✔
713
        if t == nil {
4✔
714
                return nil
1✔
715
        }
1✔
716
        return &types.ResetQueueRequest{
2✔
717
                ShardID:     t.ShardId,
2✔
718
                ClusterName: t.ClusterName,
2✔
719
                Type:        ToTaskType(t.TaskType),
2✔
720
        }
2✔
721
}
722

723
// FromAdminGetCrossClusterTasksRequest converts internal GetCrossClusterTasksRequest type to proto
724
func FromAdminGetCrossClusterTasksRequest(t *types.GetCrossClusterTasksRequest) *adminv1.GetCrossClusterTasksRequest {
75✔
725
        if t == nil {
76✔
726
                return nil
1✔
727
        }
1✔
728
        return &adminv1.GetCrossClusterTasksRequest{
74✔
729
                ShardIds:      t.ShardIDs,
74✔
730
                TargetCluster: t.TargetCluster,
74✔
731
        }
74✔
732
}
733

734
// ToAdminGetCrossClusterTasksRequest converts proto GetCrossClusterTasksRequest type to internal
735
func ToAdminGetCrossClusterTasksRequest(t *adminv1.GetCrossClusterTasksRequest) *types.GetCrossClusterTasksRequest {
3✔
736
        if t == nil {
4✔
737
                return nil
1✔
738
        }
1✔
739
        return &types.GetCrossClusterTasksRequest{
2✔
740
                ShardIDs:      t.ShardIds,
2✔
741
                TargetCluster: t.TargetCluster,
2✔
742
        }
2✔
743
}
744

745
// FromAdminGetCrossClusterTasksResponse converts internal GetCrossClusterTasksResponse type to proto
746
func FromAdminGetCrossClusterTasksResponse(t *types.GetCrossClusterTasksResponse) *adminv1.GetCrossClusterTasksResponse {
3✔
747
        if t == nil {
4✔
748
                return nil
1✔
749
        }
1✔
750
        return &adminv1.GetCrossClusterTasksResponse{
2✔
751
                TasksByShard:       FromCrossClusterTaskRequestMap(t.TasksByShard),
2✔
752
                FailedCauseByShard: FromGetTaskFailedCauseMap(t.FailedCauseByShard),
2✔
753
        }
2✔
754
}
755

756
// ToAdminGetCrossClusterTasksResponse converts proto GetCrossClusterTasksResponse type to internal
757
func ToAdminGetCrossClusterTasksResponse(t *adminv1.GetCrossClusterTasksResponse) *types.GetCrossClusterTasksResponse {
75✔
758
        if t == nil {
76✔
759
                return nil
1✔
760
        }
1✔
761
        return &types.GetCrossClusterTasksResponse{
74✔
762
                TasksByShard:       ToCrossClusterTaskRequestMap(t.TasksByShard),
74✔
763
                FailedCauseByShard: ToGetTaskFailedCauseMap(t.FailedCauseByShard),
74✔
764
        }
74✔
765
}
766

767
// FromAdminRespondCrossClusterTasksCompletedRequest converts internal RespondCrossClusterTasksCompletedRequest type to thrift
768
func FromAdminRespondCrossClusterTasksCompletedRequest(t *types.RespondCrossClusterTasksCompletedRequest) *adminv1.RespondCrossClusterTasksCompletedRequest {
3✔
769
        if t == nil {
4✔
770
                return nil
1✔
771
        }
1✔
772
        return &adminv1.RespondCrossClusterTasksCompletedRequest{
2✔
773
                ShardId:       t.ShardID,
2✔
774
                TargetCluster: t.TargetCluster,
2✔
775
                TaskResponses: FromCrossClusterTaskResponseArray(t.TaskResponses),
2✔
776
                FetchNewTasks: t.FetchNewTasks,
2✔
777
        }
2✔
778
}
779

780
// ToAdminRespondCrossClusterTasksCompletedRequest converts thrift RespondCrossClusterTasksCompletedRequest type to internal
781
func ToAdminRespondCrossClusterTasksCompletedRequest(t *adminv1.RespondCrossClusterTasksCompletedRequest) *types.RespondCrossClusterTasksCompletedRequest {
3✔
782
        if t == nil {
4✔
783
                return nil
1✔
784
        }
1✔
785
        return &types.RespondCrossClusterTasksCompletedRequest{
2✔
786
                ShardID:       t.ShardId,
2✔
787
                TargetCluster: t.TargetCluster,
2✔
788
                TaskResponses: ToCrossClusterTaskResponseArray(t.TaskResponses),
2✔
789
                FetchNewTasks: t.FetchNewTasks,
2✔
790
        }
2✔
791
}
792

793
// FromAdminRespondCrossClusterTasksCompletedResponse converts internal RespondCrossClusterTasksCompletedResponse type to thrift
794
func FromAdminRespondCrossClusterTasksCompletedResponse(t *types.RespondCrossClusterTasksCompletedResponse) *adminv1.RespondCrossClusterTasksCompletedResponse {
3✔
795
        if t == nil {
4✔
796
                return nil
1✔
797
        }
1✔
798
        return &adminv1.RespondCrossClusterTasksCompletedResponse{
2✔
799
                Tasks: FromCrossClusterTaskRequestArray(t.Tasks),
2✔
800
        }
2✔
801
}
802

803
// ToAdminRespondCrossClusterTasksCompletedResponse converts thrift RespondCrossClusterTasksCompletedResponse type to internal
804
func ToAdminRespondCrossClusterTasksCompletedResponse(t *adminv1.RespondCrossClusterTasksCompletedResponse) *types.RespondCrossClusterTasksCompletedResponse {
3✔
805
        if t == nil {
4✔
806
                return nil
1✔
807
        }
1✔
808
        return &types.RespondCrossClusterTasksCompletedResponse{
2✔
809
                Tasks: ToCrossClusterTaskRequestArray(t.Tasks),
2✔
810
        }
2✔
811
}
812

813
// FromGetDynamicConfigRequest converts internal GetDynamicConfigRequest type to proto
814
func FromGetDynamicConfigRequest(t *types.GetDynamicConfigRequest) *adminv1.GetDynamicConfigRequest {
×
815
        if t == nil {
×
816
                return nil
×
817
        }
×
818
        return &adminv1.GetDynamicConfigRequest{
×
819
                ConfigName: t.ConfigName,
×
820
                Filters:    FromDynamicConfigFilterArray(t.Filters),
×
821
        }
×
822
}
823

824
// ToGetDynamicConfigRequest converts proto GetDynamicConfigRequest type to internal
825
func ToGetDynamicConfigRequest(t *adminv1.GetDynamicConfigRequest) *types.GetDynamicConfigRequest {
×
826
        if t == nil {
×
827
                return nil
×
828
        }
×
829
        return &types.GetDynamicConfigRequest{
×
830
                ConfigName: t.ConfigName,
×
831
                Filters:    ToDynamicConfigFilterArray(t.Filters),
×
832
        }
×
833
}
834

835
// FromGetDynamicConfigResponse converts internal GetDynamicConfigResponse type to proto
836
func FromGetDynamicConfigResponse(t *types.GetDynamicConfigResponse) *adminv1.GetDynamicConfigResponse {
×
837
        if t == nil {
×
838
                return nil
×
839
        }
×
840
        return &adminv1.GetDynamicConfigResponse{
×
841
                Value: FromDataBlob(t.Value),
×
842
        }
×
843
}
844

845
// ToGetDynamicConfigResponse converts proto GetDynamicConfigResponse type to internal
846
func ToGetDynamicConfigResponse(t *adminv1.GetDynamicConfigResponse) *types.GetDynamicConfigResponse {
×
847
        if t == nil {
×
848
                return nil
×
849
        }
×
850
        return &types.GetDynamicConfigResponse{
×
851
                Value: ToDataBlob(t.Value),
×
852
        }
×
853
}
854

855
// FromUpdateDynamicConfigRequest converts internal UpdateDynamicConfigRequest type to proto
856
func FromUpdateDynamicConfigRequest(t *types.UpdateDynamicConfigRequest) *adminv1.UpdateDynamicConfigRequest {
×
857
        if t == nil {
×
858
                return nil
×
859
        }
×
860
        return &adminv1.UpdateDynamicConfigRequest{
×
861
                ConfigName:   t.ConfigName,
×
862
                ConfigValues: FromDynamicConfigValueArray(t.ConfigValues),
×
863
        }
×
864
}
865

866
// ToUpdateDynamicConfigRequest converts proto UpdateDynamicConfigRequest type to internal
867
func ToUpdateDynamicConfigRequest(t *adminv1.UpdateDynamicConfigRequest) *types.UpdateDynamicConfigRequest {
×
868
        if t == nil {
×
869
                return nil
×
870
        }
×
871
        return &types.UpdateDynamicConfigRequest{
×
872
                ConfigName:   t.ConfigName,
×
873
                ConfigValues: ToDynamicConfigValueArray(t.ConfigValues),
×
874
        }
×
875
}
876

877
// FromRestoreDynamicConfigRequest converts internal RestoreDynamicConfigRequest type to proto
878
func FromRestoreDynamicConfigRequest(t *types.RestoreDynamicConfigRequest) *adminv1.RestoreDynamicConfigRequest {
×
879
        if t == nil {
×
880
                return nil
×
881
        }
×
882
        return &adminv1.RestoreDynamicConfigRequest{
×
883
                ConfigName: t.ConfigName,
×
884
                Filters:    FromDynamicConfigFilterArray(t.Filters),
×
885
        }
×
886
}
887

888
// ToRestoreDynamicConfigRequest converts proto RestoreDynamicConfigRequest type to internal
889
func ToRestoreDynamicConfigRequest(t *adminv1.RestoreDynamicConfigRequest) *types.RestoreDynamicConfigRequest {
×
890
        if t == nil {
×
891
                return nil
×
892
        }
×
893
        return &types.RestoreDynamicConfigRequest{
×
894
                ConfigName: t.ConfigName,
×
895
                Filters:    ToDynamicConfigFilterArray(t.Filters),
×
896
        }
×
897
}
898

899
// FromAdminDeleteWorkflowRequest converts internal AdminDeleteWorkflowRequest type to proto
900
func FromAdminDeleteWorkflowRequest(t *types.AdminDeleteWorkflowRequest) *adminv1.DeleteWorkflowRequest {
×
901
        if t == nil {
×
902
                return nil
×
903
        }
×
904
        return &adminv1.DeleteWorkflowRequest{
×
905
                Domain:            t.Domain,
×
906
                WorkflowExecution: FromWorkflowExecution(t.Execution),
×
907
        }
×
908
}
909

910
// ToAdminDeleteWorkflowRequest converts proto AdminDeleteWorkflowRequest type to internal
911
func ToAdminDeleteWorkflowRequest(t *adminv1.DeleteWorkflowRequest) *types.AdminDeleteWorkflowRequest {
×
912
        if t == nil {
×
913
                return nil
×
914
        }
×
915
        return &types.AdminDeleteWorkflowRequest{
×
916
                Domain:    t.Domain,
×
917
                Execution: ToWorkflowExecution(t.WorkflowExecution),
×
918
        }
×
919
}
920

921
// FromAdminDeleteWorkflowResponse converts internal AdminDeleteWorkflowRequest type to proto
922
func FromAdminDeleteWorkflowResponse(t *types.AdminDeleteWorkflowResponse) *adminv1.DeleteWorkflowResponse {
×
923
        if t == nil {
×
924
                return nil
×
925
        }
×
926
        return &adminv1.DeleteWorkflowResponse{
×
927
                HistoryDeleted:    t.HistoryDeleted,
×
928
                ExecutionsDeleted: t.ExecutionsDeleted,
×
929
                VisibilityDeleted: t.VisibilityDeleted,
×
930
        }
×
931
}
932

933
// ToAdminDeleteWorkflowResponse converts proto AdminDeleteWorkflowResponse type to internal
934
func ToAdminDeleteWorkflowResponse(t *adminv1.DeleteWorkflowResponse) *types.AdminDeleteWorkflowResponse {
×
935
        if t == nil {
×
936
                return nil
×
937
        }
×
938
        return &types.AdminDeleteWorkflowResponse{
×
939
                HistoryDeleted:    t.HistoryDeleted,
×
940
                ExecutionsDeleted: t.ExecutionsDeleted,
×
941
                VisibilityDeleted: t.VisibilityDeleted,
×
942
        }
×
943
}
944

945
// FromAdminMaintainWorkflowRequest converts internal AdminMaintainWorkflowRequest type to proto
946
func FromAdminMaintainWorkflowRequest(t *types.AdminMaintainWorkflowRequest) *adminv1.MaintainCorruptWorkflowRequest {
×
947
        if t == nil {
×
948
                return nil
×
949
        }
×
950
        return &adminv1.MaintainCorruptWorkflowRequest{
×
951
                Domain:            t.Domain,
×
952
                WorkflowExecution: FromWorkflowExecution(t.Execution),
×
953
        }
×
954
}
955

956
// ToAdminMaintainWorkflowRequest converts proto AdminMaintainWorkflowRequest type to internal
957
func ToAdminMaintainWorkflowRequest(t *adminv1.MaintainCorruptWorkflowRequest) *types.AdminMaintainWorkflowRequest {
×
958
        if t == nil {
×
959
                return nil
×
960
        }
×
961
        return &types.AdminMaintainWorkflowRequest{
×
962
                Domain:    t.Domain,
×
963
                Execution: ToWorkflowExecution(t.WorkflowExecution),
×
964
        }
×
965
}
966

967
// FromAdminMaintainWorkflowResponse converts internal AdminMaintainWorkflowResponse type to proto
968
func FromAdminMaintainWorkflowResponse(t *types.AdminMaintainWorkflowResponse) *adminv1.MaintainCorruptWorkflowResponse {
×
969
        if t == nil {
×
970
                return nil
×
971
        }
×
972
        return &adminv1.MaintainCorruptWorkflowResponse{
×
973
                HistoryDeleted:    t.HistoryDeleted,
×
974
                ExecutionsDeleted: t.ExecutionsDeleted,
×
975
                VisibilityDeleted: t.VisibilityDeleted,
×
976
        }
×
977
}
978

979
// ToAdminMaintainWorkflowResponse converts proto AdminMaintainWorkflowResponse type to internal
980
func ToAdminMaintainWorkflowResponse(t *adminv1.MaintainCorruptWorkflowResponse) *types.AdminMaintainWorkflowResponse {
×
981
        if t == nil {
×
982
                return nil
×
983
        }
×
984
        return &types.AdminMaintainWorkflowResponse{
×
985
                HistoryDeleted:    t.HistoryDeleted,
×
986
                ExecutionsDeleted: t.ExecutionsDeleted,
×
987
                VisibilityDeleted: t.VisibilityDeleted,
×
988
        }
×
989
}
990

991
// FromListDynamicConfigRequest converts internal ListDynamicConfigRequest type to proto
992
func FromListDynamicConfigRequest(t *types.ListDynamicConfigRequest) *adminv1.ListDynamicConfigRequest {
×
993
        if t == nil {
×
994
                return nil
×
995
        }
×
996
        return &adminv1.ListDynamicConfigRequest{
×
997
                ConfigName: t.ConfigName,
×
998
        }
×
999
}
1000

1001
// ToListDynamicConfigRequest converts proto ListDynamicConfigRequest type to internal
1002
func ToListDynamicConfigRequest(t *adminv1.ListDynamicConfigRequest) *types.ListDynamicConfigRequest {
×
1003
        if t == nil {
×
1004
                return nil
×
1005
        }
×
1006
        return &types.ListDynamicConfigRequest{
×
1007
                ConfigName: t.ConfigName,
×
1008
        }
×
1009
}
1010

1011
// FromListDynamicConfigResponse converts internal ListDynamicConfigResponse type to proto
1012
func FromListDynamicConfigResponse(t *types.ListDynamicConfigResponse) *adminv1.ListDynamicConfigResponse {
×
1013
        if t == nil {
×
1014
                return nil
×
1015
        }
×
1016
        return &adminv1.ListDynamicConfigResponse{
×
1017
                Entries: FromDynamicConfigEntryArray(t.Entries),
×
1018
        }
×
1019
}
1020

1021
// ToListDynamicConfigResponse converts proto ListDynamicConfigResponse type to internal
1022
func ToListDynamicConfigResponse(t *adminv1.ListDynamicConfigResponse) *types.ListDynamicConfigResponse {
×
1023
        if t == nil {
×
1024
                return nil
×
1025
        }
×
1026
        return &types.ListDynamicConfigResponse{
×
1027
                Entries: ToDynamicConfigEntryArray(t.Entries),
×
1028
        }
×
1029
}
1030

1031
// FromDynamicConfigEntryArray converts internal DynamicConfigEntry array type to proto
1032
func FromDynamicConfigEntryArray(t []*types.DynamicConfigEntry) []*adminv1.DynamicConfigEntry {
×
1033
        if t == nil {
×
1034
                return nil
×
1035
        }
×
1036
        v := make([]*adminv1.DynamicConfigEntry, len(t))
×
1037
        for i := range t {
×
1038
                v[i] = FromDynamicConfigEntry(t[i])
×
1039
        }
×
1040
        return v
×
1041
}
1042

1043
// ToDynamicConfigEntryArray converts proto DynamicConfigEntry array type to internal
1044
func ToDynamicConfigEntryArray(t []*adminv1.DynamicConfigEntry) []*types.DynamicConfigEntry {
×
1045
        if t == nil {
×
1046
                return nil
×
1047
        }
×
1048
        v := make([]*types.DynamicConfigEntry, len(t))
×
1049
        for i := range t {
×
1050
                v[i] = ToDynamicConfigEntry(t[i])
×
1051
        }
×
1052
        return v
×
1053
}
1054

1055
// FromDynamicConfigEntry converts internal DynamicConfigEntry type to proto
1056
func FromDynamicConfigEntry(t *types.DynamicConfigEntry) *adminv1.DynamicConfigEntry {
×
1057
        if t == nil {
×
1058
                return nil
×
1059
        }
×
1060
        return &adminv1.DynamicConfigEntry{
×
1061
                Name:   t.Name,
×
1062
                Values: FromDynamicConfigValueArray(t.Values),
×
1063
        }
×
1064
}
1065

1066
// ToDynamicConfigEntry converts proto DynamicConfigEntry type to internal
1067
func ToDynamicConfigEntry(t *adminv1.DynamicConfigEntry) *types.DynamicConfigEntry {
×
1068
        if t == nil {
×
1069
                return nil
×
1070
        }
×
1071
        return &types.DynamicConfigEntry{
×
1072
                Name:   t.Name,
×
1073
                Values: ToDynamicConfigValueArray(t.Values),
×
1074
        }
×
1075
}
1076

1077
// FromDynamicConfigValueArray converts internal DynamicConfigValue array type to proto
1078
func FromDynamicConfigValueArray(t []*types.DynamicConfigValue) []*adminv1.DynamicConfigValue {
×
1079
        if t == nil {
×
1080
                return nil
×
1081
        }
×
1082
        v := make([]*adminv1.DynamicConfigValue, len(t))
×
1083
        for i := range t {
×
1084
                v[i] = FromDynamicConfigValue(t[i])
×
1085
        }
×
1086
        return v
×
1087
}
1088

1089
// ToDynamicConfigValueArray converts proto DynamicConfigValue array type to internal
1090
func ToDynamicConfigValueArray(t []*adminv1.DynamicConfigValue) []*types.DynamicConfigValue {
×
1091
        if t == nil {
×
1092
                return nil
×
1093
        }
×
1094
        v := make([]*types.DynamicConfigValue, len(t))
×
1095
        for i := range t {
×
1096
                v[i] = ToDynamicConfigValue(t[i])
×
1097
        }
×
1098
        return v
×
1099
}
1100

1101
// FromDynamicConfigValue converts internal DynamicConfigValue type to proto
1102
func FromDynamicConfigValue(t *types.DynamicConfigValue) *adminv1.DynamicConfigValue {
×
1103
        if t == nil {
×
1104
                return nil
×
1105
        }
×
1106
        return &adminv1.DynamicConfigValue{
×
1107
                Value:   FromDataBlob(t.Value),
×
1108
                Filters: FromDynamicConfigFilterArray(t.Filters),
×
1109
        }
×
1110
}
1111

1112
// ToDynamicConfigValue converts proto DynamicConfigValue type to internal
1113
func ToDynamicConfigValue(t *adminv1.DynamicConfigValue) *types.DynamicConfigValue {
×
1114
        if t == nil {
×
1115
                return nil
×
1116
        }
×
1117
        return &types.DynamicConfigValue{
×
1118
                Value:   ToDataBlob(t.Value),
×
1119
                Filters: ToDynamicConfigFilterArray(t.Filters),
×
1120
        }
×
1121
}
1122

1123
// FromDynamicConfigFilterArray converts internal DynamicConfigFilter array type to proto
1124
func FromDynamicConfigFilterArray(t []*types.DynamicConfigFilter) []*adminv1.DynamicConfigFilter {
×
1125
        if t == nil {
×
1126
                return nil
×
1127
        }
×
1128
        v := make([]*adminv1.DynamicConfigFilter, len(t))
×
1129
        for i := range t {
×
1130
                v[i] = FromDynamicConfigFilter(t[i])
×
1131
        }
×
1132
        return v
×
1133
}
1134

1135
// ToDynamicConfigFilterArray converts proto DynamicConfigFilter array type to internal
1136
func ToDynamicConfigFilterArray(t []*adminv1.DynamicConfigFilter) []*types.DynamicConfigFilter {
×
1137
        if t == nil {
×
1138
                return nil
×
1139
        }
×
1140
        v := make([]*types.DynamicConfigFilter, len(t))
×
1141
        for i := range t {
×
1142
                v[i] = ToDynamicConfigFilter(t[i])
×
1143
        }
×
1144
        return v
×
1145
}
1146

1147
// FromDynamicConfigFilter converts internal DynamicConfigFilter type to proto
1148
func FromDynamicConfigFilter(t *types.DynamicConfigFilter) *adminv1.DynamicConfigFilter {
×
1149
        if t == nil {
×
1150
                return nil
×
1151
        }
×
1152
        return &adminv1.DynamicConfigFilter{
×
1153
                Name:  t.Name,
×
1154
                Value: FromDataBlob(t.Value),
×
1155
        }
×
1156
}
1157

1158
// ToDynamicConfigFilter converts thrift DynamicConfigFilter type to internal
1159
func ToDynamicConfigFilter(t *adminv1.DynamicConfigFilter) *types.DynamicConfigFilter {
×
1160
        if t == nil {
×
1161
                return nil
×
1162
        }
×
1163
        return &types.DynamicConfigFilter{
×
1164
                Name:  t.Name,
×
1165
                Value: ToDataBlob(t.Value),
×
1166
        }
×
1167
}
1168

1169
func FromGetGlobalIsolationGroupsResponse(t *types.GetGlobalIsolationGroupsResponse) *adminv1.GetGlobalIsolationGroupsResponse {
3✔
1170
        if t == nil {
4✔
1171
                return nil
1✔
1172
        }
1✔
1173
        return &adminv1.GetGlobalIsolationGroupsResponse{
2✔
1174
                IsolationGroups: FromIsolationGroupConfig(&t.IsolationGroups),
2✔
1175
        }
2✔
1176
}
1177

1178
func FromUpdateGlobalIsolationGroupsRequest(t *types.UpdateGlobalIsolationGroupsRequest) *adminv1.UpdateGlobalIsolationGroupsRequest {
3✔
1179
        if t == nil {
4✔
1180
                return nil
1✔
1181
        }
1✔
1182
        if t.IsolationGroups == nil {
3✔
1183
                return &adminv1.UpdateGlobalIsolationGroupsRequest{}
1✔
1184
        }
1✔
1185
        return &adminv1.UpdateGlobalIsolationGroupsRequest{
1✔
1186
                IsolationGroups: FromIsolationGroupConfig(&t.IsolationGroups),
1✔
1187
        }
1✔
1188
}
1189

1190
func FromUpdateDomainIsolationGroupsRequest(t *types.UpdateDomainIsolationGroupsRequest) *adminv1.UpdateDomainIsolationGroupsRequest {
×
1191
        if t == nil {
×
1192
                return nil
×
1193
        }
×
1194
        if t.IsolationGroups == nil {
×
1195
                return &adminv1.UpdateDomainIsolationGroupsRequest{}
×
1196
        }
×
1197
        return &adminv1.UpdateDomainIsolationGroupsRequest{
×
1198
                IsolationGroups: FromIsolationGroupConfig(&t.IsolationGroups),
×
1199
        }
×
1200
}
1201

1202
func FromGetGlobalIsolationGroupsRequest(t *types.GetGlobalIsolationGroupsRequest) *adminv1.GetGlobalIsolationGroupsRequest {
×
1203
        if t == nil {
×
1204
                return nil
×
1205
        }
×
1206
        return &adminv1.GetGlobalIsolationGroupsRequest{}
×
1207
}
1208

1209
func FromGetDomainIsolationGroupsRequest(t *types.GetDomainIsolationGroupsRequest) *adminv1.GetDomainIsolationGroupsRequest {
×
1210
        if t == nil {
×
1211
                return nil
×
1212
        }
×
1213
        return &adminv1.GetDomainIsolationGroupsRequest{
×
1214
                Domain: t.Domain,
×
1215
        }
×
1216
}
1217

1218
func ToGetGlobalIsolationGroupsRequest(t *adminv1.GetGlobalIsolationGroupsRequest) *types.GetGlobalIsolationGroupsRequest {
2✔
1219
        if t == nil {
2✔
1220
                return nil
×
1221
        }
×
1222
        return &types.GetGlobalIsolationGroupsRequest{}
2✔
1223
}
1224

1225
func ToGetGlobalIsolationGroupsResponse(t *adminv1.GetGlobalIsolationGroupsResponse) *types.GetGlobalIsolationGroupsResponse {
3✔
1226
        if t == nil {
4✔
1227
                return nil
1✔
1228
        }
1✔
1229
        ig := ToIsolationGroupConfig(t.IsolationGroups)
2✔
1230
        if ig == nil {
2✔
1231
                return &types.GetGlobalIsolationGroupsResponse{}
×
1232
        }
×
1233
        return &types.GetGlobalIsolationGroupsResponse{
2✔
1234
                IsolationGroups: *ig,
2✔
1235
        }
2✔
1236
}
1237

1238
func ToGetDomainIsolationGroupsResponse(t *adminv1.GetDomainIsolationGroupsResponse) *types.GetDomainIsolationGroupsResponse {
×
1239
        if t == nil {
×
1240
                return nil
×
1241
        }
×
1242
        ig := ToIsolationGroupConfig(t.IsolationGroups)
×
1243
        if ig == nil {
×
1244
                return &types.GetDomainIsolationGroupsResponse{}
×
1245
        }
×
1246
        return &types.GetDomainIsolationGroupsResponse{
×
1247
                IsolationGroups: *ig,
×
1248
        }
×
1249
}
1250

1251
func FromGetDomainIsolationGroupsResponse(t *types.GetDomainIsolationGroupsResponse) *adminv1.GetDomainIsolationGroupsResponse {
2✔
1252
        if t == nil {
2✔
1253
                return nil
×
1254
        }
×
1255
        cfg := FromIsolationGroupConfig(&t.IsolationGroups)
2✔
1256
        return &adminv1.GetDomainIsolationGroupsResponse{
2✔
1257
                IsolationGroups: cfg,
2✔
1258
        }
2✔
1259
}
1260

1261
func ToGetDomainIsolationGroupsRequest(t *adminv1.GetDomainIsolationGroupsRequest) *types.GetDomainIsolationGroupsRequest {
3✔
1262
        if t == nil {
4✔
1263
                return nil
1✔
1264
        }
1✔
1265
        return &types.GetDomainIsolationGroupsRequest{Domain: t.Domain}
2✔
1266
}
1267

1268
func FromUpdateGlobalIsolationGroupsResponse(t *types.UpdateGlobalIsolationGroupsResponse) *adminv1.UpdateGlobalIsolationGroupsResponse {
3✔
1269
        if t == nil {
5✔
1270
                return nil
2✔
1271
        }
2✔
1272
        return &adminv1.UpdateGlobalIsolationGroupsResponse{}
1✔
1273
}
1274

1275
func ToUpdateGlobalIsolationGroupsRequest(t *adminv1.UpdateGlobalIsolationGroupsRequest) *types.UpdateGlobalIsolationGroupsRequest {
3✔
1276
        if t == nil {
4✔
1277
                return nil
1✔
1278
        }
1✔
1279
        cfg := ToIsolationGroupConfig(t.IsolationGroups)
2✔
1280
        if cfg == nil {
3✔
1281
                return &types.UpdateGlobalIsolationGroupsRequest{}
1✔
1282
        }
1✔
1283
        return &types.UpdateGlobalIsolationGroupsRequest{
1✔
1284
                IsolationGroups: *cfg,
1✔
1285
        }
1✔
1286
}
1287

1288
func ToUpdateGlobalIsolationGroupsResponse(t *adminv1.UpdateGlobalIsolationGroupsResponse) *types.UpdateGlobalIsolationGroupsResponse {
×
1289
        if t == nil {
×
1290
                return nil
×
1291
        }
×
1292
        return &types.UpdateGlobalIsolationGroupsResponse{}
×
1293
}
1294

1295
func ToUpdateDomainIsolationGroupsResponse(t *adminv1.UpdateDomainIsolationGroupsResponse) *types.UpdateDomainIsolationGroupsResponse {
×
1296
        if t == nil {
×
1297
                return nil
×
1298
        }
×
1299
        return &types.UpdateDomainIsolationGroupsResponse{}
×
1300
}
1301

1302
func FromUpdateDomainIsolationGroupsResponse(t *types.UpdateDomainIsolationGroupsResponse) *adminv1.UpdateDomainIsolationGroupsResponse {
2✔
1303
        if t == nil {
3✔
1304
                return nil
1✔
1305
        }
1✔
1306
        return &adminv1.UpdateDomainIsolationGroupsResponse{}
1✔
1307
}
1308

1309
func ToUpdateDomainIsolationGroupsRequest(t *adminv1.UpdateDomainIsolationGroupsRequest) *types.UpdateDomainIsolationGroupsRequest {
2✔
1310
        if t == nil {
3✔
1311
                return nil
1✔
1312
        }
1✔
1313
        cfg := ToIsolationGroupConfig(t.IsolationGroups)
1✔
1314
        if cfg == nil {
1✔
1315
                return &types.UpdateDomainIsolationGroupsRequest{
×
1316
                        Domain: t.Domain,
×
1317
                }
×
1318
        }
×
1319
        return &types.UpdateDomainIsolationGroupsRequest{
1✔
1320
                Domain:          t.Domain,
1✔
1321
                IsolationGroups: *cfg,
1✔
1322
        }
1✔
1323
}
1324

1325
func FromIsolationGroupConfig(in *types.IsolationGroupConfiguration) *apiv1.IsolationGroupConfiguration {
139✔
1326
        if in == nil {
139✔
1327
                return nil
×
1328
        }
×
1329
        var out []*apiv1.IsolationGroupPartition
139✔
1330
        for _, v := range *in {
179✔
1331
                out = append(out, &apiv1.IsolationGroupPartition{
40✔
1332
                        Name:  v.Name,
40✔
1333
                        State: apiv1.IsolationGroupState(v.State),
40✔
1334
                })
40✔
1335
        }
40✔
1336
        sort.Slice(out, func(i, j int) bool {
159✔
1337
                if out[i] == nil || out[j] == nil {
20✔
1338
                        return false
×
1339
                }
×
1340
                return out[i].Name < out[j].Name
20✔
1341
        })
1342
        return &apiv1.IsolationGroupConfiguration{
139✔
1343
                IsolationGroups: out,
139✔
1344
        }
139✔
1345
}
1346

1347
func ToIsolationGroupConfig(in *apiv1.IsolationGroupConfiguration) *types.IsolationGroupConfiguration {
22✔
1348
        if in == nil {
23✔
1349
                return nil
1✔
1350
        }
1✔
1351
        out := make(types.IsolationGroupConfiguration)
21✔
1352
        for v := range in.IsolationGroups {
61✔
1353
                out[in.IsolationGroups[v].Name] = types.IsolationGroupPartition{
40✔
1354
                        Name:  in.IsolationGroups[v].Name,
40✔
1355
                        State: types.IsolationGroupState(in.IsolationGroups[v].State),
40✔
1356
                }
40✔
1357
        }
40✔
1358
        return &out
21✔
1359
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc