-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
batch-gen.go
4035 lines (3754 loc) · 169 KB
/
batch-gen.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
// Copyright 2024 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package batch provides access to the Batch API.
//
// For product documentation, see: https://cloud.google.com/batch/
//
// # Library status
//
// These client libraries are officially supported by Google. However, this
// library is considered complete and is in maintenance mode. This means
// that we will address critical bugs and security issues but will not add
// any new features.
//
// When possible, we recommend using our newer
// [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
// that are still actively being worked and iterated on.
//
// # Creating a client
//
// Usage example:
//
// import "google.golang.org/api/batch/v1"
// ...
// ctx := context.Background()
// batchService, err := batch.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for
// authentication. For information on how to create and obtain Application
// Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// # Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API
// keys), use [google.golang.org/api/option.WithAPIKey]:
//
// batchService, err := batch.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
// flow, use [google.golang.org/api/option.WithTokenSource]:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// batchService, err := batch.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See [google.golang.org/api/option.ClientOption] for details on options.
package batch // import "google.golang.org/api/batch/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
internal "google.golang.org/api/internal"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
internaloption "google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
var _ = internal.Version
const apiId = "batch:v1"
const apiName = "batch"
const apiVersion = "v1"
const basePath = "https://batch.googleapis.com/"
const basePathTemplate = "https://batch.UNIVERSE_DOMAIN/"
const mtlsBasePath = "https://batch.mtls.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// See, edit, configure, and delete your Google Cloud data and see the email
// address for your Google Account.
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := internaloption.WithDefaultScopes(
"https://www.googleapis.com/auth/cloud-platform",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
opts = append(opts, internaloption.EnableNewAuthLibrary())
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Projects = NewProjectsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Projects *ProjectsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProjectsService(s *Service) *ProjectsService {
rs := &ProjectsService{s: s}
rs.Locations = NewProjectsLocationsService(s)
return rs
}
type ProjectsService struct {
s *Service
Locations *ProjectsLocationsService
}
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
rs := &ProjectsLocationsService{s: s}
rs.Jobs = NewProjectsLocationsJobsService(s)
rs.Operations = NewProjectsLocationsOperationsService(s)
rs.State = NewProjectsLocationsStateService(s)
return rs
}
type ProjectsLocationsService struct {
s *Service
Jobs *ProjectsLocationsJobsService
Operations *ProjectsLocationsOperationsService
State *ProjectsLocationsStateService
}
func NewProjectsLocationsJobsService(s *Service) *ProjectsLocationsJobsService {
rs := &ProjectsLocationsJobsService{s: s}
rs.TaskGroups = NewProjectsLocationsJobsTaskGroupsService(s)
return rs
}
type ProjectsLocationsJobsService struct {
s *Service
TaskGroups *ProjectsLocationsJobsTaskGroupsService
}
func NewProjectsLocationsJobsTaskGroupsService(s *Service) *ProjectsLocationsJobsTaskGroupsService {
rs := &ProjectsLocationsJobsTaskGroupsService{s: s}
rs.Tasks = NewProjectsLocationsJobsTaskGroupsTasksService(s)
return rs
}
type ProjectsLocationsJobsTaskGroupsService struct {
s *Service
Tasks *ProjectsLocationsJobsTaskGroupsTasksService
}
func NewProjectsLocationsJobsTaskGroupsTasksService(s *Service) *ProjectsLocationsJobsTaskGroupsTasksService {
rs := &ProjectsLocationsJobsTaskGroupsTasksService{s: s}
return rs
}
type ProjectsLocationsJobsTaskGroupsTasksService struct {
s *Service
}
func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
rs := &ProjectsLocationsOperationsService{s: s}
return rs
}
type ProjectsLocationsOperationsService struct {
s *Service
}
func NewProjectsLocationsStateService(s *Service) *ProjectsLocationsStateService {
rs := &ProjectsLocationsStateService{s: s}
return rs
}
type ProjectsLocationsStateService struct {
s *Service
}
// Accelerator: Accelerator describes Compute Engine accelerators to be
// attached to the VM.
type Accelerator struct {
// Count: The number of accelerators of this type.
Count int64 `json:"count,omitempty,string"`
// DriverVersion: Optional. The NVIDIA GPU driver version that should be
// installed for this type. You can define the specific driver version such as
// "470.103.01", following the driver version requirements in
// https://cloud.google.com/compute/docs/gpus/install-drivers-gpu#minimum-driver.
// Batch will install the specific accelerator driver if qualified.
DriverVersion string `json:"driverVersion,omitempty"`
// InstallGpuDrivers: Deprecated: please use instances[0].install_gpu_drivers
// instead.
InstallGpuDrivers bool `json:"installGpuDrivers,omitempty"`
// Type: The accelerator type. For example, "nvidia-tesla-t4". See `gcloud
// compute accelerator-types list`.
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Count") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Count") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *Accelerator) MarshalJSON() ([]byte, error) {
type NoMethod Accelerator
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// ActionCondition: Conditions for actions to deal with task failures.
type ActionCondition struct {
// ExitCodes: Exit codes of a task execution. If there are more than 1 exit
// codes, when task executes with any of the exit code in the list, the
// condition is met and the action will be executed.
ExitCodes []int64 `json:"exitCodes,omitempty"`
// ForceSendFields is a list of field names (e.g. "ExitCodes") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ExitCodes") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *ActionCondition) MarshalJSON() ([]byte, error) {
type NoMethod ActionCondition
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentContainer: Container runnable representation on the agent side.
type AgentContainer struct {
// Commands: Overrides the `CMD` specified in the container. If there is an
// ENTRYPOINT (either in the container image or with the entrypoint field
// below) then commands are appended as arguments to the ENTRYPOINT.
Commands []string `json:"commands,omitempty"`
// Entrypoint: Overrides the `ENTRYPOINT` specified in the container.
Entrypoint string `json:"entrypoint,omitempty"`
// ImageUri: The URI to pull the container image from.
ImageUri string `json:"imageUri,omitempty"`
// Options: Arbitrary additional options to include in the "docker run" command
// when running this container, e.g. "--network host".
Options string `json:"options,omitempty"`
// Volumes: Volumes to mount (bind mount) from the host machine files or
// directories into the container, formatted to match docker run's --volume
// option, e.g. /foo:/bar, or /foo:/bar:ro
Volumes []string `json:"volumes,omitempty"`
// ForceSendFields is a list of field names (e.g. "Commands") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Commands") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentContainer) MarshalJSON() ([]byte, error) {
type NoMethod AgentContainer
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentEnvironment: AgentEnvironment is the Environment representation between
// Agent and CLH communication. The environment is used in both task level and
// agent level.
type AgentEnvironment struct {
// EncryptedVariables: An encrypted JSON dictionary where the key/value pairs
// correspond to environment variable names and their values.
EncryptedVariables *AgentKMSEnvMap `json:"encryptedVariables,omitempty"`
// SecretVariables: A map of environment variable names to Secret Manager
// secret names. The VM will access the named secrets to set the value of each
// environment variable.
SecretVariables map[string]string `json:"secretVariables,omitempty"`
// Variables: A map of environment variable names to values.
Variables map[string]string `json:"variables,omitempty"`
// ForceSendFields is a list of field names (e.g. "EncryptedVariables") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "EncryptedVariables") to include
// in API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentEnvironment) MarshalJSON() ([]byte, error) {
type NoMethod AgentEnvironment
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentInfo: VM Agent Info.
type AgentInfo struct {
// JobId: Optional. The assigned Job ID
JobId string `json:"jobId,omitempty"`
// ReportTime: When the AgentInfo is generated.
ReportTime string `json:"reportTime,omitempty"`
// State: Agent state.
//
// Possible values:
// "AGENT_STATE_UNSPECIFIED" - Unspecified state.
// "AGENT_STARTING" - The agent is starting on the VM instance.
// "AGENT_RUNNING" - The agent is running. The agent in the RUNNING state can
// never go back to the STARTING state.
// "AGENT_STOPPED" - The agent has stopped, either on request or due to a
// failure.
State string `json:"state,omitempty"`
// TaskGroupId: The assigned task group ID.
TaskGroupId string `json:"taskGroupId,omitempty"`
// Tasks: Task Info.
Tasks []*AgentTaskInfo `json:"tasks,omitempty"`
// ForceSendFields is a list of field names (e.g. "JobId") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "JobId") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentInfo) MarshalJSON() ([]byte, error) {
type NoMethod AgentInfo
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentKMSEnvMap: AgentKMSEnvMap contains the encrypted key/value pair to be
// used in the environment on the Agent side.
type AgentKMSEnvMap struct {
// CipherText: The value of the cipherText response from the `encrypt` method.
CipherText string `json:"cipherText,omitempty"`
// KeyName: The name of the KMS key that will be used to decrypt the cipher
// text.
KeyName string `json:"keyName,omitempty"`
// ForceSendFields is a list of field names (e.g. "CipherText") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CipherText") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentKMSEnvMap) MarshalJSON() ([]byte, error) {
type NoMethod AgentKMSEnvMap
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentMetadata: VM Agent Metadata.
type AgentMetadata struct {
// CreationTime: When the VM agent started. Use agent_startup_time instead.
CreationTime string `json:"creationTime,omitempty"`
// Creator: Full name of the entity that created this vm. For MIG, this path
// is: projects/{project}/regions/{region}/InstanceGroupManagers/{igm} The
// value is retrieved from the vm metadata key of "created-by".
Creator string `json:"creator,omitempty"`
// ImageVersion: image version for the VM that this agent is installed on.
ImageVersion string `json:"imageVersion,omitempty"`
// Instance: GCP instance name (go/instance-name).
Instance string `json:"instance,omitempty"`
// InstanceId: GCP instance ID (go/instance-id).
InstanceId uint64 `json:"instanceId,omitempty,string"`
// InstancePreemptionNoticeReceived: If the GCP instance has received
// preemption notice.
InstancePreemptionNoticeReceived bool `json:"instancePreemptionNoticeReceived,omitempty"`
// OsRelease: parsed contents of /etc/os-release
OsRelease map[string]string `json:"osRelease,omitempty"`
// Version: agent binary version running on VM
Version string `json:"version,omitempty"`
// Zone: Agent zone.
Zone string `json:"zone,omitempty"`
// ForceSendFields is a list of field names (e.g. "CreationTime") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CreationTime") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentMetadata) MarshalJSON() ([]byte, error) {
type NoMethod AgentMetadata
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentScript: Script runnable representation on the agent side.
type AgentScript struct {
// Path: Script file path on the host VM. To specify an interpreter, please add
// a `#!`(also known as shebang line
// (https://en.wikipedia.org/wiki/Shebang_(Unix))) as the first line of the
// file.(For example, to execute the script using bash, `#!/bin/bash` should be
// the first line of the file. To execute the script using`Python3`,
// `#!/usr/bin/env python3` should be the first line of the file.) Otherwise,
// the file will by default be executed by `/bin/sh`.
Path string `json:"path,omitempty"`
// Text: Shell script text. To specify an interpreter, please add a `#!\n` at
// the beginning of the text.(For example, to execute the script using bash,
// `#!/bin/bash\n` should be added. To execute the script using`Python3`,
// `#!/usr/bin/env python3\n` should be added.) Otherwise, the script will by
// default be executed by `/bin/sh`.
Text string `json:"text,omitempty"`
// ForceSendFields is a list of field names (e.g. "Path") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Path") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentScript) MarshalJSON() ([]byte, error) {
type NoMethod AgentScript
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTask: TODO(b/182501497) The message needs to be redefined when the
// Agent API server updates data in storage per the backend design.
type AgentTask struct {
// AgentTaskSpec: AgentTaskSpec is the taskSpec representation between Agent
// and CLH communication. This field will replace the TaskSpec field above in
// future to have a better separation between user-facaing API and internal
// API.
AgentTaskSpec *AgentTaskSpec `json:"agentTaskSpec,omitempty"`
// IntendedState: The intended state of the task.
//
// Possible values:
// "INTENDED_STATE_UNSPECIFIED" - Unspecified state.
// "ASSIGNED" - Assigned state (includes running and finished).
// "CANCELLED" - The agent should cancel the execution of this task.
// "DELETED" - Delete task from agent storage, stop reporting its state.
IntendedState string `json:"intendedState,omitempty"`
// ReachedBarrier: The highest barrier reached by all tasks in the task's
// TaskGroup.
ReachedBarrier int64 `json:"reachedBarrier,omitempty,string"`
// Spec: Task Spec. This field will be replaced by agent_task_spec below in
// future.
Spec *TaskSpec `json:"spec,omitempty"`
// Status: Task status.
Status *TaskStatus `json:"status,omitempty"`
// Task: Task name.
Task string `json:"task,omitempty"`
// TaskSource: TaskSource represents the source of the task.
//
// Possible values:
// "TASK_SOURCE_UNSPECIFIED" - Unspecified task source.
// "BATCH_INTERNAL" - The AgentTask from this source is generated by Batch
// server. E.g. all the VMActions are from this source. When Batch Agent
// execute AgentTask from BATCH_INTERNAL, it will log stdout/err with
// "batch_agent_logs" log name.
// "USER" - The AgentTask from this source is provided by Batch users. When
// Batch Agent execute AgentTask from USER, it will log stdout/err with
// "batch_task_logs" log name.
TaskSource string `json:"taskSource,omitempty"`
// ForceSendFields is a list of field names (e.g. "AgentTaskSpec") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AgentTaskSpec") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTask) MarshalJSON() ([]byte, error) {
type NoMethod AgentTask
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTaskInfo: Task Info
type AgentTaskInfo struct {
// Runnable: The highest index of a runnable started by the agent for this
// task. The runnables are indexed from 1. Value 0 is undefined.
Runnable int64 `json:"runnable,omitempty,string"`
// TaskId: ID of the Task
TaskId string `json:"taskId,omitempty"`
// TaskStatus: The status of the Task. If we need agent specific fields we
// should fork the public TaskStatus into an agent specific one. Or add them
// below.
TaskStatus *TaskStatus `json:"taskStatus,omitempty"`
// ForceSendFields is a list of field names (e.g. "Runnable") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Runnable") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTaskInfo) MarshalJSON() ([]byte, error) {
type NoMethod AgentTaskInfo
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTaskRunnable: AgentTaskRunnable is the Runnable representation between
// Agent and CLH communication.
type AgentTaskRunnable struct {
// AlwaysRun: By default, after a Runnable fails, no further Runnable are
// executed. This flag indicates that this Runnable must be run even if the
// Task has already failed. This is useful for Runnables that copy output files
// off of the VM or for debugging. The always_run flag does not override the
// Task's overall max_run_duration. If the max_run_duration has expired then no
// further Runnables will execute, not even always_run Runnables.
AlwaysRun bool `json:"alwaysRun,omitempty"`
// Background: This flag allows a Runnable to continue running in the
// background while the Task executes subsequent Runnables. This is useful to
// provide services to other Runnables (or to provide debugging support tools
// like SSH servers).
Background bool `json:"background,omitempty"`
// Container: Container runnable.
Container *AgentContainer `json:"container,omitempty"`
// Environment: Environment variables for this Runnable (overrides variables
// set for the whole Task or TaskGroup).
Environment *AgentEnvironment `json:"environment,omitempty"`
// IgnoreExitStatus: Normally, a non-zero exit status causes the Task to fail.
// This flag allows execution of other Runnables to continue instead.
IgnoreExitStatus bool `json:"ignoreExitStatus,omitempty"`
// Script: Script runnable.
Script *AgentScript `json:"script,omitempty"`
// Timeout: Timeout for this Runnable.
Timeout string `json:"timeout,omitempty"`
// ForceSendFields is a list of field names (e.g. "AlwaysRun") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AlwaysRun") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTaskRunnable) MarshalJSON() ([]byte, error) {
type NoMethod AgentTaskRunnable
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTaskSpec: AgentTaskSpec is the user's TaskSpec representation between
// Agent and CLH communication.
type AgentTaskSpec struct {
// Environment: Environment variables to set before running the Task.
Environment *AgentEnvironment `json:"environment,omitempty"`
// MaxRunDuration: Maximum duration the task should run. The task will be
// killed and marked as FAILED if over this limit. The valid value range for
// max_run_duration in seconds is [0, 315576000000.999999999],
MaxRunDuration string `json:"maxRunDuration,omitempty"`
// Runnables: AgentTaskRunnable is runanbles that will be executed on the
// agent.
Runnables []*AgentTaskRunnable `json:"runnables,omitempty"`
// UserAccount: User account on the VM to run the runnables in the
// agentTaskSpec. If not set, the runnable will be run under root user.
UserAccount *AgentTaskUserAccount `json:"userAccount,omitempty"`
// ForceSendFields is a list of field names (e.g. "Environment") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Environment") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTaskSpec) MarshalJSON() ([]byte, error) {
type NoMethod AgentTaskSpec
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTaskUserAccount: AgentTaskUserAccount contains the information of a
// POSIX account on the guest os which is used to execute the runnables.
type AgentTaskUserAccount struct {
// Gid: gid id an unique identifier of the POSIX account group corresponding to
// the user account.
Gid int64 `json:"gid,omitempty,string"`
// Uid: uid is an unique identifier of the POSIX account corresponding to the
// user account.
Uid int64 `json:"uid,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "Gid") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Gid") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTaskUserAccount) MarshalJSON() ([]byte, error) {
type NoMethod AgentTaskUserAccount
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AgentTimingInfo: VM timing information
type AgentTimingInfo struct {
// AgentStartupTime: Agent startup time
AgentStartupTime string `json:"agentStartupTime,omitempty"`
// BootTime: Boot timestamp of the VM OS
BootTime string `json:"bootTime,omitempty"`
// ScriptStartupTime: Startup time of the Batch VM script.
ScriptStartupTime string `json:"scriptStartupTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "AgentStartupTime") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AgentStartupTime") to include in
// API requests with the JSON null value. By default, fields with empty values
// are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AgentTimingInfo) MarshalJSON() ([]byte, error) {
type NoMethod AgentTimingInfo
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AllocationPolicy: A Job's resource allocation policy describes when, where,
// and how compute resources should be allocated for the Job.
type AllocationPolicy struct {
// Instances: Describe instances that can be created by this AllocationPolicy.
// Only instances[0] is supported now.
Instances []*InstancePolicyOrTemplate `json:"instances,omitempty"`
// Labels: Labels applied to all VM instances and other resources created by
// AllocationPolicy. Labels could be user provided or system generated. You can
// assign up to 64 labels. Google Compute Engine label restrictions
// (https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// apply. Label names that start with "goog-" or "google-" are reserved.
Labels map[string]string `json:"labels,omitempty"`
// Location: Location where compute resources should be allocated for the Job.
Location *LocationPolicy `json:"location,omitempty"`
// Network: The network policy. If you define an instance template in the
// `InstancePolicyOrTemplate` field, Batch will use the network settings in the
// instance template instead of this field.
Network *NetworkPolicy `json:"network,omitempty"`
// Placement: The placement policy.
Placement *PlacementPolicy `json:"placement,omitempty"`
// ServiceAccount: Defines the service account for Batch-created VMs. If
// omitted, the default Compute Engine service account
// (https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
// is used. Must match the service account specified in any used instance
// template configured in the Batch job. Includes the following fields: *
// email: The service account's email address. If not set, the default Compute
// Engine service account is used. * scopes: Additional OAuth scopes to grant
// the service account, beyond the default cloud-platform scope. (list of
// strings)
ServiceAccount *ServiceAccount `json:"serviceAccount,omitempty"`
// Tags: Optional. Tags applied to the VM instances. The tags identify valid
// sources or targets for network firewalls. Each tag must be 1-63 characters
// long, and comply with RFC1035 (https://www.ietf.org/rfc/rfc1035.txt).
Tags []string `json:"tags,omitempty"`
// ForceSendFields is a list of field names (e.g. "Instances") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Instances") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AllocationPolicy) MarshalJSON() ([]byte, error) {
type NoMethod AllocationPolicy
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// AttachedDisk: A new or an existing persistent disk (PD) or a local ssd
// attached to a VM instance.
type AttachedDisk struct {
// DeviceName: Device name that the guest operating system will see. It is used
// by Runnable.volumes field to mount disks. So please specify the device_name
// if you want Batch to help mount the disk, and it should match the
// device_name field in volumes.
DeviceName string `json:"deviceName,omitempty"`
// ExistingDisk: Name of an existing PD.
ExistingDisk string `json:"existingDisk,omitempty"`
NewDisk *Disk `json:"newDisk,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeviceName") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DeviceName") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *AttachedDisk) MarshalJSON() ([]byte, error) {
type NoMethod AttachedDisk
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// Barrier: Barrier runnable blocks until all tasks in a taskgroup reach it.
type Barrier struct {
// Name: Barriers are identified by their index in runnable list. Names are not
// required, but if present should be an identifier.
Name string `json:"name,omitempty"`
// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
// include in API requests. By default, fields with empty or default values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Name") to include in API requests
// with the JSON null value. By default, fields with empty values are omitted
// from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *Barrier) MarshalJSON() ([]byte, error) {
type NoMethod Barrier
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// CancelOperationRequest: The request message for Operations.CancelOperation.
type CancelOperationRequest struct {
}
// CloudLoggingOption: `CloudLoggingOption` contains additional settings for
// Cloud Logging logs generated by Batch job.
type CloudLoggingOption struct {
// UseGenericTaskMonitoredResource: Optional. Set this flag to true to change
// the monitored resource type
// (https://cloud.google.com/monitoring/api/resources) for Cloud Logging logs
// generated by this Batch job from the `batch.googleapis.com/Job`
// (https://cloud.google.com/monitoring/api/resources#tag_batch.googleapis.com/Job)
// type to the formerly used `generic_task`
// (https://cloud.google.com/monitoring/api/resources#tag_generic_task) type.
UseGenericTaskMonitoredResource bool `json:"useGenericTaskMonitoredResource,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "UseGenericTaskMonitoredResource") to unconditionally include in API
// requests. By default, fields with empty or default values are omitted from
// API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "UseGenericTaskMonitoredResource")
// to include in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *CloudLoggingOption) MarshalJSON() ([]byte, error) {
type NoMethod CloudLoggingOption
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// ComputeResource: Compute resource requirements. ComputeResource defines the
// amount of resources required for each task. Make sure your tasks have enough
// resources to successfully run. If you also define the types of resources for
// a job to use with the InstancePolicyOrTemplate
// (https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate)
// field, make sure both fields are compatible with each other.
type ComputeResource struct {
// BootDiskMib: Extra boot disk size in MiB for each task.
BootDiskMib int64 `json:"bootDiskMib,omitempty,string"`
// CpuMilli: The milliCPU count. `cpuMilli` defines the amount of CPU resources
// per task in milliCPU units. For example, `1000` corresponds to 1 vCPU per
// task. If undefined, the default value is `2000`. If you also define the VM's
// machine type using the `machineType` in InstancePolicy
// (https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy)
// field or inside the `instanceTemplate` in the InstancePolicyOrTemplate
// (https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate)
// field, make sure the CPU resources for both fields are compatible with each
// other and with how many tasks you want to allow to run on the same VM at the
// same time. For example, if you specify the `n2-standard-2` machine type,
// which has 2 vCPUs each, you are recommended to set `cpuMilli` no more than
// `2000`, or you are recommended to run two tasks on the same VM if you set
// `cpuMilli` to `1000` or less.
CpuMilli int64 `json:"cpuMilli,omitempty,string"`
// MemoryMib: Memory in MiB. `memoryMib` defines the amount of memory per task
// in MiB units. If undefined, the default value is `2000`. If you also define
// the VM's machine type using the `machineType` in InstancePolicy
// (https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy)
// field or inside the `instanceTemplate` in the InstancePolicyOrTemplate
// (https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate)
// field, make sure the memory resources for both fields are compatible with
// each other and with how many tasks you want to allow to run on the same VM
// at the same time. For example, if you specify the `n2-standard-2` machine
// type, which has 8 GiB each, you are recommended to set `memoryMib` to no
// more than `8192`, or you are recommended to run two tasks on the same VM if
// you set `memoryMib` to `4096` or less.
MemoryMib int64 `json:"memoryMib,omitempty,string"`
// ForceSendFields is a list of field names (e.g. "BootDiskMib") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BootDiskMib") to include in API
// requests with the JSON null value. By default, fields with empty values are
// omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *ComputeResource) MarshalJSON() ([]byte, error) {
type NoMethod ComputeResource
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// Container: Container runnable.
type Container struct {
// BlockExternalNetwork: If set to true, external network access to and from
// container will be blocked, containers that are with block_external_network
// as true can still communicate with each other, network cannot be specified
// in the `container.options` field.
BlockExternalNetwork bool `json:"blockExternalNetwork,omitempty"`
// Commands: Overrides the `CMD` specified in the container. If there is an
// ENTRYPOINT (either in the container image or with the entrypoint field
// below) then commands are appended as arguments to the ENTRYPOINT.
Commands []string `json:"commands,omitempty"`
// EnableImageStreaming: Optional. If set to true, this container runnable uses
// Image streaming. Use Image streaming to allow the runnable to initialize
// without waiting for the entire container image to download, which can
// significantly reduce startup time for large container images. When
// `enableImageStreaming` is set to true, the container runtime is containerd
// (https://containerd.io/) instead of Docker. Additionally, this container
// runnable only supports the following `container` subfields: `imageUri`,
// `commands[]`, `entrypoint`, and `volumes[]`; any other `container` subfields
// are ignored. For more information about the requirements and limitations for
// using Image streaming with Batch, see the `image-streaming` sample on GitHub
// (https://github.com/GoogleCloudPlatform/batch-samples/tree/main/api-samples/image-streaming).
EnableImageStreaming bool `json:"enableImageStreaming,omitempty"`
// Entrypoint: Overrides the `ENTRYPOINT` specified in the container.
Entrypoint string `json:"entrypoint,omitempty"`
// ImageUri: The URI to pull the container image from.
ImageUri string `json:"imageUri,omitempty"`
// Options: Arbitrary additional options to include in the "docker run" command
// when running this container, e.g. "--network host".
Options string `json:"options,omitempty"`
// Password: Required if the container image is from a private Docker registry.
// The password to login to the Docker registry that contains the image. For
// security, it is strongly recommended to specify an encrypted password by
// using a Secret Manager secret: `projects/*/secrets/*/versions/*`. Warning:
// If you specify the password using plain text, you risk the password being
// exposed to any users who can view the job or its logs. To avoid this risk,
// specify a secret that contains the password instead. Learn more about Secret
// Manager (https://cloud.google.com/secret-manager/docs/) and using Secret
// Manager with Batch
// (https://cloud.google.com/batch/docs/create-run-job-secret-manager).
Password string `json:"password,omitempty"`
// Username: Required if the container image is from a private Docker registry.
// The username to login to the Docker registry that contains the image. You
// can either specify the username directly by using plain text or specify an
// encrypted username by using a Secret Manager secret:
// `projects/*/secrets/*/versions/*`. However, using a secret is recommended
// for enhanced security. Caution: If you specify the username using plain
// text, you risk the username being exposed to any users who can view the job
// or its logs. To avoid this risk, specify a secret that contains the username
// instead. Learn more about Secret Manager
// (https://cloud.google.com/secret-manager/docs/) and using Secret Manager
// with Batch
// (https://cloud.google.com/batch/docs/create-run-job-secret-manager).
Username string `json:"username,omitempty"`
// Volumes: Volumes to mount (bind mount) from the host machine files or
// directories into the container, formatted to match docker run's --volume
// option, e.g. /foo:/bar, or /foo:/bar:ro If the `TaskSpec.Volumes` field is
// specified but this field is not, Batch will mount each volume from the host
// machine to the container with the same mount path by default. In this case,
// the default mount option for containers will be read-only (ro) for existing
// persistent disks and read-write (rw) for other volume types, regardless of
// the original mount options specified in `TaskSpec.Volumes`. If you need
// different mount settings, you can explicitly configure them in this field.
Volumes []string `json:"volumes,omitempty"`
// ForceSendFields is a list of field names (e.g. "BlockExternalNetwork") to
// unconditionally include in API requests. By default, fields with empty or
// default values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
// details.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BlockExternalNetwork") to include
// in API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. See
// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
NullFields []string `json:"-"`
}
func (s *Container) MarshalJSON() ([]byte, error) {
type NoMethod Container
return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
}
// Disk: A new persistent disk or a local ssd. A VM can only have one local SSD
// setting but multiple local SSD partitions. See
// https://cloud.google.com/compute/docs/disks#pdspecs and
// https://cloud.google.com/compute/docs/disks#localssds.
type Disk struct {
// DiskInterface: Local SSDs are available through both "SCSI" and "NVMe"
// interfaces. If not indicated, "NVMe" will be the default one for local ssds.
// This field is ignored for persistent disks as the interface is chosen
// automatically. See