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:v1"
90 const apiName = "tpu"
91 const apiVersion = "v1"
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, "v1/{+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, "v1/{+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, "v1/{+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, "v1/{+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
1373
1374 func (c *ProjectsLocationsNodesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesCreateCall {
1375 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1376 return c
1377 }
1378
1379
1380 func (c *ProjectsLocationsNodesCreateCall) Context(ctx context.Context) *ProjectsLocationsNodesCreateCall {
1381 c.ctx_ = ctx
1382 return c
1383 }
1384
1385
1386
1387 func (c *ProjectsLocationsNodesCreateCall) Header() http.Header {
1388 if c.header_ == nil {
1389 c.header_ = make(http.Header)
1390 }
1391 return c.header_
1392 }
1393
1394 func (c *ProjectsLocationsNodesCreateCall) doRequest(alt string) (*http.Response, error) {
1395 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1396 var body io.Reader = nil
1397 body, err := googleapi.WithoutDataWrapper.JSONReader(c.node)
1398 if err != nil {
1399 return nil, err
1400 }
1401 c.urlParams_.Set("alt", alt)
1402 c.urlParams_.Set("prettyPrint", "false")
1403 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/nodes")
1404 urls += "?" + c.urlParams_.Encode()
1405 req, err := http.NewRequest("POST", urls, body)
1406 if err != nil {
1407 return nil, err
1408 }
1409 req.Header = reqHeaders
1410 googleapi.Expand(req.URL, map[string]string{
1411 "parent": c.parent,
1412 })
1413 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1414 }
1415
1416
1417
1418
1419
1420
1421 func (c *ProjectsLocationsNodesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1422 gensupport.SetOptions(c.urlParams_, opts...)
1423 res, err := c.doRequest("json")
1424 if res != nil && res.StatusCode == http.StatusNotModified {
1425 if res.Body != nil {
1426 res.Body.Close()
1427 }
1428 return nil, gensupport.WrapError(&googleapi.Error{
1429 Code: res.StatusCode,
1430 Header: res.Header,
1431 })
1432 }
1433 if err != nil {
1434 return nil, err
1435 }
1436 defer googleapi.CloseBody(res)
1437 if err := googleapi.CheckResponse(res); err != nil {
1438 return nil, gensupport.WrapError(err)
1439 }
1440 ret := &Operation{
1441 ServerResponse: googleapi.ServerResponse{
1442 Header: res.Header,
1443 HTTPStatusCode: res.StatusCode,
1444 },
1445 }
1446 target := &ret
1447 if err := gensupport.DecodeResponse(target, res); err != nil {
1448 return nil, err
1449 }
1450 return ret, nil
1451 }
1452
1453 type ProjectsLocationsNodesDeleteCall struct {
1454 s *Service
1455 name string
1456 urlParams_ gensupport.URLParams
1457 ctx_ context.Context
1458 header_ http.Header
1459 }
1460
1461
1462
1463
1464 func (r *ProjectsLocationsNodesService) Delete(name string) *ProjectsLocationsNodesDeleteCall {
1465 c := &ProjectsLocationsNodesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1466 c.name = name
1467 return c
1468 }
1469
1470
1471
1472
1473 func (c *ProjectsLocationsNodesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesDeleteCall {
1474 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1475 return c
1476 }
1477
1478
1479 func (c *ProjectsLocationsNodesDeleteCall) Context(ctx context.Context) *ProjectsLocationsNodesDeleteCall {
1480 c.ctx_ = ctx
1481 return c
1482 }
1483
1484
1485
1486 func (c *ProjectsLocationsNodesDeleteCall) Header() http.Header {
1487 if c.header_ == nil {
1488 c.header_ = make(http.Header)
1489 }
1490 return c.header_
1491 }
1492
1493 func (c *ProjectsLocationsNodesDeleteCall) doRequest(alt string) (*http.Response, error) {
1494 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1495 var body io.Reader = nil
1496 c.urlParams_.Set("alt", alt)
1497 c.urlParams_.Set("prettyPrint", "false")
1498 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1499 urls += "?" + c.urlParams_.Encode()
1500 req, err := http.NewRequest("DELETE", urls, body)
1501 if err != nil {
1502 return nil, err
1503 }
1504 req.Header = reqHeaders
1505 googleapi.Expand(req.URL, map[string]string{
1506 "name": c.name,
1507 })
1508 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1509 }
1510
1511
1512
1513
1514
1515
1516 func (c *ProjectsLocationsNodesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1517 gensupport.SetOptions(c.urlParams_, opts...)
1518 res, err := c.doRequest("json")
1519 if res != nil && res.StatusCode == http.StatusNotModified {
1520 if res.Body != nil {
1521 res.Body.Close()
1522 }
1523 return nil, gensupport.WrapError(&googleapi.Error{
1524 Code: res.StatusCode,
1525 Header: res.Header,
1526 })
1527 }
1528 if err != nil {
1529 return nil, err
1530 }
1531 defer googleapi.CloseBody(res)
1532 if err := googleapi.CheckResponse(res); err != nil {
1533 return nil, gensupport.WrapError(err)
1534 }
1535 ret := &Operation{
1536 ServerResponse: googleapi.ServerResponse{
1537 Header: res.Header,
1538 HTTPStatusCode: res.StatusCode,
1539 },
1540 }
1541 target := &ret
1542 if err := gensupport.DecodeResponse(target, res); err != nil {
1543 return nil, err
1544 }
1545 return ret, nil
1546 }
1547
1548 type ProjectsLocationsNodesGetCall struct {
1549 s *Service
1550 name string
1551 urlParams_ gensupport.URLParams
1552 ifNoneMatch_ string
1553 ctx_ context.Context
1554 header_ http.Header
1555 }
1556
1557
1558
1559
1560 func (r *ProjectsLocationsNodesService) Get(name string) *ProjectsLocationsNodesGetCall {
1561 c := &ProjectsLocationsNodesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1562 c.name = name
1563 return c
1564 }
1565
1566
1567
1568
1569 func (c *ProjectsLocationsNodesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesGetCall {
1570 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1571 return c
1572 }
1573
1574
1575
1576
1577 func (c *ProjectsLocationsNodesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesGetCall {
1578 c.ifNoneMatch_ = entityTag
1579 return c
1580 }
1581
1582
1583 func (c *ProjectsLocationsNodesGetCall) Context(ctx context.Context) *ProjectsLocationsNodesGetCall {
1584 c.ctx_ = ctx
1585 return c
1586 }
1587
1588
1589
1590 func (c *ProjectsLocationsNodesGetCall) Header() http.Header {
1591 if c.header_ == nil {
1592 c.header_ = make(http.Header)
1593 }
1594 return c.header_
1595 }
1596
1597 func (c *ProjectsLocationsNodesGetCall) doRequest(alt string) (*http.Response, error) {
1598 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1599 if c.ifNoneMatch_ != "" {
1600 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1601 }
1602 var body io.Reader = nil
1603 c.urlParams_.Set("alt", alt)
1604 c.urlParams_.Set("prettyPrint", "false")
1605 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1606 urls += "?" + c.urlParams_.Encode()
1607 req, err := http.NewRequest("GET", urls, body)
1608 if err != nil {
1609 return nil, err
1610 }
1611 req.Header = reqHeaders
1612 googleapi.Expand(req.URL, map[string]string{
1613 "name": c.name,
1614 })
1615 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1616 }
1617
1618
1619
1620
1621
1622
1623 func (c *ProjectsLocationsNodesGetCall) Do(opts ...googleapi.CallOption) (*Node, error) {
1624 gensupport.SetOptions(c.urlParams_, opts...)
1625 res, err := c.doRequest("json")
1626 if res != nil && res.StatusCode == http.StatusNotModified {
1627 if res.Body != nil {
1628 res.Body.Close()
1629 }
1630 return nil, gensupport.WrapError(&googleapi.Error{
1631 Code: res.StatusCode,
1632 Header: res.Header,
1633 })
1634 }
1635 if err != nil {
1636 return nil, err
1637 }
1638 defer googleapi.CloseBody(res)
1639 if err := googleapi.CheckResponse(res); err != nil {
1640 return nil, gensupport.WrapError(err)
1641 }
1642 ret := &Node{
1643 ServerResponse: googleapi.ServerResponse{
1644 Header: res.Header,
1645 HTTPStatusCode: res.StatusCode,
1646 },
1647 }
1648 target := &ret
1649 if err := gensupport.DecodeResponse(target, res); err != nil {
1650 return nil, err
1651 }
1652 return ret, nil
1653 }
1654
1655 type ProjectsLocationsNodesListCall struct {
1656 s *Service
1657 parent string
1658 urlParams_ gensupport.URLParams
1659 ifNoneMatch_ string
1660 ctx_ context.Context
1661 header_ http.Header
1662 }
1663
1664
1665
1666
1667 func (r *ProjectsLocationsNodesService) List(parent string) *ProjectsLocationsNodesListCall {
1668 c := &ProjectsLocationsNodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1669 c.parent = parent
1670 return c
1671 }
1672
1673
1674
1675 func (c *ProjectsLocationsNodesListCall) PageSize(pageSize int64) *ProjectsLocationsNodesListCall {
1676 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1677 return c
1678 }
1679
1680
1681
1682 func (c *ProjectsLocationsNodesListCall) PageToken(pageToken string) *ProjectsLocationsNodesListCall {
1683 c.urlParams_.Set("pageToken", pageToken)
1684 return c
1685 }
1686
1687
1688
1689
1690 func (c *ProjectsLocationsNodesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesListCall {
1691 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1692 return c
1693 }
1694
1695
1696
1697
1698 func (c *ProjectsLocationsNodesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesListCall {
1699 c.ifNoneMatch_ = entityTag
1700 return c
1701 }
1702
1703
1704 func (c *ProjectsLocationsNodesListCall) Context(ctx context.Context) *ProjectsLocationsNodesListCall {
1705 c.ctx_ = ctx
1706 return c
1707 }
1708
1709
1710
1711 func (c *ProjectsLocationsNodesListCall) Header() http.Header {
1712 if c.header_ == nil {
1713 c.header_ = make(http.Header)
1714 }
1715 return c.header_
1716 }
1717
1718 func (c *ProjectsLocationsNodesListCall) doRequest(alt string) (*http.Response, error) {
1719 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1720 if c.ifNoneMatch_ != "" {
1721 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1722 }
1723 var body io.Reader = nil
1724 c.urlParams_.Set("alt", alt)
1725 c.urlParams_.Set("prettyPrint", "false")
1726 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/nodes")
1727 urls += "?" + c.urlParams_.Encode()
1728 req, err := http.NewRequest("GET", urls, body)
1729 if err != nil {
1730 return nil, err
1731 }
1732 req.Header = reqHeaders
1733 googleapi.Expand(req.URL, map[string]string{
1734 "parent": c.parent,
1735 })
1736 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1737 }
1738
1739
1740
1741
1742
1743
1744
1745 func (c *ProjectsLocationsNodesListCall) Do(opts ...googleapi.CallOption) (*ListNodesResponse, error) {
1746 gensupport.SetOptions(c.urlParams_, opts...)
1747 res, err := c.doRequest("json")
1748 if res != nil && res.StatusCode == http.StatusNotModified {
1749 if res.Body != nil {
1750 res.Body.Close()
1751 }
1752 return nil, gensupport.WrapError(&googleapi.Error{
1753 Code: res.StatusCode,
1754 Header: res.Header,
1755 })
1756 }
1757 if err != nil {
1758 return nil, err
1759 }
1760 defer googleapi.CloseBody(res)
1761 if err := googleapi.CheckResponse(res); err != nil {
1762 return nil, gensupport.WrapError(err)
1763 }
1764 ret := &ListNodesResponse{
1765 ServerResponse: googleapi.ServerResponse{
1766 Header: res.Header,
1767 HTTPStatusCode: res.StatusCode,
1768 },
1769 }
1770 target := &ret
1771 if err := gensupport.DecodeResponse(target, res); err != nil {
1772 return nil, err
1773 }
1774 return ret, nil
1775 }
1776
1777
1778
1779
1780 func (c *ProjectsLocationsNodesListCall) Pages(ctx context.Context, f func(*ListNodesResponse) error) error {
1781 c.ctx_ = ctx
1782 defer c.PageToken(c.urlParams_.Get("pageToken"))
1783 for {
1784 x, err := c.Do()
1785 if err != nil {
1786 return err
1787 }
1788 if err := f(x); err != nil {
1789 return err
1790 }
1791 if x.NextPageToken == "" {
1792 return nil
1793 }
1794 c.PageToken(x.NextPageToken)
1795 }
1796 }
1797
1798 type ProjectsLocationsNodesReimageCall struct {
1799 s *Service
1800 name string
1801 reimagenoderequest *ReimageNodeRequest
1802 urlParams_ gensupport.URLParams
1803 ctx_ context.Context
1804 header_ http.Header
1805 }
1806
1807
1808
1809
1810 func (r *ProjectsLocationsNodesService) Reimage(name string, reimagenoderequest *ReimageNodeRequest) *ProjectsLocationsNodesReimageCall {
1811 c := &ProjectsLocationsNodesReimageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1812 c.name = name
1813 c.reimagenoderequest = reimagenoderequest
1814 return c
1815 }
1816
1817
1818
1819
1820 func (c *ProjectsLocationsNodesReimageCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesReimageCall {
1821 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1822 return c
1823 }
1824
1825
1826 func (c *ProjectsLocationsNodesReimageCall) Context(ctx context.Context) *ProjectsLocationsNodesReimageCall {
1827 c.ctx_ = ctx
1828 return c
1829 }
1830
1831
1832
1833 func (c *ProjectsLocationsNodesReimageCall) Header() http.Header {
1834 if c.header_ == nil {
1835 c.header_ = make(http.Header)
1836 }
1837 return c.header_
1838 }
1839
1840 func (c *ProjectsLocationsNodesReimageCall) doRequest(alt string) (*http.Response, error) {
1841 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1842 var body io.Reader = nil
1843 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reimagenoderequest)
1844 if err != nil {
1845 return nil, err
1846 }
1847 c.urlParams_.Set("alt", alt)
1848 c.urlParams_.Set("prettyPrint", "false")
1849 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reimage")
1850 urls += "?" + c.urlParams_.Encode()
1851 req, err := http.NewRequest("POST", urls, body)
1852 if err != nil {
1853 return nil, err
1854 }
1855 req.Header = reqHeaders
1856 googleapi.Expand(req.URL, map[string]string{
1857 "name": c.name,
1858 })
1859 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1860 }
1861
1862
1863
1864
1865
1866
1867 func (c *ProjectsLocationsNodesReimageCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1868 gensupport.SetOptions(c.urlParams_, opts...)
1869 res, err := c.doRequest("json")
1870 if res != nil && res.StatusCode == http.StatusNotModified {
1871 if res.Body != nil {
1872 res.Body.Close()
1873 }
1874 return nil, gensupport.WrapError(&googleapi.Error{
1875 Code: res.StatusCode,
1876 Header: res.Header,
1877 })
1878 }
1879 if err != nil {
1880 return nil, err
1881 }
1882 defer googleapi.CloseBody(res)
1883 if err := googleapi.CheckResponse(res); err != nil {
1884 return nil, gensupport.WrapError(err)
1885 }
1886 ret := &Operation{
1887 ServerResponse: googleapi.ServerResponse{
1888 Header: res.Header,
1889 HTTPStatusCode: res.StatusCode,
1890 },
1891 }
1892 target := &ret
1893 if err := gensupport.DecodeResponse(target, res); err != nil {
1894 return nil, err
1895 }
1896 return ret, nil
1897 }
1898
1899 type ProjectsLocationsNodesStartCall struct {
1900 s *Service
1901 name string
1902 startnoderequest *StartNodeRequest
1903 urlParams_ gensupport.URLParams
1904 ctx_ context.Context
1905 header_ http.Header
1906 }
1907
1908
1909
1910
1911 func (r *ProjectsLocationsNodesService) Start(name string, startnoderequest *StartNodeRequest) *ProjectsLocationsNodesStartCall {
1912 c := &ProjectsLocationsNodesStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1913 c.name = name
1914 c.startnoderequest = startnoderequest
1915 return c
1916 }
1917
1918
1919
1920
1921 func (c *ProjectsLocationsNodesStartCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStartCall {
1922 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1923 return c
1924 }
1925
1926
1927 func (c *ProjectsLocationsNodesStartCall) Context(ctx context.Context) *ProjectsLocationsNodesStartCall {
1928 c.ctx_ = ctx
1929 return c
1930 }
1931
1932
1933
1934 func (c *ProjectsLocationsNodesStartCall) Header() http.Header {
1935 if c.header_ == nil {
1936 c.header_ = make(http.Header)
1937 }
1938 return c.header_
1939 }
1940
1941 func (c *ProjectsLocationsNodesStartCall) doRequest(alt string) (*http.Response, error) {
1942 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1943 var body io.Reader = nil
1944 body, err := googleapi.WithoutDataWrapper.JSONReader(c.startnoderequest)
1945 if err != nil {
1946 return nil, err
1947 }
1948 c.urlParams_.Set("alt", alt)
1949 c.urlParams_.Set("prettyPrint", "false")
1950 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:start")
1951 urls += "?" + c.urlParams_.Encode()
1952 req, err := http.NewRequest("POST", urls, body)
1953 if err != nil {
1954 return nil, err
1955 }
1956 req.Header = reqHeaders
1957 googleapi.Expand(req.URL, map[string]string{
1958 "name": c.name,
1959 })
1960 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1961 }
1962
1963
1964
1965
1966
1967
1968 func (c *ProjectsLocationsNodesStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1969 gensupport.SetOptions(c.urlParams_, opts...)
1970 res, err := c.doRequest("json")
1971 if res != nil && res.StatusCode == http.StatusNotModified {
1972 if res.Body != nil {
1973 res.Body.Close()
1974 }
1975 return nil, gensupport.WrapError(&googleapi.Error{
1976 Code: res.StatusCode,
1977 Header: res.Header,
1978 })
1979 }
1980 if err != nil {
1981 return nil, err
1982 }
1983 defer googleapi.CloseBody(res)
1984 if err := googleapi.CheckResponse(res); err != nil {
1985 return nil, gensupport.WrapError(err)
1986 }
1987 ret := &Operation{
1988 ServerResponse: googleapi.ServerResponse{
1989 Header: res.Header,
1990 HTTPStatusCode: res.StatusCode,
1991 },
1992 }
1993 target := &ret
1994 if err := gensupport.DecodeResponse(target, res); err != nil {
1995 return nil, err
1996 }
1997 return ret, nil
1998 }
1999
2000 type ProjectsLocationsNodesStopCall struct {
2001 s *Service
2002 name string
2003 stopnoderequest *StopNodeRequest
2004 urlParams_ gensupport.URLParams
2005 ctx_ context.Context
2006 header_ http.Header
2007 }
2008
2009
2010
2011
2012 func (r *ProjectsLocationsNodesService) Stop(name string, stopnoderequest *StopNodeRequest) *ProjectsLocationsNodesStopCall {
2013 c := &ProjectsLocationsNodesStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2014 c.name = name
2015 c.stopnoderequest = stopnoderequest
2016 return c
2017 }
2018
2019
2020
2021
2022 func (c *ProjectsLocationsNodesStopCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStopCall {
2023 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2024 return c
2025 }
2026
2027
2028 func (c *ProjectsLocationsNodesStopCall) Context(ctx context.Context) *ProjectsLocationsNodesStopCall {
2029 c.ctx_ = ctx
2030 return c
2031 }
2032
2033
2034
2035 func (c *ProjectsLocationsNodesStopCall) Header() http.Header {
2036 if c.header_ == nil {
2037 c.header_ = make(http.Header)
2038 }
2039 return c.header_
2040 }
2041
2042 func (c *ProjectsLocationsNodesStopCall) doRequest(alt string) (*http.Response, error) {
2043 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2044 var body io.Reader = nil
2045 body, err := googleapi.WithoutDataWrapper.JSONReader(c.stopnoderequest)
2046 if err != nil {
2047 return nil, err
2048 }
2049 c.urlParams_.Set("alt", alt)
2050 c.urlParams_.Set("prettyPrint", "false")
2051 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:stop")
2052 urls += "?" + c.urlParams_.Encode()
2053 req, err := http.NewRequest("POST", urls, body)
2054 if err != nil {
2055 return nil, err
2056 }
2057 req.Header = reqHeaders
2058 googleapi.Expand(req.URL, map[string]string{
2059 "name": c.name,
2060 })
2061 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2062 }
2063
2064
2065
2066
2067
2068
2069 func (c *ProjectsLocationsNodesStopCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2070 gensupport.SetOptions(c.urlParams_, opts...)
2071 res, err := c.doRequest("json")
2072 if res != nil && res.StatusCode == http.StatusNotModified {
2073 if res.Body != nil {
2074 res.Body.Close()
2075 }
2076 return nil, gensupport.WrapError(&googleapi.Error{
2077 Code: res.StatusCode,
2078 Header: res.Header,
2079 })
2080 }
2081 if err != nil {
2082 return nil, err
2083 }
2084 defer googleapi.CloseBody(res)
2085 if err := googleapi.CheckResponse(res); err != nil {
2086 return nil, gensupport.WrapError(err)
2087 }
2088 ret := &Operation{
2089 ServerResponse: googleapi.ServerResponse{
2090 Header: res.Header,
2091 HTTPStatusCode: res.StatusCode,
2092 },
2093 }
2094 target := &ret
2095 if err := gensupport.DecodeResponse(target, res); err != nil {
2096 return nil, err
2097 }
2098 return ret, nil
2099 }
2100
2101 type ProjectsLocationsOperationsCancelCall struct {
2102 s *Service
2103 name string
2104 urlParams_ gensupport.URLParams
2105 ctx_ context.Context
2106 header_ http.Header
2107 }
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120 func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall {
2121 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2122 c.name = name
2123 return c
2124 }
2125
2126
2127
2128
2129 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
2130 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2131 return c
2132 }
2133
2134
2135 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
2136 c.ctx_ = ctx
2137 return c
2138 }
2139
2140
2141
2142 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
2143 if c.header_ == nil {
2144 c.header_ = make(http.Header)
2145 }
2146 return c.header_
2147 }
2148
2149 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
2150 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2151 var body io.Reader = nil
2152 c.urlParams_.Set("alt", alt)
2153 c.urlParams_.Set("prettyPrint", "false")
2154 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
2155 urls += "?" + c.urlParams_.Encode()
2156 req, err := http.NewRequest("POST", urls, body)
2157 if err != nil {
2158 return nil, err
2159 }
2160 req.Header = reqHeaders
2161 googleapi.Expand(req.URL, map[string]string{
2162 "name": c.name,
2163 })
2164 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2165 }
2166
2167
2168
2169
2170
2171
2172 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2173 gensupport.SetOptions(c.urlParams_, opts...)
2174 res, err := c.doRequest("json")
2175 if res != nil && res.StatusCode == http.StatusNotModified {
2176 if res.Body != nil {
2177 res.Body.Close()
2178 }
2179 return nil, gensupport.WrapError(&googleapi.Error{
2180 Code: res.StatusCode,
2181 Header: res.Header,
2182 })
2183 }
2184 if err != nil {
2185 return nil, err
2186 }
2187 defer googleapi.CloseBody(res)
2188 if err := googleapi.CheckResponse(res); err != nil {
2189 return nil, gensupport.WrapError(err)
2190 }
2191 ret := &Empty{
2192 ServerResponse: googleapi.ServerResponse{
2193 Header: res.Header,
2194 HTTPStatusCode: res.StatusCode,
2195 },
2196 }
2197 target := &ret
2198 if err := gensupport.DecodeResponse(target, res); err != nil {
2199 return nil, err
2200 }
2201 return ret, nil
2202 }
2203
2204 type ProjectsLocationsOperationsDeleteCall struct {
2205 s *Service
2206 name string
2207 urlParams_ gensupport.URLParams
2208 ctx_ context.Context
2209 header_ http.Header
2210 }
2211
2212
2213
2214
2215
2216
2217
2218 func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
2219 c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2220 c.name = name
2221 return c
2222 }
2223
2224
2225
2226
2227 func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
2228 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2229 return c
2230 }
2231
2232
2233 func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
2234 c.ctx_ = ctx
2235 return c
2236 }
2237
2238
2239
2240 func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
2241 if c.header_ == nil {
2242 c.header_ = make(http.Header)
2243 }
2244 return c.header_
2245 }
2246
2247 func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
2248 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2249 var body io.Reader = nil
2250 c.urlParams_.Set("alt", alt)
2251 c.urlParams_.Set("prettyPrint", "false")
2252 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2253 urls += "?" + c.urlParams_.Encode()
2254 req, err := http.NewRequest("DELETE", urls, body)
2255 if err != nil {
2256 return nil, err
2257 }
2258 req.Header = reqHeaders
2259 googleapi.Expand(req.URL, map[string]string{
2260 "name": c.name,
2261 })
2262 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2263 }
2264
2265
2266
2267
2268
2269
2270 func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2271 gensupport.SetOptions(c.urlParams_, opts...)
2272 res, err := c.doRequest("json")
2273 if res != nil && res.StatusCode == http.StatusNotModified {
2274 if res.Body != nil {
2275 res.Body.Close()
2276 }
2277 return nil, gensupport.WrapError(&googleapi.Error{
2278 Code: res.StatusCode,
2279 Header: res.Header,
2280 })
2281 }
2282 if err != nil {
2283 return nil, err
2284 }
2285 defer googleapi.CloseBody(res)
2286 if err := googleapi.CheckResponse(res); err != nil {
2287 return nil, gensupport.WrapError(err)
2288 }
2289 ret := &Empty{
2290 ServerResponse: googleapi.ServerResponse{
2291 Header: res.Header,
2292 HTTPStatusCode: res.StatusCode,
2293 },
2294 }
2295 target := &ret
2296 if err := gensupport.DecodeResponse(target, res); err != nil {
2297 return nil, err
2298 }
2299 return ret, nil
2300 }
2301
2302 type ProjectsLocationsOperationsGetCall struct {
2303 s *Service
2304 name string
2305 urlParams_ gensupport.URLParams
2306 ifNoneMatch_ string
2307 ctx_ context.Context
2308 header_ http.Header
2309 }
2310
2311
2312
2313
2314
2315
2316 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
2317 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2318 c.name = name
2319 return c
2320 }
2321
2322
2323
2324
2325 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
2326 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2327 return c
2328 }
2329
2330
2331
2332
2333 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
2334 c.ifNoneMatch_ = entityTag
2335 return c
2336 }
2337
2338
2339 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
2340 c.ctx_ = ctx
2341 return c
2342 }
2343
2344
2345
2346 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
2347 if c.header_ == nil {
2348 c.header_ = make(http.Header)
2349 }
2350 return c.header_
2351 }
2352
2353 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
2354 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2355 if c.ifNoneMatch_ != "" {
2356 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2357 }
2358 var body io.Reader = nil
2359 c.urlParams_.Set("alt", alt)
2360 c.urlParams_.Set("prettyPrint", "false")
2361 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2362 urls += "?" + c.urlParams_.Encode()
2363 req, err := http.NewRequest("GET", urls, body)
2364 if err != nil {
2365 return nil, err
2366 }
2367 req.Header = reqHeaders
2368 googleapi.Expand(req.URL, map[string]string{
2369 "name": c.name,
2370 })
2371 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2372 }
2373
2374
2375
2376
2377
2378
2379 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2380 gensupport.SetOptions(c.urlParams_, opts...)
2381 res, err := c.doRequest("json")
2382 if res != nil && res.StatusCode == http.StatusNotModified {
2383 if res.Body != nil {
2384 res.Body.Close()
2385 }
2386 return nil, gensupport.WrapError(&googleapi.Error{
2387 Code: res.StatusCode,
2388 Header: res.Header,
2389 })
2390 }
2391 if err != nil {
2392 return nil, err
2393 }
2394 defer googleapi.CloseBody(res)
2395 if err := googleapi.CheckResponse(res); err != nil {
2396 return nil, gensupport.WrapError(err)
2397 }
2398 ret := &Operation{
2399 ServerResponse: googleapi.ServerResponse{
2400 Header: res.Header,
2401 HTTPStatusCode: res.StatusCode,
2402 },
2403 }
2404 target := &ret
2405 if err := gensupport.DecodeResponse(target, res); err != nil {
2406 return nil, err
2407 }
2408 return ret, nil
2409 }
2410
2411 type ProjectsLocationsOperationsListCall struct {
2412 s *Service
2413 name string
2414 urlParams_ gensupport.URLParams
2415 ifNoneMatch_ string
2416 ctx_ context.Context
2417 header_ http.Header
2418 }
2419
2420
2421
2422
2423
2424 func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
2425 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2426 c.name = name
2427 return c
2428 }
2429
2430
2431 func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
2432 c.urlParams_.Set("filter", filter)
2433 return c
2434 }
2435
2436
2437
2438 func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
2439 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2440 return c
2441 }
2442
2443
2444
2445 func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
2446 c.urlParams_.Set("pageToken", pageToken)
2447 return c
2448 }
2449
2450
2451
2452
2453 func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
2454 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2455 return c
2456 }
2457
2458
2459
2460
2461 func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
2462 c.ifNoneMatch_ = entityTag
2463 return c
2464 }
2465
2466
2467 func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
2468 c.ctx_ = ctx
2469 return c
2470 }
2471
2472
2473
2474 func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
2475 if c.header_ == nil {
2476 c.header_ = make(http.Header)
2477 }
2478 return c.header_
2479 }
2480
2481 func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
2482 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2483 if c.ifNoneMatch_ != "" {
2484 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2485 }
2486 var body io.Reader = nil
2487 c.urlParams_.Set("alt", alt)
2488 c.urlParams_.Set("prettyPrint", "false")
2489 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
2490 urls += "?" + c.urlParams_.Encode()
2491 req, err := http.NewRequest("GET", urls, body)
2492 if err != nil {
2493 return nil, err
2494 }
2495 req.Header = reqHeaders
2496 googleapi.Expand(req.URL, map[string]string{
2497 "name": c.name,
2498 })
2499 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2500 }
2501
2502
2503
2504
2505
2506
2507
2508 func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
2509 gensupport.SetOptions(c.urlParams_, opts...)
2510 res, err := c.doRequest("json")
2511 if res != nil && res.StatusCode == http.StatusNotModified {
2512 if res.Body != nil {
2513 res.Body.Close()
2514 }
2515 return nil, gensupport.WrapError(&googleapi.Error{
2516 Code: res.StatusCode,
2517 Header: res.Header,
2518 })
2519 }
2520 if err != nil {
2521 return nil, err
2522 }
2523 defer googleapi.CloseBody(res)
2524 if err := googleapi.CheckResponse(res); err != nil {
2525 return nil, gensupport.WrapError(err)
2526 }
2527 ret := &ListOperationsResponse{
2528 ServerResponse: googleapi.ServerResponse{
2529 Header: res.Header,
2530 HTTPStatusCode: res.StatusCode,
2531 },
2532 }
2533 target := &ret
2534 if err := gensupport.DecodeResponse(target, res); err != nil {
2535 return nil, err
2536 }
2537 return ret, nil
2538 }
2539
2540
2541
2542
2543 func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
2544 c.ctx_ = ctx
2545 defer c.PageToken(c.urlParams_.Get("pageToken"))
2546 for {
2547 x, err := c.Do()
2548 if err != nil {
2549 return err
2550 }
2551 if err := f(x); err != nil {
2552 return err
2553 }
2554 if x.NextPageToken == "" {
2555 return nil
2556 }
2557 c.PageToken(x.NextPageToken)
2558 }
2559 }
2560
2561 type ProjectsLocationsTensorflowVersionsGetCall struct {
2562 s *Service
2563 name string
2564 urlParams_ gensupport.URLParams
2565 ifNoneMatch_ string
2566 ctx_ context.Context
2567 header_ http.Header
2568 }
2569
2570
2571
2572
2573 func (r *ProjectsLocationsTensorflowVersionsService) Get(name string) *ProjectsLocationsTensorflowVersionsGetCall {
2574 c := &ProjectsLocationsTensorflowVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2575 c.name = name
2576 return c
2577 }
2578
2579
2580
2581
2582 func (c *ProjectsLocationsTensorflowVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsGetCall {
2583 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2584 return c
2585 }
2586
2587
2588
2589
2590 func (c *ProjectsLocationsTensorflowVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsGetCall {
2591 c.ifNoneMatch_ = entityTag
2592 return c
2593 }
2594
2595
2596 func (c *ProjectsLocationsTensorflowVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsGetCall {
2597 c.ctx_ = ctx
2598 return c
2599 }
2600
2601
2602
2603 func (c *ProjectsLocationsTensorflowVersionsGetCall) Header() http.Header {
2604 if c.header_ == nil {
2605 c.header_ = make(http.Header)
2606 }
2607 return c.header_
2608 }
2609
2610 func (c *ProjectsLocationsTensorflowVersionsGetCall) doRequest(alt string) (*http.Response, error) {
2611 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2612 if c.ifNoneMatch_ != "" {
2613 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2614 }
2615 var body io.Reader = nil
2616 c.urlParams_.Set("alt", alt)
2617 c.urlParams_.Set("prettyPrint", "false")
2618 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
2619 urls += "?" + c.urlParams_.Encode()
2620 req, err := http.NewRequest("GET", urls, body)
2621 if err != nil {
2622 return nil, err
2623 }
2624 req.Header = reqHeaders
2625 googleapi.Expand(req.URL, map[string]string{
2626 "name": c.name,
2627 })
2628 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2629 }
2630
2631
2632
2633
2634
2635
2636
2637 func (c *ProjectsLocationsTensorflowVersionsGetCall) Do(opts ...googleapi.CallOption) (*TensorFlowVersion, error) {
2638 gensupport.SetOptions(c.urlParams_, opts...)
2639 res, err := c.doRequest("json")
2640 if res != nil && res.StatusCode == http.StatusNotModified {
2641 if res.Body != nil {
2642 res.Body.Close()
2643 }
2644 return nil, gensupport.WrapError(&googleapi.Error{
2645 Code: res.StatusCode,
2646 Header: res.Header,
2647 })
2648 }
2649 if err != nil {
2650 return nil, err
2651 }
2652 defer googleapi.CloseBody(res)
2653 if err := googleapi.CheckResponse(res); err != nil {
2654 return nil, gensupport.WrapError(err)
2655 }
2656 ret := &TensorFlowVersion{
2657 ServerResponse: googleapi.ServerResponse{
2658 Header: res.Header,
2659 HTTPStatusCode: res.StatusCode,
2660 },
2661 }
2662 target := &ret
2663 if err := gensupport.DecodeResponse(target, res); err != nil {
2664 return nil, err
2665 }
2666 return ret, nil
2667 }
2668
2669 type ProjectsLocationsTensorflowVersionsListCall struct {
2670 s *Service
2671 parent string
2672 urlParams_ gensupport.URLParams
2673 ifNoneMatch_ string
2674 ctx_ context.Context
2675 header_ http.Header
2676 }
2677
2678
2679
2680
2681 func (r *ProjectsLocationsTensorflowVersionsService) List(parent string) *ProjectsLocationsTensorflowVersionsListCall {
2682 c := &ProjectsLocationsTensorflowVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2683 c.parent = parent
2684 return c
2685 }
2686
2687
2688 func (c *ProjectsLocationsTensorflowVersionsListCall) Filter(filter string) *ProjectsLocationsTensorflowVersionsListCall {
2689 c.urlParams_.Set("filter", filter)
2690 return c
2691 }
2692
2693
2694 func (c *ProjectsLocationsTensorflowVersionsListCall) OrderBy(orderBy string) *ProjectsLocationsTensorflowVersionsListCall {
2695 c.urlParams_.Set("orderBy", orderBy)
2696 return c
2697 }
2698
2699
2700
2701 func (c *ProjectsLocationsTensorflowVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsTensorflowVersionsListCall {
2702 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2703 return c
2704 }
2705
2706
2707
2708 func (c *ProjectsLocationsTensorflowVersionsListCall) PageToken(pageToken string) *ProjectsLocationsTensorflowVersionsListCall {
2709 c.urlParams_.Set("pageToken", pageToken)
2710 return c
2711 }
2712
2713
2714
2715
2716 func (c *ProjectsLocationsTensorflowVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsListCall {
2717 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2718 return c
2719 }
2720
2721
2722
2723
2724 func (c *ProjectsLocationsTensorflowVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsListCall {
2725 c.ifNoneMatch_ = entityTag
2726 return c
2727 }
2728
2729
2730 func (c *ProjectsLocationsTensorflowVersionsListCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsListCall {
2731 c.ctx_ = ctx
2732 return c
2733 }
2734
2735
2736
2737 func (c *ProjectsLocationsTensorflowVersionsListCall) Header() http.Header {
2738 if c.header_ == nil {
2739 c.header_ = make(http.Header)
2740 }
2741 return c.header_
2742 }
2743
2744 func (c *ProjectsLocationsTensorflowVersionsListCall) doRequest(alt string) (*http.Response, error) {
2745 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2746 if c.ifNoneMatch_ != "" {
2747 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2748 }
2749 var body io.Reader = nil
2750 c.urlParams_.Set("alt", alt)
2751 c.urlParams_.Set("prettyPrint", "false")
2752 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/tensorflowVersions")
2753 urls += "?" + c.urlParams_.Encode()
2754 req, err := http.NewRequest("GET", urls, body)
2755 if err != nil {
2756 return nil, err
2757 }
2758 req.Header = reqHeaders
2759 googleapi.Expand(req.URL, map[string]string{
2760 "parent": c.parent,
2761 })
2762 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2763 }
2764
2765
2766
2767
2768
2769
2770
2771 func (c *ProjectsLocationsTensorflowVersionsListCall) Do(opts ...googleapi.CallOption) (*ListTensorFlowVersionsResponse, error) {
2772 gensupport.SetOptions(c.urlParams_, opts...)
2773 res, err := c.doRequest("json")
2774 if res != nil && res.StatusCode == http.StatusNotModified {
2775 if res.Body != nil {
2776 res.Body.Close()
2777 }
2778 return nil, gensupport.WrapError(&googleapi.Error{
2779 Code: res.StatusCode,
2780 Header: res.Header,
2781 })
2782 }
2783 if err != nil {
2784 return nil, err
2785 }
2786 defer googleapi.CloseBody(res)
2787 if err := googleapi.CheckResponse(res); err != nil {
2788 return nil, gensupport.WrapError(err)
2789 }
2790 ret := &ListTensorFlowVersionsResponse{
2791 ServerResponse: googleapi.ServerResponse{
2792 Header: res.Header,
2793 HTTPStatusCode: res.StatusCode,
2794 },
2795 }
2796 target := &ret
2797 if err := gensupport.DecodeResponse(target, res); err != nil {
2798 return nil, err
2799 }
2800 return ret, nil
2801 }
2802
2803
2804
2805
2806 func (c *ProjectsLocationsTensorflowVersionsListCall) Pages(ctx context.Context, f func(*ListTensorFlowVersionsResponse) error) error {
2807 c.ctx_ = ctx
2808 defer c.PageToken(c.urlParams_.Get("pageToken"))
2809 for {
2810 x, err := c.Do()
2811 if err != nil {
2812 return err
2813 }
2814 if err := f(x); err != nil {
2815 return err
2816 }
2817 if x.NextPageToken == "" {
2818 return nil
2819 }
2820 c.PageToken(x.NextPageToken)
2821 }
2822 }
2823
View as plain text