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 package tpu
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "tpu:v1alpha1"
90 const apiName = "tpu"
91 const apiVersion = "v1alpha1"
92 const basePath = "https://tpu.googleapis.com/"
93 const basePathTemplate = "https://tpu.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://tpu.mtls.googleapis.com/"
95
96
97 const (
98
99
100 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
101 )
102
103
104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
105 scopesOption := internaloption.WithDefaultScopes(
106 "https://www.googleapis.com/auth/cloud-platform",
107 )
108
109 opts = append([]option.ClientOption{scopesOption}, opts...)
110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
113 opts = append(opts, internaloption.EnableNewAuthLibrary())
114 client, endpoint, err := htransport.NewClient(ctx, opts...)
115 if err != nil {
116 return nil, err
117 }
118 s, err := New(client)
119 if err != nil {
120 return nil, err
121 }
122 if endpoint != "" {
123 s.BasePath = endpoint
124 }
125 return s, nil
126 }
127
128
129
130
131
132
133 func New(client *http.Client) (*Service, error) {
134 if client == nil {
135 return nil, errors.New("client is nil")
136 }
137 s := &Service{client: client, BasePath: basePath}
138 s.Projects = NewProjectsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 Projects *ProjectsService
148 }
149
150 func (s *Service) userAgent() string {
151 if s.UserAgent == "" {
152 return googleapi.UserAgent
153 }
154 return googleapi.UserAgent + " " + s.UserAgent
155 }
156
157 func NewProjectsService(s *Service) *ProjectsService {
158 rs := &ProjectsService{s: s}
159 rs.Locations = NewProjectsLocationsService(s)
160 return rs
161 }
162
163 type ProjectsService struct {
164 s *Service
165
166 Locations *ProjectsLocationsService
167 }
168
169 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
170 rs := &ProjectsLocationsService{s: s}
171 rs.AcceleratorTypes = NewProjectsLocationsAcceleratorTypesService(s)
172 rs.Nodes = NewProjectsLocationsNodesService(s)
173 rs.Operations = NewProjectsLocationsOperationsService(s)
174 rs.TensorflowVersions = NewProjectsLocationsTensorflowVersionsService(s)
175 return rs
176 }
177
178 type ProjectsLocationsService struct {
179 s *Service
180
181 AcceleratorTypes *ProjectsLocationsAcceleratorTypesService
182
183 Nodes *ProjectsLocationsNodesService
184
185 Operations *ProjectsLocationsOperationsService
186
187 TensorflowVersions *ProjectsLocationsTensorflowVersionsService
188 }
189
190 func NewProjectsLocationsAcceleratorTypesService(s *Service) *ProjectsLocationsAcceleratorTypesService {
191 rs := &ProjectsLocationsAcceleratorTypesService{s: s}
192 return rs
193 }
194
195 type ProjectsLocationsAcceleratorTypesService struct {
196 s *Service
197 }
198
199 func NewProjectsLocationsNodesService(s *Service) *ProjectsLocationsNodesService {
200 rs := &ProjectsLocationsNodesService{s: s}
201 return rs
202 }
203
204 type ProjectsLocationsNodesService struct {
205 s *Service
206 }
207
208 func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
209 rs := &ProjectsLocationsOperationsService{s: s}
210 return rs
211 }
212
213 type ProjectsLocationsOperationsService struct {
214 s *Service
215 }
216
217 func NewProjectsLocationsTensorflowVersionsService(s *Service) *ProjectsLocationsTensorflowVersionsService {
218 rs := &ProjectsLocationsTensorflowVersionsService{s: s}
219 return rs
220 }
221
222 type ProjectsLocationsTensorflowVersionsService struct {
223 s *Service
224 }
225
226
227 type AcceleratorType struct {
228
229 Name string `json:"name,omitempty"`
230
231 Type string `json:"type,omitempty"`
232
233
234 googleapi.ServerResponse `json:"-"`
235
236
237
238
239
240 ForceSendFields []string `json:"-"`
241
242
243
244
245 NullFields []string `json:"-"`
246 }
247
248 func (s *AcceleratorType) MarshalJSON() ([]byte, error) {
249 type NoMethod AcceleratorType
250 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
251 }
252
253
254
255
256
257 type Empty struct {
258
259 googleapi.ServerResponse `json:"-"`
260 }
261
262
263 type ListAcceleratorTypesResponse struct {
264
265 AcceleratorTypes []*AcceleratorType `json:"acceleratorTypes,omitempty"`
266
267 NextPageToken string `json:"nextPageToken,omitempty"`
268
269 Unreachable []string `json:"unreachable,omitempty"`
270
271
272 googleapi.ServerResponse `json:"-"`
273
274
275
276
277
278 ForceSendFields []string `json:"-"`
279
280
281
282
283 NullFields []string `json:"-"`
284 }
285
286 func (s *ListAcceleratorTypesResponse) MarshalJSON() ([]byte, error) {
287 type NoMethod ListAcceleratorTypesResponse
288 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
289 }
290
291
292 type ListLocationsResponse struct {
293
294
295 Locations []*Location `json:"locations,omitempty"`
296
297 NextPageToken string `json:"nextPageToken,omitempty"`
298
299
300 googleapi.ServerResponse `json:"-"`
301
302
303
304
305
306 ForceSendFields []string `json:"-"`
307
308
309
310
311 NullFields []string `json:"-"`
312 }
313
314 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
315 type NoMethod ListLocationsResponse
316 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
317 }
318
319
320 type ListNodesResponse struct {
321
322 NextPageToken string `json:"nextPageToken,omitempty"`
323
324 Nodes []*Node `json:"nodes,omitempty"`
325
326 Unreachable []string `json:"unreachable,omitempty"`
327
328
329 googleapi.ServerResponse `json:"-"`
330
331
332
333
334
335 ForceSendFields []string `json:"-"`
336
337
338
339
340 NullFields []string `json:"-"`
341 }
342
343 func (s *ListNodesResponse) MarshalJSON() ([]byte, error) {
344 type NoMethod ListNodesResponse
345 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
346 }
347
348
349 type ListOperationsResponse struct {
350
351 NextPageToken string `json:"nextPageToken,omitempty"`
352
353
354 Operations []*Operation `json:"operations,omitempty"`
355
356
357 googleapi.ServerResponse `json:"-"`
358
359
360
361
362
363 ForceSendFields []string `json:"-"`
364
365
366
367
368 NullFields []string `json:"-"`
369 }
370
371 func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
372 type NoMethod ListOperationsResponse
373 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
374 }
375
376
377 type ListTensorFlowVersionsResponse struct {
378
379 NextPageToken string `json:"nextPageToken,omitempty"`
380
381 TensorflowVersions []*TensorFlowVersion `json:"tensorflowVersions,omitempty"`
382
383 Unreachable []string `json:"unreachable,omitempty"`
384
385
386 googleapi.ServerResponse `json:"-"`
387
388
389
390
391
392 ForceSendFields []string `json:"-"`
393
394
395
396
397 NullFields []string `json:"-"`
398 }
399
400 func (s *ListTensorFlowVersionsResponse) MarshalJSON() ([]byte, error) {
401 type NoMethod ListTensorFlowVersionsResponse
402 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
403 }
404
405
406 type Location struct {
407
408
409 DisplayName string `json:"displayName,omitempty"`
410
411
412 Labels map[string]string `json:"labels,omitempty"`
413
414 LocationId string `json:"locationId,omitempty"`
415
416
417 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
418
419
420
421 Name string `json:"name,omitempty"`
422
423
424 googleapi.ServerResponse `json:"-"`
425
426
427
428
429
430 ForceSendFields []string `json:"-"`
431
432
433
434
435 NullFields []string `json:"-"`
436 }
437
438 func (s *Location) MarshalJSON() ([]byte, error) {
439 type NoMethod Location
440 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
441 }
442
443
444 type NetworkEndpoint struct {
445
446 IpAddress string `json:"ipAddress,omitempty"`
447
448 Port int64 `json:"port,omitempty"`
449
450
451
452
453
454 ForceSendFields []string `json:"-"`
455
456
457
458
459 NullFields []string `json:"-"`
460 }
461
462 func (s *NetworkEndpoint) MarshalJSON() ([]byte, error) {
463 type NoMethod NetworkEndpoint
464 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
465 }
466
467
468 type Node struct {
469
470
471 AcceleratorType string `json:"acceleratorType,omitempty"`
472
473
474
475
476
477
478
479 ApiVersion string `json:"apiVersion,omitempty"`
480
481
482
483
484
485
486
487
488 CidrBlock string `json:"cidrBlock,omitempty"`
489
490 CreateTime string `json:"createTime,omitempty"`
491
492
493 Description string `json:"description,omitempty"`
494
495
496
497
498
499
500
501
502
503
504
505 Health string `json:"health,omitempty"`
506
507
508 HealthDescription string `json:"healthDescription,omitempty"`
509
510
511 IpAddress string `json:"ipAddress,omitempty"`
512
513 Labels map[string]string `json:"labels,omitempty"`
514
515 Name string `json:"name,omitempty"`
516
517
518
519 Network string `json:"network,omitempty"`
520
521
522
523 NetworkEndpoints []*NetworkEndpoint `json:"networkEndpoints,omitempty"`
524
525
526 Port string `json:"port,omitempty"`
527
528 SchedulingConfig *SchedulingConfig `json:"schedulingConfig,omitempty"`
529
530
531
532
533 ServiceAccount string `json:"serviceAccount,omitempty"`
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555 State string `json:"state,omitempty"`
556
557 Symptoms []*Symptom `json:"symptoms,omitempty"`
558
559 TensorflowVersion string `json:"tensorflowVersion,omitempty"`
560
561
562
563
564
565 UseServiceNetworking bool `json:"useServiceNetworking,omitempty"`
566
567
568 googleapi.ServerResponse `json:"-"`
569
570
571
572
573
574 ForceSendFields []string `json:"-"`
575
576
577
578
579 NullFields []string `json:"-"`
580 }
581
582 func (s *Node) MarshalJSON() ([]byte, error) {
583 type NoMethod Node
584 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
585 }
586
587
588
589 type Operation struct {
590
591
592
593 Done bool `json:"done,omitempty"`
594
595 Error *Status `json:"error,omitempty"`
596
597
598
599
600 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
601
602
603
604 Name string `json:"name,omitempty"`
605
606
607
608
609
610
611
612 Response googleapi.RawMessage `json:"response,omitempty"`
613
614
615 googleapi.ServerResponse `json:"-"`
616
617
618
619
620
621 ForceSendFields []string `json:"-"`
622
623
624
625
626 NullFields []string `json:"-"`
627 }
628
629 func (s *Operation) MarshalJSON() ([]byte, error) {
630 type NoMethod Operation
631 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
632 }
633
634
635 type OperationMetadata struct {
636
637 ApiVersion string `json:"apiVersion,omitempty"`
638
639 CancelRequested bool `json:"cancelRequested,omitempty"`
640
641 CreateTime string `json:"createTime,omitempty"`
642
643 EndTime string `json:"endTime,omitempty"`
644
645 StatusDetail string `json:"statusDetail,omitempty"`
646
647
648 Target string `json:"target,omitempty"`
649
650 Verb string `json:"verb,omitempty"`
651
652
653
654
655
656 ForceSendFields []string `json:"-"`
657
658
659
660
661 NullFields []string `json:"-"`
662 }
663
664 func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
665 type NoMethod OperationMetadata
666 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
667 }
668
669
670 type ReimageNodeRequest struct {
671
672 TensorflowVersion string `json:"tensorflowVersion,omitempty"`
673
674
675
676
677
678 ForceSendFields []string `json:"-"`
679
680
681
682
683 NullFields []string `json:"-"`
684 }
685
686 func (s *ReimageNodeRequest) MarshalJSON() ([]byte, error) {
687 type NoMethod ReimageNodeRequest
688 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
689 }
690
691
692 type SchedulingConfig struct {
693
694 Preemptible bool `json:"preemptible,omitempty"`
695
696 Reserved bool `json:"reserved,omitempty"`
697
698
699
700
701
702 ForceSendFields []string `json:"-"`
703
704
705
706
707 NullFields []string `json:"-"`
708 }
709
710 func (s *SchedulingConfig) MarshalJSON() ([]byte, error) {
711 type NoMethod SchedulingConfig
712 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
713 }
714
715
716 type StartNodeRequest struct {
717 }
718
719
720
721
722
723
724
725 type Status struct {
726
727 Code int64 `json:"code,omitempty"`
728
729
730 Details []googleapi.RawMessage `json:"details,omitempty"`
731
732
733
734 Message string `json:"message,omitempty"`
735
736
737
738
739
740 ForceSendFields []string `json:"-"`
741
742
743
744
745 NullFields []string `json:"-"`
746 }
747
748 func (s *Status) MarshalJSON() ([]byte, error) {
749 type NoMethod Status
750 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
751 }
752
753
754 type StopNodeRequest struct {
755 }
756
757
758 type Symptom struct {
759
760 CreateTime string `json:"createTime,omitempty"`
761
762 Details string `json:"details,omitempty"`
763
764
765
766
767
768
769
770
771
772
773
774
775 SymptomType string `json:"symptomType,omitempty"`
776
777 WorkerId string `json:"workerId,omitempty"`
778
779
780
781
782
783 ForceSendFields []string `json:"-"`
784
785
786
787
788 NullFields []string `json:"-"`
789 }
790
791 func (s *Symptom) MarshalJSON() ([]byte, error) {
792 type NoMethod Symptom
793 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
794 }
795
796
797 type TensorFlowVersion struct {
798
799 Name string `json:"name,omitempty"`
800
801 Version string `json:"version,omitempty"`
802
803
804 googleapi.ServerResponse `json:"-"`
805
806
807
808
809
810 ForceSendFields []string `json:"-"`
811
812
813
814
815 NullFields []string `json:"-"`
816 }
817
818 func (s *TensorFlowVersion) MarshalJSON() ([]byte, error) {
819 type NoMethod TensorFlowVersion
820 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
821 }
822
823 type ProjectsLocationsGetCall struct {
824 s *Service
825 name string
826 urlParams_ gensupport.URLParams
827 ifNoneMatch_ string
828 ctx_ context.Context
829 header_ http.Header
830 }
831
832
833
834
835 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
836 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
837 c.name = name
838 return c
839 }
840
841
842
843
844 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
845 c.urlParams_.Set("fields", googleapi.CombineFields(s))
846 return c
847 }
848
849
850
851
852 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
853 c.ifNoneMatch_ = entityTag
854 return c
855 }
856
857
858 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
859 c.ctx_ = ctx
860 return c
861 }
862
863
864
865 func (c *ProjectsLocationsGetCall) Header() http.Header {
866 if c.header_ == nil {
867 c.header_ = make(http.Header)
868 }
869 return c.header_
870 }
871
872 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
873 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
874 if c.ifNoneMatch_ != "" {
875 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
876 }
877 var body io.Reader = nil
878 c.urlParams_.Set("alt", alt)
879 c.urlParams_.Set("prettyPrint", "false")
880 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
881 urls += "?" + c.urlParams_.Encode()
882 req, err := http.NewRequest("GET", urls, body)
883 if err != nil {
884 return nil, err
885 }
886 req.Header = reqHeaders
887 googleapi.Expand(req.URL, map[string]string{
888 "name": c.name,
889 })
890 return gensupport.SendRequest(c.ctx_, c.s.client, req)
891 }
892
893
894
895
896
897
898 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
899 gensupport.SetOptions(c.urlParams_, opts...)
900 res, err := c.doRequest("json")
901 if res != nil && res.StatusCode == http.StatusNotModified {
902 if res.Body != nil {
903 res.Body.Close()
904 }
905 return nil, gensupport.WrapError(&googleapi.Error{
906 Code: res.StatusCode,
907 Header: res.Header,
908 })
909 }
910 if err != nil {
911 return nil, err
912 }
913 defer googleapi.CloseBody(res)
914 if err := googleapi.CheckResponse(res); err != nil {
915 return nil, gensupport.WrapError(err)
916 }
917 ret := &Location{
918 ServerResponse: googleapi.ServerResponse{
919 Header: res.Header,
920 HTTPStatusCode: res.StatusCode,
921 },
922 }
923 target := &ret
924 if err := gensupport.DecodeResponse(target, res); err != nil {
925 return nil, err
926 }
927 return ret, nil
928 }
929
930 type ProjectsLocationsListCall struct {
931 s *Service
932 name string
933 urlParams_ gensupport.URLParams
934 ifNoneMatch_ string
935 ctx_ context.Context
936 header_ http.Header
937 }
938
939
940
941
942 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
943 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
944 c.name = name
945 return c
946 }
947
948
949
950
951
952 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
953 c.urlParams_.Set("filter", filter)
954 return c
955 }
956
957
958
959 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
960 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
961 return c
962 }
963
964
965
966
967 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
968 c.urlParams_.Set("pageToken", pageToken)
969 return c
970 }
971
972
973
974
975 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
976 c.urlParams_.Set("fields", googleapi.CombineFields(s))
977 return c
978 }
979
980
981
982
983 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
984 c.ifNoneMatch_ = entityTag
985 return c
986 }
987
988
989 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
990 c.ctx_ = ctx
991 return c
992 }
993
994
995
996 func (c *ProjectsLocationsListCall) Header() http.Header {
997 if c.header_ == nil {
998 c.header_ = make(http.Header)
999 }
1000 return c.header_
1001 }
1002
1003 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
1004 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1005 if c.ifNoneMatch_ != "" {
1006 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1007 }
1008 var body io.Reader = nil
1009 c.urlParams_.Set("alt", alt)
1010 c.urlParams_.Set("prettyPrint", "false")
1011 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}/locations")
1012 urls += "?" + c.urlParams_.Encode()
1013 req, err := http.NewRequest("GET", urls, body)
1014 if err != nil {
1015 return nil, err
1016 }
1017 req.Header = reqHeaders
1018 googleapi.Expand(req.URL, map[string]string{
1019 "name": c.name,
1020 })
1021 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1022 }
1023
1024
1025
1026
1027
1028
1029
1030 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
1031 gensupport.SetOptions(c.urlParams_, opts...)
1032 res, err := c.doRequest("json")
1033 if res != nil && res.StatusCode == http.StatusNotModified {
1034 if res.Body != nil {
1035 res.Body.Close()
1036 }
1037 return nil, gensupport.WrapError(&googleapi.Error{
1038 Code: res.StatusCode,
1039 Header: res.Header,
1040 })
1041 }
1042 if err != nil {
1043 return nil, err
1044 }
1045 defer googleapi.CloseBody(res)
1046 if err := googleapi.CheckResponse(res); err != nil {
1047 return nil, gensupport.WrapError(err)
1048 }
1049 ret := &ListLocationsResponse{
1050 ServerResponse: googleapi.ServerResponse{
1051 Header: res.Header,
1052 HTTPStatusCode: res.StatusCode,
1053 },
1054 }
1055 target := &ret
1056 if err := gensupport.DecodeResponse(target, res); err != nil {
1057 return nil, err
1058 }
1059 return ret, nil
1060 }
1061
1062
1063
1064
1065 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
1066 c.ctx_ = ctx
1067 defer c.PageToken(c.urlParams_.Get("pageToken"))
1068 for {
1069 x, err := c.Do()
1070 if err != nil {
1071 return err
1072 }
1073 if err := f(x); err != nil {
1074 return err
1075 }
1076 if x.NextPageToken == "" {
1077 return nil
1078 }
1079 c.PageToken(x.NextPageToken)
1080 }
1081 }
1082
1083 type ProjectsLocationsAcceleratorTypesGetCall struct {
1084 s *Service
1085 name string
1086 urlParams_ gensupport.URLParams
1087 ifNoneMatch_ string
1088 ctx_ context.Context
1089 header_ http.Header
1090 }
1091
1092
1093
1094
1095 func (r *ProjectsLocationsAcceleratorTypesService) Get(name string) *ProjectsLocationsAcceleratorTypesGetCall {
1096 c := &ProjectsLocationsAcceleratorTypesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1097 c.name = name
1098 return c
1099 }
1100
1101
1102
1103
1104 func (c *ProjectsLocationsAcceleratorTypesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesGetCall {
1105 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1106 return c
1107 }
1108
1109
1110
1111
1112 func (c *ProjectsLocationsAcceleratorTypesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesGetCall {
1113 c.ifNoneMatch_ = entityTag
1114 return c
1115 }
1116
1117
1118 func (c *ProjectsLocationsAcceleratorTypesGetCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesGetCall {
1119 c.ctx_ = ctx
1120 return c
1121 }
1122
1123
1124
1125 func (c *ProjectsLocationsAcceleratorTypesGetCall) Header() http.Header {
1126 if c.header_ == nil {
1127 c.header_ = make(http.Header)
1128 }
1129 return c.header_
1130 }
1131
1132 func (c *ProjectsLocationsAcceleratorTypesGetCall) doRequest(alt string) (*http.Response, error) {
1133 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1134 if c.ifNoneMatch_ != "" {
1135 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1136 }
1137 var body io.Reader = nil
1138 c.urlParams_.Set("alt", alt)
1139 c.urlParams_.Set("prettyPrint", "false")
1140 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1141 urls += "?" + c.urlParams_.Encode()
1142 req, err := http.NewRequest("GET", urls, body)
1143 if err != nil {
1144 return nil, err
1145 }
1146 req.Header = reqHeaders
1147 googleapi.Expand(req.URL, map[string]string{
1148 "name": c.name,
1149 })
1150 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1151 }
1152
1153
1154
1155
1156
1157
1158
1159 func (c *ProjectsLocationsAcceleratorTypesGetCall) Do(opts ...googleapi.CallOption) (*AcceleratorType, error) {
1160 gensupport.SetOptions(c.urlParams_, opts...)
1161 res, err := c.doRequest("json")
1162 if res != nil && res.StatusCode == http.StatusNotModified {
1163 if res.Body != nil {
1164 res.Body.Close()
1165 }
1166 return nil, gensupport.WrapError(&googleapi.Error{
1167 Code: res.StatusCode,
1168 Header: res.Header,
1169 })
1170 }
1171 if err != nil {
1172 return nil, err
1173 }
1174 defer googleapi.CloseBody(res)
1175 if err := googleapi.CheckResponse(res); err != nil {
1176 return nil, gensupport.WrapError(err)
1177 }
1178 ret := &AcceleratorType{
1179 ServerResponse: googleapi.ServerResponse{
1180 Header: res.Header,
1181 HTTPStatusCode: res.StatusCode,
1182 },
1183 }
1184 target := &ret
1185 if err := gensupport.DecodeResponse(target, res); err != nil {
1186 return nil, err
1187 }
1188 return ret, nil
1189 }
1190
1191 type ProjectsLocationsAcceleratorTypesListCall struct {
1192 s *Service
1193 parent string
1194 urlParams_ gensupport.URLParams
1195 ifNoneMatch_ string
1196 ctx_ context.Context
1197 header_ http.Header
1198 }
1199
1200
1201
1202
1203 func (r *ProjectsLocationsAcceleratorTypesService) List(parent string) *ProjectsLocationsAcceleratorTypesListCall {
1204 c := &ProjectsLocationsAcceleratorTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1205 c.parent = parent
1206 return c
1207 }
1208
1209
1210 func (c *ProjectsLocationsAcceleratorTypesListCall) Filter(filter string) *ProjectsLocationsAcceleratorTypesListCall {
1211 c.urlParams_.Set("filter", filter)
1212 return c
1213 }
1214
1215
1216 func (c *ProjectsLocationsAcceleratorTypesListCall) OrderBy(orderBy string) *ProjectsLocationsAcceleratorTypesListCall {
1217 c.urlParams_.Set("orderBy", orderBy)
1218 return c
1219 }
1220
1221
1222
1223 func (c *ProjectsLocationsAcceleratorTypesListCall) PageSize(pageSize int64) *ProjectsLocationsAcceleratorTypesListCall {
1224 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1225 return c
1226 }
1227
1228
1229
1230 func (c *ProjectsLocationsAcceleratorTypesListCall) PageToken(pageToken string) *ProjectsLocationsAcceleratorTypesListCall {
1231 c.urlParams_.Set("pageToken", pageToken)
1232 return c
1233 }
1234
1235
1236
1237
1238 func (c *ProjectsLocationsAcceleratorTypesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesListCall {
1239 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1240 return c
1241 }
1242
1243
1244
1245
1246 func (c *ProjectsLocationsAcceleratorTypesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesListCall {
1247 c.ifNoneMatch_ = entityTag
1248 return c
1249 }
1250
1251
1252 func (c *ProjectsLocationsAcceleratorTypesListCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesListCall {
1253 c.ctx_ = ctx
1254 return c
1255 }
1256
1257
1258
1259 func (c *ProjectsLocationsAcceleratorTypesListCall) Header() http.Header {
1260 if c.header_ == nil {
1261 c.header_ = make(http.Header)
1262 }
1263 return c.header_
1264 }
1265
1266 func (c *ProjectsLocationsAcceleratorTypesListCall) doRequest(alt string) (*http.Response, error) {
1267 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1268 if c.ifNoneMatch_ != "" {
1269 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1270 }
1271 var body io.Reader = nil
1272 c.urlParams_.Set("alt", alt)
1273 c.urlParams_.Set("prettyPrint", "false")
1274 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/acceleratorTypes")
1275 urls += "?" + c.urlParams_.Encode()
1276 req, err := http.NewRequest("GET", urls, body)
1277 if err != nil {
1278 return nil, err
1279 }
1280 req.Header = reqHeaders
1281 googleapi.Expand(req.URL, map[string]string{
1282 "parent": c.parent,
1283 })
1284 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1285 }
1286
1287
1288
1289
1290
1291
1292
1293 func (c *ProjectsLocationsAcceleratorTypesListCall) Do(opts ...googleapi.CallOption) (*ListAcceleratorTypesResponse, error) {
1294 gensupport.SetOptions(c.urlParams_, opts...)
1295 res, err := c.doRequest("json")
1296 if res != nil && res.StatusCode == http.StatusNotModified {
1297 if res.Body != nil {
1298 res.Body.Close()
1299 }
1300 return nil, gensupport.WrapError(&googleapi.Error{
1301 Code: res.StatusCode,
1302 Header: res.Header,
1303 })
1304 }
1305 if err != nil {
1306 return nil, err
1307 }
1308 defer googleapi.CloseBody(res)
1309 if err := googleapi.CheckResponse(res); err != nil {
1310 return nil, gensupport.WrapError(err)
1311 }
1312 ret := &ListAcceleratorTypesResponse{
1313 ServerResponse: googleapi.ServerResponse{
1314 Header: res.Header,
1315 HTTPStatusCode: res.StatusCode,
1316 },
1317 }
1318 target := &ret
1319 if err := gensupport.DecodeResponse(target, res); err != nil {
1320 return nil, err
1321 }
1322 return ret, nil
1323 }
1324
1325
1326
1327
1328 func (c *ProjectsLocationsAcceleratorTypesListCall) Pages(ctx context.Context, f func(*ListAcceleratorTypesResponse) error) error {
1329 c.ctx_ = ctx
1330 defer c.PageToken(c.urlParams_.Get("pageToken"))
1331 for {
1332 x, err := c.Do()
1333 if err != nil {
1334 return err
1335 }
1336 if err := f(x); err != nil {
1337 return err
1338 }
1339 if x.NextPageToken == "" {
1340 return nil
1341 }
1342 c.PageToken(x.NextPageToken)
1343 }
1344 }
1345
1346 type ProjectsLocationsNodesCreateCall struct {
1347 s *Service
1348 parent string
1349 node *Node
1350 urlParams_ gensupport.URLParams
1351 ctx_ context.Context
1352 header_ http.Header
1353 }
1354
1355
1356
1357
1358 func (r *ProjectsLocationsNodesService) Create(parent string, node *Node) *ProjectsLocationsNodesCreateCall {
1359 c := &ProjectsLocationsNodesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1360 c.parent = parent
1361 c.node = node
1362 return c
1363 }
1364
1365
1366 func (c *ProjectsLocationsNodesCreateCall) NodeId(nodeId string) *ProjectsLocationsNodesCreateCall {
1367 c.urlParams_.Set("nodeId", nodeId)
1368 return c
1369 }
1370
1371
1372 func (c *ProjectsLocationsNodesCreateCall) RequestId(requestId string) *ProjectsLocationsNodesCreateCall {
1373 c.urlParams_.Set("requestId", requestId)
1374 return c
1375 }
1376
1377
1378
1379
1380 func (c *ProjectsLocationsNodesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesCreateCall {
1381 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1382 return c
1383 }
1384
1385
1386 func (c *ProjectsLocationsNodesCreateCall) Context(ctx context.Context) *ProjectsLocationsNodesCreateCall {
1387 c.ctx_ = ctx
1388 return c
1389 }
1390
1391
1392
1393 func (c *ProjectsLocationsNodesCreateCall) Header() http.Header {
1394 if c.header_ == nil {
1395 c.header_ = make(http.Header)
1396 }
1397 return c.header_
1398 }
1399
1400 func (c *ProjectsLocationsNodesCreateCall) doRequest(alt string) (*http.Response, error) {
1401 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1402 var body io.Reader = nil
1403 body, err := googleapi.WithoutDataWrapper.JSONReader(c.node)
1404 if err != nil {
1405 return nil, err
1406 }
1407 c.urlParams_.Set("alt", alt)
1408 c.urlParams_.Set("prettyPrint", "false")
1409 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/nodes")
1410 urls += "?" + c.urlParams_.Encode()
1411 req, err := http.NewRequest("POST", urls, body)
1412 if err != nil {
1413 return nil, err
1414 }
1415 req.Header = reqHeaders
1416 googleapi.Expand(req.URL, map[string]string{
1417 "parent": c.parent,
1418 })
1419 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1420 }
1421
1422
1423
1424
1425
1426
1427 func (c *ProjectsLocationsNodesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1428 gensupport.SetOptions(c.urlParams_, opts...)
1429 res, err := c.doRequest("json")
1430 if res != nil && res.StatusCode == http.StatusNotModified {
1431 if res.Body != nil {
1432 res.Body.Close()
1433 }
1434 return nil, gensupport.WrapError(&googleapi.Error{
1435 Code: res.StatusCode,
1436 Header: res.Header,
1437 })
1438 }
1439 if err != nil {
1440 return nil, err
1441 }
1442 defer googleapi.CloseBody(res)
1443 if err := googleapi.CheckResponse(res); err != nil {
1444 return nil, gensupport.WrapError(err)
1445 }
1446 ret := &Operation{
1447 ServerResponse: googleapi.ServerResponse{
1448 Header: res.Header,
1449 HTTPStatusCode: res.StatusCode,
1450 },
1451 }
1452 target := &ret
1453 if err := gensupport.DecodeResponse(target, res); err != nil {
1454 return nil, err
1455 }
1456 return ret, nil
1457 }
1458
1459 type ProjectsLocationsNodesDeleteCall struct {
1460 s *Service
1461 name string
1462 urlParams_ gensupport.URLParams
1463 ctx_ context.Context
1464 header_ http.Header
1465 }
1466
1467
1468
1469
1470 func (r *ProjectsLocationsNodesService) Delete(name string) *ProjectsLocationsNodesDeleteCall {
1471 c := &ProjectsLocationsNodesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1472 c.name = name
1473 return c
1474 }
1475
1476
1477 func (c *ProjectsLocationsNodesDeleteCall) RequestId(requestId string) *ProjectsLocationsNodesDeleteCall {
1478 c.urlParams_.Set("requestId", requestId)
1479 return c
1480 }
1481
1482
1483
1484
1485 func (c *ProjectsLocationsNodesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesDeleteCall {
1486 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1487 return c
1488 }
1489
1490
1491 func (c *ProjectsLocationsNodesDeleteCall) Context(ctx context.Context) *ProjectsLocationsNodesDeleteCall {
1492 c.ctx_ = ctx
1493 return c
1494 }
1495
1496
1497
1498 func (c *ProjectsLocationsNodesDeleteCall) Header() http.Header {
1499 if c.header_ == nil {
1500 c.header_ = make(http.Header)
1501 }
1502 return c.header_
1503 }
1504
1505 func (c *ProjectsLocationsNodesDeleteCall) doRequest(alt string) (*http.Response, error) {
1506 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1507 var body io.Reader = nil
1508 c.urlParams_.Set("alt", alt)
1509 c.urlParams_.Set("prettyPrint", "false")
1510 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1511 urls += "?" + c.urlParams_.Encode()
1512 req, err := http.NewRequest("DELETE", urls, body)
1513 if err != nil {
1514 return nil, err
1515 }
1516 req.Header = reqHeaders
1517 googleapi.Expand(req.URL, map[string]string{
1518 "name": c.name,
1519 })
1520 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1521 }
1522
1523
1524
1525
1526
1527
1528 func (c *ProjectsLocationsNodesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1529 gensupport.SetOptions(c.urlParams_, opts...)
1530 res, err := c.doRequest("json")
1531 if res != nil && res.StatusCode == http.StatusNotModified {
1532 if res.Body != nil {
1533 res.Body.Close()
1534 }
1535 return nil, gensupport.WrapError(&googleapi.Error{
1536 Code: res.StatusCode,
1537 Header: res.Header,
1538 })
1539 }
1540 if err != nil {
1541 return nil, err
1542 }
1543 defer googleapi.CloseBody(res)
1544 if err := googleapi.CheckResponse(res); err != nil {
1545 return nil, gensupport.WrapError(err)
1546 }
1547 ret := &Operation{
1548 ServerResponse: googleapi.ServerResponse{
1549 Header: res.Header,
1550 HTTPStatusCode: res.StatusCode,
1551 },
1552 }
1553 target := &ret
1554 if err := gensupport.DecodeResponse(target, res); err != nil {
1555 return nil, err
1556 }
1557 return ret, nil
1558 }
1559
1560 type ProjectsLocationsNodesGetCall struct {
1561 s *Service
1562 name string
1563 urlParams_ gensupport.URLParams
1564 ifNoneMatch_ string
1565 ctx_ context.Context
1566 header_ http.Header
1567 }
1568
1569
1570
1571
1572 func (r *ProjectsLocationsNodesService) Get(name string) *ProjectsLocationsNodesGetCall {
1573 c := &ProjectsLocationsNodesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1574 c.name = name
1575 return c
1576 }
1577
1578
1579
1580
1581 func (c *ProjectsLocationsNodesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesGetCall {
1582 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1583 return c
1584 }
1585
1586
1587
1588
1589 func (c *ProjectsLocationsNodesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesGetCall {
1590 c.ifNoneMatch_ = entityTag
1591 return c
1592 }
1593
1594
1595 func (c *ProjectsLocationsNodesGetCall) Context(ctx context.Context) *ProjectsLocationsNodesGetCall {
1596 c.ctx_ = ctx
1597 return c
1598 }
1599
1600
1601
1602 func (c *ProjectsLocationsNodesGetCall) Header() http.Header {
1603 if c.header_ == nil {
1604 c.header_ = make(http.Header)
1605 }
1606 return c.header_
1607 }
1608
1609 func (c *ProjectsLocationsNodesGetCall) doRequest(alt string) (*http.Response, error) {
1610 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1611 if c.ifNoneMatch_ != "" {
1612 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1613 }
1614 var body io.Reader = nil
1615 c.urlParams_.Set("alt", alt)
1616 c.urlParams_.Set("prettyPrint", "false")
1617 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1618 urls += "?" + c.urlParams_.Encode()
1619 req, err := http.NewRequest("GET", urls, body)
1620 if err != nil {
1621 return nil, err
1622 }
1623 req.Header = reqHeaders
1624 googleapi.Expand(req.URL, map[string]string{
1625 "name": c.name,
1626 })
1627 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1628 }
1629
1630
1631
1632
1633
1634
1635 func (c *ProjectsLocationsNodesGetCall) Do(opts ...googleapi.CallOption) (*Node, error) {
1636 gensupport.SetOptions(c.urlParams_, opts...)
1637 res, err := c.doRequest("json")
1638 if res != nil && res.StatusCode == http.StatusNotModified {
1639 if res.Body != nil {
1640 res.Body.Close()
1641 }
1642 return nil, gensupport.WrapError(&googleapi.Error{
1643 Code: res.StatusCode,
1644 Header: res.Header,
1645 })
1646 }
1647 if err != nil {
1648 return nil, err
1649 }
1650 defer googleapi.CloseBody(res)
1651 if err := googleapi.CheckResponse(res); err != nil {
1652 return nil, gensupport.WrapError(err)
1653 }
1654 ret := &Node{
1655 ServerResponse: googleapi.ServerResponse{
1656 Header: res.Header,
1657 HTTPStatusCode: res.StatusCode,
1658 },
1659 }
1660 target := &ret
1661 if err := gensupport.DecodeResponse(target, res); err != nil {
1662 return nil, err
1663 }
1664 return ret, nil
1665 }
1666
1667 type ProjectsLocationsNodesListCall struct {
1668 s *Service
1669 parent string
1670 urlParams_ gensupport.URLParams
1671 ifNoneMatch_ string
1672 ctx_ context.Context
1673 header_ http.Header
1674 }
1675
1676
1677
1678
1679 func (r *ProjectsLocationsNodesService) List(parent string) *ProjectsLocationsNodesListCall {
1680 c := &ProjectsLocationsNodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1681 c.parent = parent
1682 return c
1683 }
1684
1685
1686
1687 func (c *ProjectsLocationsNodesListCall) PageSize(pageSize int64) *ProjectsLocationsNodesListCall {
1688 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1689 return c
1690 }
1691
1692
1693
1694 func (c *ProjectsLocationsNodesListCall) PageToken(pageToken string) *ProjectsLocationsNodesListCall {
1695 c.urlParams_.Set("pageToken", pageToken)
1696 return c
1697 }
1698
1699
1700
1701
1702 func (c *ProjectsLocationsNodesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesListCall {
1703 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1704 return c
1705 }
1706
1707
1708
1709
1710 func (c *ProjectsLocationsNodesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesListCall {
1711 c.ifNoneMatch_ = entityTag
1712 return c
1713 }
1714
1715
1716 func (c *ProjectsLocationsNodesListCall) Context(ctx context.Context) *ProjectsLocationsNodesListCall {
1717 c.ctx_ = ctx
1718 return c
1719 }
1720
1721
1722
1723 func (c *ProjectsLocationsNodesListCall) Header() http.Header {
1724 if c.header_ == nil {
1725 c.header_ = make(http.Header)
1726 }
1727 return c.header_
1728 }
1729
1730 func (c *ProjectsLocationsNodesListCall) doRequest(alt string) (*http.Response, error) {
1731 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1732 if c.ifNoneMatch_ != "" {
1733 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1734 }
1735 var body io.Reader = nil
1736 c.urlParams_.Set("alt", alt)
1737 c.urlParams_.Set("prettyPrint", "false")
1738 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/nodes")
1739 urls += "?" + c.urlParams_.Encode()
1740 req, err := http.NewRequest("GET", urls, body)
1741 if err != nil {
1742 return nil, err
1743 }
1744 req.Header = reqHeaders
1745 googleapi.Expand(req.URL, map[string]string{
1746 "parent": c.parent,
1747 })
1748 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1749 }
1750
1751
1752
1753
1754
1755
1756
1757 func (c *ProjectsLocationsNodesListCall) Do(opts ...googleapi.CallOption) (*ListNodesResponse, error) {
1758 gensupport.SetOptions(c.urlParams_, opts...)
1759 res, err := c.doRequest("json")
1760 if res != nil && res.StatusCode == http.StatusNotModified {
1761 if res.Body != nil {
1762 res.Body.Close()
1763 }
1764 return nil, gensupport.WrapError(&googleapi.Error{
1765 Code: res.StatusCode,
1766 Header: res.Header,
1767 })
1768 }
1769 if err != nil {
1770 return nil, err
1771 }
1772 defer googleapi.CloseBody(res)
1773 if err := googleapi.CheckResponse(res); err != nil {
1774 return nil, gensupport.WrapError(err)
1775 }
1776 ret := &ListNodesResponse{
1777 ServerResponse: googleapi.ServerResponse{
1778 Header: res.Header,
1779 HTTPStatusCode: res.StatusCode,
1780 },
1781 }
1782 target := &ret
1783 if err := gensupport.DecodeResponse(target, res); err != nil {
1784 return nil, err
1785 }
1786 return ret, nil
1787 }
1788
1789
1790
1791
1792 func (c *ProjectsLocationsNodesListCall) Pages(ctx context.Context, f func(*ListNodesResponse) error) error {
1793 c.ctx_ = ctx
1794 defer c.PageToken(c.urlParams_.Get("pageToken"))
1795 for {
1796 x, err := c.Do()
1797 if err != nil {
1798 return err
1799 }
1800 if err := f(x); err != nil {
1801 return err
1802 }
1803 if x.NextPageToken == "" {
1804 return nil
1805 }
1806 c.PageToken(x.NextPageToken)
1807 }
1808 }
1809
1810 type ProjectsLocationsNodesReimageCall struct {
1811 s *Service
1812 name string
1813 reimagenoderequest *ReimageNodeRequest
1814 urlParams_ gensupport.URLParams
1815 ctx_ context.Context
1816 header_ http.Header
1817 }
1818
1819
1820
1821
1822 func (r *ProjectsLocationsNodesService) Reimage(name string, reimagenoderequest *ReimageNodeRequest) *ProjectsLocationsNodesReimageCall {
1823 c := &ProjectsLocationsNodesReimageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1824 c.name = name
1825 c.reimagenoderequest = reimagenoderequest
1826 return c
1827 }
1828
1829
1830
1831
1832 func (c *ProjectsLocationsNodesReimageCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesReimageCall {
1833 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1834 return c
1835 }
1836
1837
1838 func (c *ProjectsLocationsNodesReimageCall) Context(ctx context.Context) *ProjectsLocationsNodesReimageCall {
1839 c.ctx_ = ctx
1840 return c
1841 }
1842
1843
1844
1845 func (c *ProjectsLocationsNodesReimageCall) Header() http.Header {
1846 if c.header_ == nil {
1847 c.header_ = make(http.Header)
1848 }
1849 return c.header_
1850 }
1851
1852 func (c *ProjectsLocationsNodesReimageCall) doRequest(alt string) (*http.Response, error) {
1853 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1854 var body io.Reader = nil
1855 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reimagenoderequest)
1856 if err != nil {
1857 return nil, err
1858 }
1859 c.urlParams_.Set("alt", alt)
1860 c.urlParams_.Set("prettyPrint", "false")
1861 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:reimage")
1862 urls += "?" + c.urlParams_.Encode()
1863 req, err := http.NewRequest("POST", urls, body)
1864 if err != nil {
1865 return nil, err
1866 }
1867 req.Header = reqHeaders
1868 googleapi.Expand(req.URL, map[string]string{
1869 "name": c.name,
1870 })
1871 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1872 }
1873
1874
1875
1876
1877
1878
1879 func (c *ProjectsLocationsNodesReimageCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1880 gensupport.SetOptions(c.urlParams_, opts...)
1881 res, err := c.doRequest("json")
1882 if res != nil && res.StatusCode == http.StatusNotModified {
1883 if res.Body != nil {
1884 res.Body.Close()
1885 }
1886 return nil, gensupport.WrapError(&googleapi.Error{
1887 Code: res.StatusCode,
1888 Header: res.Header,
1889 })
1890 }
1891 if err != nil {
1892 return nil, err
1893 }
1894 defer googleapi.CloseBody(res)
1895 if err := googleapi.CheckResponse(res); err != nil {
1896 return nil, gensupport.WrapError(err)
1897 }
1898 ret := &Operation{
1899 ServerResponse: googleapi.ServerResponse{
1900 Header: res.Header,
1901 HTTPStatusCode: res.StatusCode,
1902 },
1903 }
1904 target := &ret
1905 if err := gensupport.DecodeResponse(target, res); err != nil {
1906 return nil, err
1907 }
1908 return ret, nil
1909 }
1910
1911 type ProjectsLocationsNodesStartCall struct {
1912 s *Service
1913 name string
1914 startnoderequest *StartNodeRequest
1915 urlParams_ gensupport.URLParams
1916 ctx_ context.Context
1917 header_ http.Header
1918 }
1919
1920
1921
1922
1923 func (r *ProjectsLocationsNodesService) Start(name string, startnoderequest *StartNodeRequest) *ProjectsLocationsNodesStartCall {
1924 c := &ProjectsLocationsNodesStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1925 c.name = name
1926 c.startnoderequest = startnoderequest
1927 return c
1928 }
1929
1930
1931
1932
1933 func (c *ProjectsLocationsNodesStartCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStartCall {
1934 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1935 return c
1936 }
1937
1938
1939 func (c *ProjectsLocationsNodesStartCall) Context(ctx context.Context) *ProjectsLocationsNodesStartCall {
1940 c.ctx_ = ctx
1941 return c
1942 }
1943
1944
1945
1946 func (c *ProjectsLocationsNodesStartCall) Header() http.Header {
1947 if c.header_ == nil {
1948 c.header_ = make(http.Header)
1949 }
1950 return c.header_
1951 }
1952
1953 func (c *ProjectsLocationsNodesStartCall) doRequest(alt string) (*http.Response, error) {
1954 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1955 var body io.Reader = nil
1956 body, err := googleapi.WithoutDataWrapper.JSONReader(c.startnoderequest)
1957 if err != nil {
1958 return nil, err
1959 }
1960 c.urlParams_.Set("alt", alt)
1961 c.urlParams_.Set("prettyPrint", "false")
1962 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:start")
1963 urls += "?" + c.urlParams_.Encode()
1964 req, err := http.NewRequest("POST", urls, body)
1965 if err != nil {
1966 return nil, err
1967 }
1968 req.Header = reqHeaders
1969 googleapi.Expand(req.URL, map[string]string{
1970 "name": c.name,
1971 })
1972 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1973 }
1974
1975
1976
1977
1978
1979
1980 func (c *ProjectsLocationsNodesStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1981 gensupport.SetOptions(c.urlParams_, opts...)
1982 res, err := c.doRequest("json")
1983 if res != nil && res.StatusCode == http.StatusNotModified {
1984 if res.Body != nil {
1985 res.Body.Close()
1986 }
1987 return nil, gensupport.WrapError(&googleapi.Error{
1988 Code: res.StatusCode,
1989 Header: res.Header,
1990 })
1991 }
1992 if err != nil {
1993 return nil, err
1994 }
1995 defer googleapi.CloseBody(res)
1996 if err := googleapi.CheckResponse(res); err != nil {
1997 return nil, gensupport.WrapError(err)
1998 }
1999 ret := &Operation{
2000 ServerResponse: googleapi.ServerResponse{
2001 Header: res.Header,
2002 HTTPStatusCode: res.StatusCode,
2003 },
2004 }
2005 target := &ret
2006 if err := gensupport.DecodeResponse(target, res); err != nil {
2007 return nil, err
2008 }
2009 return ret, nil
2010 }
2011
2012 type ProjectsLocationsNodesStopCall struct {
2013 s *Service
2014 name string
2015 stopnoderequest *StopNodeRequest
2016 urlParams_ gensupport.URLParams
2017 ctx_ context.Context
2018 header_ http.Header
2019 }
2020
2021
2022
2023
2024 func (r *ProjectsLocationsNodesService) Stop(name string, stopnoderequest *StopNodeRequest) *ProjectsLocationsNodesStopCall {
2025 c := &ProjectsLocationsNodesStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2026 c.name = name
2027 c.stopnoderequest = stopnoderequest
2028 return c
2029 }
2030
2031
2032
2033
2034 func (c *ProjectsLocationsNodesStopCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStopCall {
2035 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2036 return c
2037 }
2038
2039
2040 func (c *ProjectsLocationsNodesStopCall) Context(ctx context.Context) *ProjectsLocationsNodesStopCall {
2041 c.ctx_ = ctx
2042 return c
2043 }
2044
2045
2046
2047 func (c *ProjectsLocationsNodesStopCall) Header() http.Header {
2048 if c.header_ == nil {
2049 c.header_ = make(http.Header)
2050 }
2051 return c.header_
2052 }
2053
2054 func (c *ProjectsLocationsNodesStopCall) doRequest(alt string) (*http.Response, error) {
2055 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2056 var body io.Reader = nil
2057 body, err := googleapi.WithoutDataWrapper.JSONReader(c.stopnoderequest)
2058 if err != nil {
2059 return nil, err
2060 }
2061 c.urlParams_.Set("alt", alt)
2062 c.urlParams_.Set("prettyPrint", "false")
2063 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:stop")
2064 urls += "?" + c.urlParams_.Encode()
2065 req, err := http.NewRequest("POST", urls, body)
2066 if err != nil {
2067 return nil, err
2068 }
2069 req.Header = reqHeaders
2070 googleapi.Expand(req.URL, map[string]string{
2071 "name": c.name,
2072 })
2073 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2074 }
2075
2076
2077
2078
2079
2080
2081 func (c *ProjectsLocationsNodesStopCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2082 gensupport.SetOptions(c.urlParams_, opts...)
2083 res, err := c.doRequest("json")
2084 if res != nil && res.StatusCode == http.StatusNotModified {
2085 if res.Body != nil {
2086 res.Body.Close()
2087 }
2088 return nil, gensupport.WrapError(&googleapi.Error{
2089 Code: res.StatusCode,
2090 Header: res.Header,
2091 })
2092 }
2093 if err != nil {
2094 return nil, err
2095 }
2096 defer googleapi.CloseBody(res)
2097 if err := googleapi.CheckResponse(res); err != nil {
2098 return nil, gensupport.WrapError(err)
2099 }
2100 ret := &Operation{
2101 ServerResponse: googleapi.ServerResponse{
2102 Header: res.Header,
2103 HTTPStatusCode: res.StatusCode,
2104 },
2105 }
2106 target := &ret
2107 if err := gensupport.DecodeResponse(target, res); err != nil {
2108 return nil, err
2109 }
2110 return ret, nil
2111 }
2112
2113 type ProjectsLocationsOperationsCancelCall struct {
2114 s *Service
2115 name string
2116 urlParams_ gensupport.URLParams
2117 ctx_ context.Context
2118 header_ http.Header
2119 }
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132 func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall {
2133 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2134 c.name = name
2135 return c
2136 }
2137
2138
2139
2140
2141 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
2142 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2143 return c
2144 }
2145
2146
2147 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
2148 c.ctx_ = ctx
2149 return c
2150 }
2151
2152
2153
2154 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
2155 if c.header_ == nil {
2156 c.header_ = make(http.Header)
2157 }
2158 return c.header_
2159 }
2160
2161 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
2162 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2163 var body io.Reader = nil
2164 c.urlParams_.Set("alt", alt)
2165 c.urlParams_.Set("prettyPrint", "false")
2166 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:cancel")
2167 urls += "?" + c.urlParams_.Encode()
2168 req, err := http.NewRequest("POST", urls, body)
2169 if err != nil {
2170 return nil, err
2171 }
2172 req.Header = reqHeaders
2173 googleapi.Expand(req.URL, map[string]string{
2174 "name": c.name,
2175 })
2176 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2177 }
2178
2179
2180
2181
2182
2183
2184 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2185 gensupport.SetOptions(c.urlParams_, opts...)
2186 res, err := c.doRequest("json")
2187 if res != nil && res.StatusCode == http.StatusNotModified {
2188 if res.Body != nil {
2189 res.Body.Close()
2190 }
2191 return nil, gensupport.WrapError(&googleapi.Error{
2192 Code: res.StatusCode,
2193 Header: res.Header,
2194 })
2195 }
2196 if err != nil {
2197 return nil, err
2198 }
2199 defer googleapi.CloseBody(res)
2200 if err := googleapi.CheckResponse(res); err != nil {
2201 return nil, gensupport.WrapError(err)
2202 }
2203 ret := &Empty{
2204 ServerResponse: googleapi.ServerResponse{
2205 Header: res.Header,
2206 HTTPStatusCode: res.StatusCode,
2207 },
2208 }
2209 target := &ret
2210 if err := gensupport.DecodeResponse(target, res); err != nil {
2211 return nil, err
2212 }
2213 return ret, nil
2214 }
2215
2216 type ProjectsLocationsOperationsDeleteCall struct {
2217 s *Service
2218 name string
2219 urlParams_ gensupport.URLParams
2220 ctx_ context.Context
2221 header_ http.Header
2222 }
2223
2224
2225
2226
2227
2228
2229
2230 func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
2231 c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2232 c.name = name
2233 return c
2234 }
2235
2236
2237
2238
2239 func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
2240 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2241 return c
2242 }
2243
2244
2245 func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
2246 c.ctx_ = ctx
2247 return c
2248 }
2249
2250
2251
2252 func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
2253 if c.header_ == nil {
2254 c.header_ = make(http.Header)
2255 }
2256 return c.header_
2257 }
2258
2259 func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
2260 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2261 var body io.Reader = nil
2262 c.urlParams_.Set("alt", alt)
2263 c.urlParams_.Set("prettyPrint", "false")
2264 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
2265 urls += "?" + c.urlParams_.Encode()
2266 req, err := http.NewRequest("DELETE", urls, body)
2267 if err != nil {
2268 return nil, err
2269 }
2270 req.Header = reqHeaders
2271 googleapi.Expand(req.URL, map[string]string{
2272 "name": c.name,
2273 })
2274 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2275 }
2276
2277
2278
2279
2280
2281
2282 func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2283 gensupport.SetOptions(c.urlParams_, opts...)
2284 res, err := c.doRequest("json")
2285 if res != nil && res.StatusCode == http.StatusNotModified {
2286 if res.Body != nil {
2287 res.Body.Close()
2288 }
2289 return nil, gensupport.WrapError(&googleapi.Error{
2290 Code: res.StatusCode,
2291 Header: res.Header,
2292 })
2293 }
2294 if err != nil {
2295 return nil, err
2296 }
2297 defer googleapi.CloseBody(res)
2298 if err := googleapi.CheckResponse(res); err != nil {
2299 return nil, gensupport.WrapError(err)
2300 }
2301 ret := &Empty{
2302 ServerResponse: googleapi.ServerResponse{
2303 Header: res.Header,
2304 HTTPStatusCode: res.StatusCode,
2305 },
2306 }
2307 target := &ret
2308 if err := gensupport.DecodeResponse(target, res); err != nil {
2309 return nil, err
2310 }
2311 return ret, nil
2312 }
2313
2314 type ProjectsLocationsOperationsGetCall struct {
2315 s *Service
2316 name string
2317 urlParams_ gensupport.URLParams
2318 ifNoneMatch_ string
2319 ctx_ context.Context
2320 header_ http.Header
2321 }
2322
2323
2324
2325
2326
2327
2328 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
2329 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2330 c.name = name
2331 return c
2332 }
2333
2334
2335
2336
2337 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
2338 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2339 return c
2340 }
2341
2342
2343
2344
2345 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
2346 c.ifNoneMatch_ = entityTag
2347 return c
2348 }
2349
2350
2351 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
2352 c.ctx_ = ctx
2353 return c
2354 }
2355
2356
2357
2358 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
2359 if c.header_ == nil {
2360 c.header_ = make(http.Header)
2361 }
2362 return c.header_
2363 }
2364
2365 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
2366 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2367 if c.ifNoneMatch_ != "" {
2368 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2369 }
2370 var body io.Reader = nil
2371 c.urlParams_.Set("alt", alt)
2372 c.urlParams_.Set("prettyPrint", "false")
2373 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
2374 urls += "?" + c.urlParams_.Encode()
2375 req, err := http.NewRequest("GET", urls, body)
2376 if err != nil {
2377 return nil, err
2378 }
2379 req.Header = reqHeaders
2380 googleapi.Expand(req.URL, map[string]string{
2381 "name": c.name,
2382 })
2383 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2384 }
2385
2386
2387
2388
2389
2390
2391 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2392 gensupport.SetOptions(c.urlParams_, opts...)
2393 res, err := c.doRequest("json")
2394 if res != nil && res.StatusCode == http.StatusNotModified {
2395 if res.Body != nil {
2396 res.Body.Close()
2397 }
2398 return nil, gensupport.WrapError(&googleapi.Error{
2399 Code: res.StatusCode,
2400 Header: res.Header,
2401 })
2402 }
2403 if err != nil {
2404 return nil, err
2405 }
2406 defer googleapi.CloseBody(res)
2407 if err := googleapi.CheckResponse(res); err != nil {
2408 return nil, gensupport.WrapError(err)
2409 }
2410 ret := &Operation{
2411 ServerResponse: googleapi.ServerResponse{
2412 Header: res.Header,
2413 HTTPStatusCode: res.StatusCode,
2414 },
2415 }
2416 target := &ret
2417 if err := gensupport.DecodeResponse(target, res); err != nil {
2418 return nil, err
2419 }
2420 return ret, nil
2421 }
2422
2423 type ProjectsLocationsOperationsListCall struct {
2424 s *Service
2425 name string
2426 urlParams_ gensupport.URLParams
2427 ifNoneMatch_ string
2428 ctx_ context.Context
2429 header_ http.Header
2430 }
2431
2432
2433
2434
2435
2436 func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
2437 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2438 c.name = name
2439 return c
2440 }
2441
2442
2443 func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
2444 c.urlParams_.Set("filter", filter)
2445 return c
2446 }
2447
2448
2449
2450 func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
2451 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2452 return c
2453 }
2454
2455
2456
2457 func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
2458 c.urlParams_.Set("pageToken", pageToken)
2459 return c
2460 }
2461
2462
2463
2464
2465 func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
2466 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2467 return c
2468 }
2469
2470
2471
2472
2473 func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
2474 c.ifNoneMatch_ = entityTag
2475 return c
2476 }
2477
2478
2479 func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
2480 c.ctx_ = ctx
2481 return c
2482 }
2483
2484
2485
2486 func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
2487 if c.header_ == nil {
2488 c.header_ = make(http.Header)
2489 }
2490 return c.header_
2491 }
2492
2493 func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
2494 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2495 if c.ifNoneMatch_ != "" {
2496 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2497 }
2498 var body io.Reader = nil
2499 c.urlParams_.Set("alt", alt)
2500 c.urlParams_.Set("prettyPrint", "false")
2501 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}/operations")
2502 urls += "?" + c.urlParams_.Encode()
2503 req, err := http.NewRequest("GET", urls, body)
2504 if err != nil {
2505 return nil, err
2506 }
2507 req.Header = reqHeaders
2508 googleapi.Expand(req.URL, map[string]string{
2509 "name": c.name,
2510 })
2511 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2512 }
2513
2514
2515
2516
2517
2518
2519
2520 func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
2521 gensupport.SetOptions(c.urlParams_, opts...)
2522 res, err := c.doRequest("json")
2523 if res != nil && res.StatusCode == http.StatusNotModified {
2524 if res.Body != nil {
2525 res.Body.Close()
2526 }
2527 return nil, gensupport.WrapError(&googleapi.Error{
2528 Code: res.StatusCode,
2529 Header: res.Header,
2530 })
2531 }
2532 if err != nil {
2533 return nil, err
2534 }
2535 defer googleapi.CloseBody(res)
2536 if err := googleapi.CheckResponse(res); err != nil {
2537 return nil, gensupport.WrapError(err)
2538 }
2539 ret := &ListOperationsResponse{
2540 ServerResponse: googleapi.ServerResponse{
2541 Header: res.Header,
2542 HTTPStatusCode: res.StatusCode,
2543 },
2544 }
2545 target := &ret
2546 if err := gensupport.DecodeResponse(target, res); err != nil {
2547 return nil, err
2548 }
2549 return ret, nil
2550 }
2551
2552
2553
2554
2555 func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
2556 c.ctx_ = ctx
2557 defer c.PageToken(c.urlParams_.Get("pageToken"))
2558 for {
2559 x, err := c.Do()
2560 if err != nil {
2561 return err
2562 }
2563 if err := f(x); err != nil {
2564 return err
2565 }
2566 if x.NextPageToken == "" {
2567 return nil
2568 }
2569 c.PageToken(x.NextPageToken)
2570 }
2571 }
2572
2573 type ProjectsLocationsTensorflowVersionsGetCall struct {
2574 s *Service
2575 name string
2576 urlParams_ gensupport.URLParams
2577 ifNoneMatch_ string
2578 ctx_ context.Context
2579 header_ http.Header
2580 }
2581
2582
2583
2584
2585 func (r *ProjectsLocationsTensorflowVersionsService) Get(name string) *ProjectsLocationsTensorflowVersionsGetCall {
2586 c := &ProjectsLocationsTensorflowVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2587 c.name = name
2588 return c
2589 }
2590
2591
2592
2593
2594 func (c *ProjectsLocationsTensorflowVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsGetCall {
2595 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2596 return c
2597 }
2598
2599
2600
2601
2602 func (c *ProjectsLocationsTensorflowVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsGetCall {
2603 c.ifNoneMatch_ = entityTag
2604 return c
2605 }
2606
2607
2608 func (c *ProjectsLocationsTensorflowVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsGetCall {
2609 c.ctx_ = ctx
2610 return c
2611 }
2612
2613
2614
2615 func (c *ProjectsLocationsTensorflowVersionsGetCall) Header() http.Header {
2616 if c.header_ == nil {
2617 c.header_ = make(http.Header)
2618 }
2619 return c.header_
2620 }
2621
2622 func (c *ProjectsLocationsTensorflowVersionsGetCall) doRequest(alt string) (*http.Response, error) {
2623 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2624 if c.ifNoneMatch_ != "" {
2625 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2626 }
2627 var body io.Reader = nil
2628 c.urlParams_.Set("alt", alt)
2629 c.urlParams_.Set("prettyPrint", "false")
2630 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
2631 urls += "?" + c.urlParams_.Encode()
2632 req, err := http.NewRequest("GET", urls, body)
2633 if err != nil {
2634 return nil, err
2635 }
2636 req.Header = reqHeaders
2637 googleapi.Expand(req.URL, map[string]string{
2638 "name": c.name,
2639 })
2640 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2641 }
2642
2643
2644
2645
2646
2647
2648
2649 func (c *ProjectsLocationsTensorflowVersionsGetCall) Do(opts ...googleapi.CallOption) (*TensorFlowVersion, error) {
2650 gensupport.SetOptions(c.urlParams_, opts...)
2651 res, err := c.doRequest("json")
2652 if res != nil && res.StatusCode == http.StatusNotModified {
2653 if res.Body != nil {
2654 res.Body.Close()
2655 }
2656 return nil, gensupport.WrapError(&googleapi.Error{
2657 Code: res.StatusCode,
2658 Header: res.Header,
2659 })
2660 }
2661 if err != nil {
2662 return nil, err
2663 }
2664 defer googleapi.CloseBody(res)
2665 if err := googleapi.CheckResponse(res); err != nil {
2666 return nil, gensupport.WrapError(err)
2667 }
2668 ret := &TensorFlowVersion{
2669 ServerResponse: googleapi.ServerResponse{
2670 Header: res.Header,
2671 HTTPStatusCode: res.StatusCode,
2672 },
2673 }
2674 target := &ret
2675 if err := gensupport.DecodeResponse(target, res); err != nil {
2676 return nil, err
2677 }
2678 return ret, nil
2679 }
2680
2681 type ProjectsLocationsTensorflowVersionsListCall struct {
2682 s *Service
2683 parent string
2684 urlParams_ gensupport.URLParams
2685 ifNoneMatch_ string
2686 ctx_ context.Context
2687 header_ http.Header
2688 }
2689
2690
2691
2692
2693 func (r *ProjectsLocationsTensorflowVersionsService) List(parent string) *ProjectsLocationsTensorflowVersionsListCall {
2694 c := &ProjectsLocationsTensorflowVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2695 c.parent = parent
2696 return c
2697 }
2698
2699
2700 func (c *ProjectsLocationsTensorflowVersionsListCall) Filter(filter string) *ProjectsLocationsTensorflowVersionsListCall {
2701 c.urlParams_.Set("filter", filter)
2702 return c
2703 }
2704
2705
2706 func (c *ProjectsLocationsTensorflowVersionsListCall) OrderBy(orderBy string) *ProjectsLocationsTensorflowVersionsListCall {
2707 c.urlParams_.Set("orderBy", orderBy)
2708 return c
2709 }
2710
2711
2712
2713 func (c *ProjectsLocationsTensorflowVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsTensorflowVersionsListCall {
2714 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2715 return c
2716 }
2717
2718
2719
2720 func (c *ProjectsLocationsTensorflowVersionsListCall) PageToken(pageToken string) *ProjectsLocationsTensorflowVersionsListCall {
2721 c.urlParams_.Set("pageToken", pageToken)
2722 return c
2723 }
2724
2725
2726
2727
2728 func (c *ProjectsLocationsTensorflowVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsListCall {
2729 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2730 return c
2731 }
2732
2733
2734
2735
2736 func (c *ProjectsLocationsTensorflowVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsListCall {
2737 c.ifNoneMatch_ = entityTag
2738 return c
2739 }
2740
2741
2742 func (c *ProjectsLocationsTensorflowVersionsListCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsListCall {
2743 c.ctx_ = ctx
2744 return c
2745 }
2746
2747
2748
2749 func (c *ProjectsLocationsTensorflowVersionsListCall) Header() http.Header {
2750 if c.header_ == nil {
2751 c.header_ = make(http.Header)
2752 }
2753 return c.header_
2754 }
2755
2756 func (c *ProjectsLocationsTensorflowVersionsListCall) doRequest(alt string) (*http.Response, error) {
2757 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2758 if c.ifNoneMatch_ != "" {
2759 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2760 }
2761 var body io.Reader = nil
2762 c.urlParams_.Set("alt", alt)
2763 c.urlParams_.Set("prettyPrint", "false")
2764 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/tensorflowVersions")
2765 urls += "?" + c.urlParams_.Encode()
2766 req, err := http.NewRequest("GET", urls, body)
2767 if err != nil {
2768 return nil, err
2769 }
2770 req.Header = reqHeaders
2771 googleapi.Expand(req.URL, map[string]string{
2772 "parent": c.parent,
2773 })
2774 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2775 }
2776
2777
2778
2779
2780
2781
2782
2783 func (c *ProjectsLocationsTensorflowVersionsListCall) Do(opts ...googleapi.CallOption) (*ListTensorFlowVersionsResponse, error) {
2784 gensupport.SetOptions(c.urlParams_, opts...)
2785 res, err := c.doRequest("json")
2786 if res != nil && res.StatusCode == http.StatusNotModified {
2787 if res.Body != nil {
2788 res.Body.Close()
2789 }
2790 return nil, gensupport.WrapError(&googleapi.Error{
2791 Code: res.StatusCode,
2792 Header: res.Header,
2793 })
2794 }
2795 if err != nil {
2796 return nil, err
2797 }
2798 defer googleapi.CloseBody(res)
2799 if err := googleapi.CheckResponse(res); err != nil {
2800 return nil, gensupport.WrapError(err)
2801 }
2802 ret := &ListTensorFlowVersionsResponse{
2803 ServerResponse: googleapi.ServerResponse{
2804 Header: res.Header,
2805 HTTPStatusCode: res.StatusCode,
2806 },
2807 }
2808 target := &ret
2809 if err := gensupport.DecodeResponse(target, res); err != nil {
2810 return nil, err
2811 }
2812 return ret, nil
2813 }
2814
2815
2816
2817
2818 func (c *ProjectsLocationsTensorflowVersionsListCall) Pages(ctx context.Context, f func(*ListTensorFlowVersionsResponse) error) error {
2819 c.ctx_ = ctx
2820 defer c.PageToken(c.urlParams_.Get("pageToken"))
2821 for {
2822 x, err := c.Do()
2823 if err != nil {
2824 return err
2825 }
2826 if err := f(x); err != nil {
2827 return err
2828 }
2829 if x.NextPageToken == "" {
2830 return nil
2831 }
2832 c.PageToken(x.NextPageToken)
2833 }
2834 }
2835
View as plain text