/
types.go
1917 lines (1638 loc) · 66.7 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This source code file is AUTO-GENERATED by github.com/taskcluster/jsonschema2go
package tcqueue
import (
"encoding/json"
"errors"
tcclient "github.com/taskcluster/taskcluster/clients/client-go/v20"
)
type (
// Actions provide a generic mechanism to expose additional features of a
// provisioner, worker type, or worker to Taskcluster clients.
//
// An action is comprised of metadata describing the feature it exposes,
// together with a webhook for triggering it.
//
// The Taskcluster tools site, for example, retrieves actions when displaying
// provisioners, worker types and workers. It presents the provisioner/worker
// type/worker specific actions to the user. When the user triggers an action,
// the web client takes the registered webhook, substitutes parameters into the
// URL (see `url`), signs the requests with the Taskcluster credentials of the
// user operating the web interface, and issues the HTTP request.
//
// The level to which the action relates (provisioner, worker type, worker) is
// called the action context. All actions, regardless of the action contexts,
// are registered against the provisioner when calling
// `queue.declareProvisioner`.
//
// The action context is used by the web client to determine where in the web
// interface to present the action to the user as follows:
//
// | `context` | Tool where action is displayed |
// |-------------|--------------------------------|
// | provisioner | Provisioner Explorer |
// | worker-type | Workers Explorer |
// | worker | Worker Explorer |
//
// See [actions docs](/docs/reference/platform/taskcluster-queue/docs/actions)
// for more information.
Action struct {
// Actions have a "context" that is one of provisioner, worker-type, or worker, indicating
// which it applies to. `context` is used by the front-end to know where to display the action.
//
// | `context` | Page displayed |
// |-------------|-----------------------|
// | provisioner | Provisioner Explorer |
// | worker-type | Workers Explorer |
// | worker | Worker Explorer |
//
// Possible values:
// * "provisioner"
// * "worker-type"
// * "worker"
Context string `json:"context"`
// Description of the provisioner.
Description string `json:"description"`
// Method to indicate the desired action to be performed for a given resource.
//
// Possible values:
// * "POST"
// * "PUT"
// * "DELETE"
// * "PATCH"
Method string `json:"method"`
// Short names for things like logging/error messages.
Name string `json:"name"`
// Appropriate title for any sort of Modal prompt.
Title json.RawMessage `json:"title"`
// When an action is triggered, a request is made using the `url` and `method`.
// Depending on the `context`, the following parameters will be substituted in the url:
//
// | `context` | Path parameters |
// |-------------|----------------------------------------------------------|
// | provisioner | <provisionerId> |
// | worker-type | <provisionerId>, <workerType> |
// | worker | <provisionerId>, <workerType>, <workerGroup>, <workerId> |
//
// _Note: The request needs to be signed with the user's Taskcluster credentials._
URL string `json:"url"`
}
// Information about an artifact for the given `taskId` and `runId`.
Artifact struct {
// Mimetype for the artifact that was created.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date and time after which the artifact created will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires"`
// Name of the artifact that was created, this is useful if you want to
// attempt to fetch the artifact.
//
// Max length: 1024
Name string `json:"name"`
// This is the `storageType` for the request that was used to create
// the artifact.
//
// Possible values:
// * "blob"
// * "s3"
// * "azure"
// * "reference"
// * "error"
StorageType string `json:"storageType"`
}
// Request for an Azure Shared Access Signature (SAS) that will allow
// you to upload an artifact to an Azure blob storage container managed
// by the queue.
AzureArtifactRequest struct {
// Artifact mime-type, when uploading artifact please use the same
// `Content-Type`, consistently using the correct mime-type make
// tooling a lot easier, specifically, always using `application/json`
// for JSON artifacts.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which the artifact should be deleted.
// Note, that these will be collected over time, and artifacts may
// remain available after expiration. Azure based artifacts are
// identified in azure table storage and explicitly deleted in the
// azure storage container after expiration.
Expires tcclient.Time `json:"expires"`
// Artifact storage type, in this case `azure`
//
// Possible values:
// * "azure"
StorageType string `json:"storageType"`
}
// Response to a request for an Azure Shared Access Signature (SAS)
// that will allow you to upload an artifact to an Azure blob storage
// container managed by the queue.
AzureArtifactResponse struct {
// Artifact mime-type, should be specified with the
// `x-ms-blob-content-type` when committing the block.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which Shared Access Signature (SAS) will
// seize to work.
Expires tcclient.Time `json:"expires"`
// Shared Access Signature (SAS) with write permissions, see
// [Azure REST API]
// (http://msdn.microsoft.com/en-US/library/azure/dn140256.aspx)
// reference for details on how to use this.
PutURL string `json:"putUrl"`
// Artifact storage type, in this case `azure`
//
// Possible values:
// * "azure"
StorageType string `json:"storageType"`
}
// Request a list of requests in a generalized format which can be run to
// upload an artifact to storage managed by the queue.
BlobArtifactRequest struct {
// Optionally provide an encoding type which should be set as the HTTP
// Content-Encoding header for this artifact.
//
// Max length: 255
ContentEncoding string `json:"contentEncoding,omitempty"`
// The number of bytes of the entire artifact. This must be the number
// of bytes in the file to be uploaded. For single part uploads, the
// upload will fail if the number of bytes uploaded does not match this
// value. A single part upload (e.g. no parts list) may be at most 5GB.
// This limit is enforced in the code because it is not possible to
// represent all of the restrictions in a json-schema. A multipart
// upload may be at most 5TB, with each part other than the last being
// between 5MB and 5GB in size.
//
// Mininum: 0
ContentLength int64 `json:"contentLength"`
// The complete SHA256 value of the entire artifact. This must be the
// SHA256 of the file which is to be uploaded. For single part uploads,
// the upload will fail if the SHA256 value of what is uploaded does not
// match this value
//
// Syntax: ^[a-fA-F0-9]{64}$
ContentSha256 string `json:"contentSha256"`
// Artifact mime-type, when uploading artifact to the signed
// `PUT` URL returned from this request this must given with the
// `ContentType` header. Please, provide correct mime-type,
// this make tooling a lot easier, specifically,
// always using `application/json` for JSON artifacts.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which the artifact should be deleted. Note, that
// these will be collected over time, and artifacts may remain
// available after expiration. S3 based artifacts are identified in
// azure table storage and explicitly deleted on S3 after expiration.
Expires tcclient.Time `json:"expires"`
// A list of parts for a multipart upload. The presence of this list is
// how a multipart upload is differentiated from a single part upload.
// The items in this list represent individual parts for upload. For a
// multipart upload, the sha256 values provided here must match the
// sha256 value that S3 internally computes for the upload to be
// considered a success. The overall sha256 value is not checked
// explicitly because the S3 API does not allow for that, but the same
// code that is responsible for generating the parts hashes would also
// be generating the overall hash, which makes this less of a concern.
// The worst case is that we have artifacts which incorrectly do not
// validate, which is not as big of a security concern.
Parts []MultipartPart `json:"parts,omitempty"`
// Artifact storage type, in this case `'blob'`
//
// Possible values:
// * "blob"
StorageType string `json:"storageType"`
// The number of bytes transfered across the wire to the backing
// datastore. If specified, it represents the post-content-encoding
// byte count
//
// Mininum: 0
TransferLength int64 `json:"transferLength,omitempty"`
// This is the sha256 of the bytes transfered across the wire to the
// backing datastore. If specified, it represents the
// post-content-encoding sha256 value
//
// Syntax: ^[a-fA-F0-9]{64}$
TransferSha256 string `json:"transferSha256,omitempty"`
}
// Response to a request for creating a new blob artifact
BlobArtifactResponse struct {
// Date-time after which the signed `requests` no longer work
Expires tcclient.Time `json:"expires"`
// A list of generalized HTTP requests which must be run to upload the
// artifact.
Requests []HTTPRequest `json:"requests"`
// Artifact storage type, in this case `'blob'`
//
// Possible values:
// * "blob"
StorageType string `json:"storageType"`
}
// Request to claim a task for a worker to process.
ClaimWorkRequest struct {
// Number of tasks to attempt to claim.
//
// Default: 1
// Mininum: 1
// Maximum: 32
Tasks int64 `json:"tasks"`
// Identifier for group that worker claiming the task is a part of.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for worker within the given workerGroup
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Response to an attempt to claim tasks for a worker to process.
ClaimWorkResponse struct {
// List of task claims, may be empty if no tasks was claimed, in which case
// the worker should sleep a tiny bit before polling again.
Tasks []TaskClaim `json:"tasks"`
}
// Complete an aritifact
CompleteArtifactRequest struct {
// A list of the etags given by the API of the blob storage provider. This is an opaque
// string value provided by the API.
//
// Array items:
Etags []string `json:"etags"`
}
// Response to a request for the number of pending tasks for a given
// `provisionerId` and `workerType`.
CountPendingTasksResponse struct {
// An approximate number of pending tasks for the given `provisionerId` and
// `workerType`. This is based on Azure Queue Storage metadata API, thus,
// number of reported here may be higher than actual number of pending tasks.
// But there cannot be more pending tasks reported here. Ie. this is an
// **upper-bound** on the number of pending tasks.
//
// Mininum: 0
PendingTasks int64 `json:"pendingTasks"`
// Unique identifier for a provisioner, that can supply specified
// `workerType`
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}$
ProvisionerID string `json:"provisionerId"`
// Unique identifier for a worker-type within a specific provisioner
//
// Syntax: ^[a-z]([-a-z0-9]{0,36}[a-z0-9])?$
WorkerType string `json:"workerType"`
}
// Request the queue to reply `424` (Failed Dependency) with `reason` and
// `message` to any `GET` request for this artifact. This is mainly useful
// as a way for a task to declare that it failed to provide an artifact it
// wanted to upload.
ErrorArtifactRequest struct {
// Date-time after which the queue should stop replying with the error
// and forget about the artifact.
Expires tcclient.Time `json:"expires"`
// Human readable explanation of why the artifact is missing
//
// Max length: 4096
Message string `json:"message"`
// Reason why the artifact doesn't exist.
//
// Possible values:
// * "file-missing-on-worker"
// * "invalid-resource-on-worker"
// * "too-large-file-on-worker"
Reason string `json:"reason"`
// Artifact storage type, in this case `error`
//
// Possible values:
// * "error"
StorageType string `json:"storageType"`
}
// Response to a request for the queue to reply `424` (Failed Dependency)
// with `reason` and `message` to any `GET` request for this artifact.
ErrorArtifactResponse struct {
// Artifact storage type, in this case `error`
//
// Possible values:
// * "error"
StorageType string `json:"storageType"`
}
HTTPRequest struct {
// Headers of request
//
// Map entries:
Headers map[string]string `json:"headers"`
// HTTP 1.1 method of request
//
// Possible values:
// * "GET"
// * "POST"
// * "PUT"
// * "DELETE"
// * "OPTIONS"
// * "HEAD"
// * "PATCH"
Method string `json:"method"`
// URL of request
URL string `json:"url"`
}
// List of artifacts for a given `taskId` and `runId`.
ListArtifactsResponse struct {
// List of artifacts for given `taskId` and `runId`.
Artifacts []Artifact `json:"artifacts"`
// Opaque `continuationToken` to be given as query-string option to get the
// next set of artifacts.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called with `continuationToken` until you get a
// result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
}
// Response from a `listDependentTasks` request.
ListDependentTasksResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of dependent tasks.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listDependentTasks` with
// `continuationToken` until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// Identifier for the task whose dependents are being listed.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskID string `json:"taskId"`
// List of tasks that have `taskId` in the `task.dependencies` property.
Tasks []TaskDefinitionAndStatus `json:"tasks"`
}
ListProvisionersResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of provisioners.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called with `continuationToken` until you get a
// result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
Provisioners []ProvisionerInformation `json:"provisioners"`
}
// Response from a `listTaskGroup` request.
ListTaskGroupResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of tasks in the task-group.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listTaskGroup` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// Identifier for the task-group being listed.
//
// Syntax: ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$
TaskGroupID string `json:"taskGroupId"`
// List of tasks in this task-group.
Tasks []TaskDefinitionAndStatus `json:"tasks"`
}
// Response from a `listWorkerTypes` request.
ListWorkerTypesResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of worker-types in the provisioner.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerTypes` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of worker-types in this provisioner.
WorkerTypes []WorkerType `json:"workerTypes"`
}
// Response from a `listWorkers` request.
ListWorkersResponse struct {
// Opaque `continuationToken` to be given as query-string option to get the
// next set of workers in the worker-type.
// This property is only present if another request is necessary to fetch all
// results. In practice the next request with a `continuationToken` may not
// return additional results, but it can. Thus, you can only be sure to have
// all the results if you've called `listWorkerTypes` with `continuationToken`
// until you get a result without a `continuationToken`.
ContinuationToken string `json:"continuationToken,omitempty"`
// List of workers in this worker-type.
Workers []Worker `json:"workers"`
}
MultipartPart struct {
// The sha256 hash of the part.
//
// Syntax: ^[a-fA-F0-9]{64}$
// Min length: 64
// Max length: 64
Sha256 string `json:"sha256"`
// The number of bytes in this part. Keep in mind for S3 that
// all but the last part must be minimum 5MB and the maximum for
// a single part is 5GB. The overall size may not exceed 5TB
//
// Mininum: 0
Size int64 `json:"size"`
}
// Request a authorization to put and artifact or posting of a URL as an artifact. Note that the `storageType` property is referenced in the response as well.
//
// One of:
// * BlobArtifactRequest
// * S3ArtifactRequest
// * AzureArtifactRequest
// * RedirectArtifactRequest
// * ErrorArtifactRequest
PostArtifactRequest json.RawMessage
// Response to a request for posting an artifact.
// Note that the `storageType` property is referenced in the request as well.
//
// One of:
// * BlobArtifactResponse
// * S3ArtifactResponse
// * AzureArtifactResponse
// * RedirectArtifactResponse
// * ErrorArtifactResponse
PostArtifactResponse json.RawMessage
ProvisionerInformation struct {
// See taskcluster [actions](/docs/reference/platform/taskcluster-queue/docs/actions) documentation.
Actions []Action `json:"actions"`
// Description of the provisioner.
Description string `json:"description"`
// Date and time after which the provisioner created will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires"`
// Date and time where the provisioner was last seen active
LastDateActive tcclient.Time `json:"lastDateActive"`
// Unique identifier for a provisioner, that can supply specified
// `workerType`
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}$
ProvisionerID string `json:"provisionerId"`
// This is the stability of the provisioner. Accepted values:
// * `experimental`
// * `stable`
// * `deprecated`
//
// Possible values:
// * "experimental"
// * "stable"
// * "deprecated"
Stability string `json:"stability"`
}
// Request to update a provisioner.
ProvisionerRequest struct {
// See taskcluster [actions](/docs/reference/platform/taskcluster-queue/docs/actions) documentation.
Actions []Action `json:"actions,omitempty"`
// Description of the provisioner.
Description string `json:"description,omitempty"`
// Date and time after which the provisioner will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires,omitempty"`
// This is the stability of the provisioner. Accepted values:
// * `experimental`
// * `stable`
// * `deprecated`
//
// Possible values:
// * "experimental"
// * "stable"
// * "deprecated"
Stability string `json:"stability,omitempty"`
}
// Response containing information about a provisioner.
ProvisionerResponse struct {
// See taskcluster [actions](/docs/reference/platform/taskcluster-queue/docs/actions) documentation.
Actions []Action `json:"actions"`
// Description of the provisioner.
Description string `json:"description"`
// Date and time after which the provisioner will be automatically
// deleted by the queue.
Expires tcclient.Time `json:"expires"`
// Date of the last time this provisioner was seen active. `lastDateActive` is updated every 6 hours
// but may be off by up-to 6 hours. Nonetheless, `lastDateActive` is a good indicator
// of when the provisioner was last seen active.
LastDateActive tcclient.Time `json:"lastDateActive"`
// Unique identifier for a provisioner, that can supply specified
// `workerType`
//
// Syntax: ^[a-zA-Z0-9-_]{1,38}$
ProvisionerID string `json:"provisionerId"`
// This is the stability of the provisioner. Accepted values:
// * `experimental`
// * `stable`
// * `deprecated`
//
// Possible values:
// * "experimental"
// * "stable"
// * "deprecated"
Stability string `json:"stability"`
}
// Request to update a worker's quarantineUntil property.
QuarantineWorkerRequest struct {
// Quarantining a worker allows the machine to remain alive but not accept jobs.
// Once the quarantineUntil time has elapsed, the worker resumes accepting jobs.
// Note that a quarantine can be lifted by setting `quarantineUntil` to the present time (or
// somewhere in the past).
QuarantineUntil tcclient.Time `json:"quarantineUntil"`
}
// Request the queue to redirect to a URL for a given artifact.
// This allows you to reference artifacts that aren't managed by the queue.
// The queue will still authenticate the request, so depending on the level
// of secrecy required, secret URLs **might** work. Note, this is mainly
// useful for public artifacts, for example temporary files directly
// stored on the worker host and only available there for a specific
// amount of time.
RedirectArtifactRequest struct {
// Artifact mime-type for the resource to which the queue should
// redirect. Please use the same `Content-Type`, consistently using
// the correct mime-type make tooling a lot easier, specifically,
// always using `application/json` for JSON artifacts.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which the queue should no longer redirect to this URL.
// Note, that the queue will and cannot delete the resource your URL
// references, you are responsible for doing that yourself.
Expires tcclient.Time `json:"expires"`
// Artifact storage type, in this case `reference`
//
// Possible values:
// * "reference"
StorageType string `json:"storageType"`
// URL to which the queue should redirect using a `303` (See other)
// redirect.
URL string `json:"url"`
}
// Response to a request for the queue to redirect to a URL for a given
// artifact.
RedirectArtifactResponse struct {
// Artifact storage type, in this case `reference`
//
// Possible values:
// * "reference"
StorageType string `json:"storageType"`
}
// JSON object with information about a run
RunInformation struct {
// Reason for the creation of this run,
// **more reasons may be added in the future**.
//
// Possible values:
// * "scheduled"
// * "retry"
// * "task-retry"
// * "rerun"
// * "exception"
ReasonCreated string `json:"reasonCreated"`
// Reason that run was resolved, this is mainly
// useful for runs resolved as `exception`.
// Note, **more reasons may be added in the future**, also this
// property is only available after the run is resolved. Some of these
// reasons, notably `intermittent-task`, `worker-shutdown`, and
// `claim-expired`, will trigger an automatic retry of the task.
//
// Possible values:
// * "completed"
// * "failed"
// * "deadline-exceeded"
// * "canceled"
// * "superseded"
// * "claim-expired"
// * "worker-shutdown"
// * "malformed-payload"
// * "resource-unavailable"
// * "internal-error"
// * "intermittent-task"
ReasonResolved string `json:"reasonResolved,omitempty"`
// Date-time at which this run was resolved, ie. when the run changed
// state from `running` to either `completed`, `failed` or `exception`.
// This property is only present after the run as been resolved.
Resolved tcclient.Time `json:"resolved,omitempty"`
// Id of this task run, `run-id`s always starts from `0`
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// Date-time at which this run was scheduled, ie. when the run was
// created in state `pending`.
Scheduled tcclient.Time `json:"scheduled"`
// Date-time at which this run was claimed, ie. when the run changed
// state from `pending` to `running`. This property is only present
// after the run has been claimed.
Started tcclient.Time `json:"started,omitempty"`
// State of this run
//
// Possible values:
// * "pending"
// * "running"
// * "completed"
// * "failed"
// * "exception"
State string `json:"state"`
// Time at which the run expires and is resolved as `failed`, if the
// run isn't reclaimed. Note, only present after the run has been
// claimed.
TakenUntil tcclient.Time `json:"takenUntil,omitempty"`
// Identifier for group that worker who executes this run is a part of,
// this identifier is mainly used for efficient routing.
// Note, this property is only present after the run is claimed.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup,omitempty"`
// Identifier for worker evaluating this run within given
// `workerGroup`. Note, this property is only available after the run
// has been claimed.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId,omitempty"`
}
// Request for a signed PUT URL that will allow you to upload an artifact
// to an S3 bucket managed by the queue.
S3ArtifactRequest struct {
// Artifact mime-type, when uploading artifact to the signed
// `PUT` URL returned from this request this must given with the
// `ContentType` header. Please, provide correct mime-type,
// this make tooling a lot easier, specifically,
// always using `application/json` for JSON artifacts.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which the artifact should be deleted. Note, that
// these will be collected over time, and artifacts may remain
// available after expiration. S3 based artifacts are identified in
// azure table storage and explicitly deleted on S3 after expiration.
Expires tcclient.Time `json:"expires"`
// Artifact storage type, in this case `'s3'`
//
// Possible values:
// * "s3"
StorageType string `json:"storageType"`
}
// Response to a request for a signed PUT URL that will allow you to
// upload an artifact to an S3 bucket managed by the queue.
S3ArtifactResponse struct {
// Artifact mime-type, must be specified as header when uploading with
// the signed `putUrl`.
//
// Max length: 255
ContentType string `json:"contentType"`
// Date-time after which the signed `putUrl` no longer works
Expires tcclient.Time `json:"expires"`
// URL to which a `PUT` request can be made to upload the artifact
// requested. Note, the `Content-Length` must be specified correctly,
// and the `ContentType` header must be set the value specified below.
PutURL string `json:"putUrl"`
// Artifact storage type, in this case `'s3'`
//
// Possible values:
// * "s3"
StorageType string `json:"storageType"`
}
TaskClaim struct {
// Temporary credentials granting `task.scopes` and the scope:
// `queue:claim-task:<taskId>/<runId>` which allows the worker to reclaim
// the task, upload artifacts and report task resolution.
//
// The temporary credentials are set to expire after `takenUntil`. They
// won't expire exactly at `takenUntil` but shortly after, hence, requests
// coming close `takenUntil` won't have problems even if there is a little
// clock drift.
//
// Workers should use these credentials when making requests on behalf of
// a task. This includes requests to create artifacts, reclaiming the task
// reporting the task `completed`, `failed` or `exception`.
//
// Note, a new set of temporary credentials is issued when the worker
// reclaims the task.
Credentials TaskCredentials `json:"credentials"`
// `run-id` assigned to this run of the task
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Time at which the run expires and is resolved as `exception`,
// with reason `claim-expired` if the run haven't been reclaimed.
TakenUntil tcclient.Time `json:"takenUntil"`
// Definition of a task that can be scheduled
Task TaskDefinitionResponse `json:"task"`
// Identifier for the worker-group within which this run started.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker executing this run.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Request to claim (or reclaim) a task
TaskClaimRequest struct {
// Identifier for group that worker claiming the task is a part of.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for worker within the given workerGroup
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Response to a successful task claim
TaskClaimResponse struct {
// Temporary credentials granting `task.scopes` and the scope:
// `queue:claim-task:<taskId>/<runId>` which allows the worker to reclaim
// the task, upload artifacts and report task resolution.
//
// The temporary credentials are set to expire after `takenUntil`. They
// won't expire exactly at `takenUntil` but shortly after, hence, requests
// coming close `takenUntil` won't have problems even if there is a little
// clock drift.
//
// Workers should use these credentials when making requests on behalf of
// a task. This includes requests to create artifacts, reclaiming the task
// reporting the task `completed`, `failed` or `exception`.
//
// Note, a new set of temporary credentials is issued when the worker
// reclaims the task.
Credentials TaskCredentials `json:"credentials"`
// `run-id` assigned to this run of the task
//
// Mininum: 0
// Maximum: 1000
RunID int64 `json:"runId"`
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Time at which the run expires and is resolved as `exception`,
// with reason `claim-expired` if the run haven't been reclaimed.
TakenUntil tcclient.Time `json:"takenUntil"`
// Definition of a task that can be scheduled
Task TaskDefinitionResponse `json:"task"`
// Identifier for the worker-group within which this run started.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerGroup string `json:"workerGroup"`
// Identifier for the worker executing this run.
//
// Syntax: ^([a-zA-Z0-9-_]*)$
// Min length: 1
// Max length: 38
WorkerID string `json:"workerId"`
}
// Temporary credentials granting `task.scopes` and the scope:
// `queue:claim-task:<taskId>/<runId>` which allows the worker to reclaim
// the task, upload artifacts and report task resolution.
//
// The temporary credentials are set to expire after `takenUntil`. They
// won't expire exactly at `takenUntil` but shortly after, hence, requests
// coming close `takenUntil` won't have problems even if there is a little
// clock drift.
//
// Workers should use these credentials when making requests on behalf of
// a task. This includes requests to create artifacts, reclaiming the task
// reporting the task `completed`, `failed` or `exception`.
//
// Note, a new set of temporary credentials is issued when the worker
// reclaims the task.
TaskCredentials struct {
// The `accessToken` for the temporary credentials.
//
// Min length: 1
AccessToken string `json:"accessToken"`
// The `certificate` for the temporary credentials, these are required
// for the temporary credentials to work.
//
// Min length: 1
Certificate string `json:"certificate"`
// The `clientId` for the temporary credentials.
//
// Min length: 1
ClientID string `json:"clientId"`
}
// Task Definition and task status structure.
TaskDefinitionAndStatus struct {
// A representation of **task status** as known by the queue
Status TaskStatusStructure `json:"status"`
// Definition of a task that can be scheduled
Task TaskDefinitionResponse `json:"task"`
}
// Definition of a task that can be scheduled
TaskDefinitionRequest struct {
// Creation time of task
Created tcclient.Time `json:"created"`