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 cloudshell
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 = "cloudshell:v1"
90 const apiName = "cloudshell"
91 const apiVersion = "v1"
92 const basePath = "https://cloudshell.googleapis.com/"
93 const basePathTemplate = "https://cloudshell.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://cloudshell.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.Operations = NewOperationsService(s)
139 s.Users = NewUsersService(s)
140 return s, nil
141 }
142
143 type Service struct {
144 client *http.Client
145 BasePath string
146 UserAgent string
147
148 Operations *OperationsService
149
150 Users *UsersService
151 }
152
153 func (s *Service) userAgent() string {
154 if s.UserAgent == "" {
155 return googleapi.UserAgent
156 }
157 return googleapi.UserAgent + " " + s.UserAgent
158 }
159
160 func NewOperationsService(s *Service) *OperationsService {
161 rs := &OperationsService{s: s}
162 return rs
163 }
164
165 type OperationsService struct {
166 s *Service
167 }
168
169 func NewUsersService(s *Service) *UsersService {
170 rs := &UsersService{s: s}
171 rs.Environments = NewUsersEnvironmentsService(s)
172 return rs
173 }
174
175 type UsersService struct {
176 s *Service
177
178 Environments *UsersEnvironmentsService
179 }
180
181 func NewUsersEnvironmentsService(s *Service) *UsersEnvironmentsService {
182 rs := &UsersEnvironmentsService{s: s}
183 return rs
184 }
185
186 type UsersEnvironmentsService struct {
187 s *Service
188 }
189
190
191
192 type AddPublicKeyMetadata struct {
193 }
194
195
196 type AddPublicKeyRequest struct {
197
198
199
200
201
202 Key string `json:"key,omitempty"`
203
204
205
206
207
208 ForceSendFields []string `json:"-"`
209
210
211
212
213 NullFields []string `json:"-"`
214 }
215
216 func (s *AddPublicKeyRequest) MarshalJSON() ([]byte, error) {
217 type NoMethod AddPublicKeyRequest
218 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
219 }
220
221
222 type AddPublicKeyResponse struct {
223
224 Key string `json:"key,omitempty"`
225
226
227
228
229
230 ForceSendFields []string `json:"-"`
231
232
233
234
235 NullFields []string `json:"-"`
236 }
237
238 func (s *AddPublicKeyResponse) MarshalJSON() ([]byte, error) {
239 type NoMethod AddPublicKeyResponse
240 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
241 }
242
243
244
245 type AuthorizeEnvironmentMetadata struct {
246 }
247
248
249 type AuthorizeEnvironmentRequest struct {
250
251 AccessToken string `json:"accessToken,omitempty"`
252
253
254 ExpireTime string `json:"expireTime,omitempty"`
255
256 IdToken string `json:"idToken,omitempty"`
257
258
259
260
261
262 ForceSendFields []string `json:"-"`
263
264
265
266
267 NullFields []string `json:"-"`
268 }
269
270 func (s *AuthorizeEnvironmentRequest) MarshalJSON() ([]byte, error) {
271 type NoMethod AuthorizeEnvironmentRequest
272 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
273 }
274
275
276 type AuthorizeEnvironmentResponse struct {
277 }
278
279
280 type CancelOperationRequest struct {
281 }
282
283
284
285 type CreateEnvironmentMetadata struct {
286 }
287
288
289
290 type DeleteEnvironmentMetadata struct {
291 }
292
293
294
295
296
297 type Empty struct {
298
299 googleapi.ServerResponse `json:"-"`
300 }
301
302
303
304
305
306 type Environment struct {
307
308
309 DockerImage string `json:"dockerImage,omitempty"`
310
311
312 Id string `json:"id,omitempty"`
313
314
315
316
317
318 Name string `json:"name,omitempty"`
319
320
321
322
323
324 PublicKeys []string `json:"publicKeys,omitempty"`
325
326
327 SshHost string `json:"sshHost,omitempty"`
328
329
330 SshPort int64 `json:"sshPort,omitempty"`
331
332
333 SshUsername string `json:"sshUsername,omitempty"`
334
335
336
337
338
339
340
341
342
343
344
345
346 State string `json:"state,omitempty"`
347
348
349 WebHost string `json:"webHost,omitempty"`
350
351
352 googleapi.ServerResponse `json:"-"`
353
354
355
356
357
358 ForceSendFields []string `json:"-"`
359
360
361
362
363 NullFields []string `json:"-"`
364 }
365
366 func (s *Environment) MarshalJSON() ([]byte, error) {
367 type NoMethod Environment
368 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
369 }
370
371
372 type ListOperationsResponse struct {
373
374 NextPageToken string `json:"nextPageToken,omitempty"`
375
376
377 Operations []*Operation `json:"operations,omitempty"`
378
379
380 googleapi.ServerResponse `json:"-"`
381
382
383
384
385
386 ForceSendFields []string `json:"-"`
387
388
389
390
391 NullFields []string `json:"-"`
392 }
393
394 func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
395 type NoMethod ListOperationsResponse
396 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
397 }
398
399
400
401 type Operation struct {
402
403
404
405 Done bool `json:"done,omitempty"`
406
407 Error *Status `json:"error,omitempty"`
408
409
410
411
412 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
413
414
415
416 Name string `json:"name,omitempty"`
417
418
419
420
421
422
423
424 Response googleapi.RawMessage `json:"response,omitempty"`
425
426
427 googleapi.ServerResponse `json:"-"`
428
429
430
431
432
433 ForceSendFields []string `json:"-"`
434
435
436
437
438 NullFields []string `json:"-"`
439 }
440
441 func (s *Operation) MarshalJSON() ([]byte, error) {
442 type NoMethod Operation
443 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
444 }
445
446
447
448 type RemovePublicKeyMetadata struct {
449 }
450
451
452 type RemovePublicKeyRequest struct {
453
454 Key string `json:"key,omitempty"`
455
456
457
458
459
460 ForceSendFields []string `json:"-"`
461
462
463
464
465 NullFields []string `json:"-"`
466 }
467
468 func (s *RemovePublicKeyRequest) MarshalJSON() ([]byte, error) {
469 type NoMethod RemovePublicKeyRequest
470 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
471 }
472
473
474 type RemovePublicKeyResponse struct {
475 }
476
477
478
479 type StartEnvironmentMetadata struct {
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497 State string `json:"state,omitempty"`
498
499
500
501
502
503 ForceSendFields []string `json:"-"`
504
505
506
507
508 NullFields []string `json:"-"`
509 }
510
511 func (s *StartEnvironmentMetadata) MarshalJSON() ([]byte, error) {
512 type NoMethod StartEnvironmentMetadata
513 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
514 }
515
516
517 type StartEnvironmentRequest struct {
518
519
520
521
522 AccessToken string `json:"accessToken,omitempty"`
523
524
525 PublicKeys []string `json:"publicKeys,omitempty"`
526
527
528
529
530
531 ForceSendFields []string `json:"-"`
532
533
534
535
536 NullFields []string `json:"-"`
537 }
538
539 func (s *StartEnvironmentRequest) MarshalJSON() ([]byte, error) {
540 type NoMethod StartEnvironmentRequest
541 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
542 }
543
544
545
546 type StartEnvironmentResponse struct {
547
548 Environment *Environment `json:"environment,omitempty"`
549
550
551
552
553
554 ForceSendFields []string `json:"-"`
555
556
557
558
559 NullFields []string `json:"-"`
560 }
561
562 func (s *StartEnvironmentResponse) MarshalJSON() ([]byte, error) {
563 type NoMethod StartEnvironmentResponse
564 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
565 }
566
567
568
569
570
571
572
573 type Status struct {
574
575 Code int64 `json:"code,omitempty"`
576
577
578 Details []googleapi.RawMessage `json:"details,omitempty"`
579
580
581
582 Message string `json:"message,omitempty"`
583
584
585
586
587
588 ForceSendFields []string `json:"-"`
589
590
591
592
593 NullFields []string `json:"-"`
594 }
595
596 func (s *Status) MarshalJSON() ([]byte, error) {
597 type NoMethod Status
598 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
599 }
600
601 type OperationsCancelCall struct {
602 s *Service
603 name string
604 canceloperationrequest *CancelOperationRequest
605 urlParams_ gensupport.URLParams
606 ctx_ context.Context
607 header_ http.Header
608 }
609
610
611
612
613
614
615
616
617
618
619
620
621 func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
622 c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
623 c.name = name
624 c.canceloperationrequest = canceloperationrequest
625 return c
626 }
627
628
629
630
631 func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
632 c.urlParams_.Set("fields", googleapi.CombineFields(s))
633 return c
634 }
635
636
637 func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
638 c.ctx_ = ctx
639 return c
640 }
641
642
643
644 func (c *OperationsCancelCall) Header() http.Header {
645 if c.header_ == nil {
646 c.header_ = make(http.Header)
647 }
648 return c.header_
649 }
650
651 func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
652 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
653 var body io.Reader = nil
654 body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
655 if err != nil {
656 return nil, err
657 }
658 c.urlParams_.Set("alt", alt)
659 c.urlParams_.Set("prettyPrint", "false")
660 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
661 urls += "?" + c.urlParams_.Encode()
662 req, err := http.NewRequest("POST", urls, body)
663 if err != nil {
664 return nil, err
665 }
666 req.Header = reqHeaders
667 googleapi.Expand(req.URL, map[string]string{
668 "name": c.name,
669 })
670 return gensupport.SendRequest(c.ctx_, c.s.client, req)
671 }
672
673
674
675
676
677
678 func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
679 gensupport.SetOptions(c.urlParams_, opts...)
680 res, err := c.doRequest("json")
681 if res != nil && res.StatusCode == http.StatusNotModified {
682 if res.Body != nil {
683 res.Body.Close()
684 }
685 return nil, gensupport.WrapError(&googleapi.Error{
686 Code: res.StatusCode,
687 Header: res.Header,
688 })
689 }
690 if err != nil {
691 return nil, err
692 }
693 defer googleapi.CloseBody(res)
694 if err := googleapi.CheckResponse(res); err != nil {
695 return nil, gensupport.WrapError(err)
696 }
697 ret := &Empty{
698 ServerResponse: googleapi.ServerResponse{
699 Header: res.Header,
700 HTTPStatusCode: res.StatusCode,
701 },
702 }
703 target := &ret
704 if err := gensupport.DecodeResponse(target, res); err != nil {
705 return nil, err
706 }
707 return ret, nil
708 }
709
710 type OperationsDeleteCall struct {
711 s *Service
712 name string
713 urlParams_ gensupport.URLParams
714 ctx_ context.Context
715 header_ http.Header
716 }
717
718
719
720
721
722
723
724 func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
725 c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
726 c.name = name
727 return c
728 }
729
730
731
732
733 func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
734 c.urlParams_.Set("fields", googleapi.CombineFields(s))
735 return c
736 }
737
738
739 func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
740 c.ctx_ = ctx
741 return c
742 }
743
744
745
746 func (c *OperationsDeleteCall) Header() http.Header {
747 if c.header_ == nil {
748 c.header_ = make(http.Header)
749 }
750 return c.header_
751 }
752
753 func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
754 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
755 var body io.Reader = nil
756 c.urlParams_.Set("alt", alt)
757 c.urlParams_.Set("prettyPrint", "false")
758 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
759 urls += "?" + c.urlParams_.Encode()
760 req, err := http.NewRequest("DELETE", urls, body)
761 if err != nil {
762 return nil, err
763 }
764 req.Header = reqHeaders
765 googleapi.Expand(req.URL, map[string]string{
766 "name": c.name,
767 })
768 return gensupport.SendRequest(c.ctx_, c.s.client, req)
769 }
770
771
772
773
774
775
776 func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
777 gensupport.SetOptions(c.urlParams_, opts...)
778 res, err := c.doRequest("json")
779 if res != nil && res.StatusCode == http.StatusNotModified {
780 if res.Body != nil {
781 res.Body.Close()
782 }
783 return nil, gensupport.WrapError(&googleapi.Error{
784 Code: res.StatusCode,
785 Header: res.Header,
786 })
787 }
788 if err != nil {
789 return nil, err
790 }
791 defer googleapi.CloseBody(res)
792 if err := googleapi.CheckResponse(res); err != nil {
793 return nil, gensupport.WrapError(err)
794 }
795 ret := &Empty{
796 ServerResponse: googleapi.ServerResponse{
797 Header: res.Header,
798 HTTPStatusCode: res.StatusCode,
799 },
800 }
801 target := &ret
802 if err := gensupport.DecodeResponse(target, res); err != nil {
803 return nil, err
804 }
805 return ret, nil
806 }
807
808 type OperationsGetCall struct {
809 s *Service
810 name string
811 urlParams_ gensupport.URLParams
812 ifNoneMatch_ string
813 ctx_ context.Context
814 header_ http.Header
815 }
816
817
818
819
820
821
822 func (r *OperationsService) Get(name string) *OperationsGetCall {
823 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
824 c.name = name
825 return c
826 }
827
828
829
830
831 func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
832 c.urlParams_.Set("fields", googleapi.CombineFields(s))
833 return c
834 }
835
836
837
838
839 func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
840 c.ifNoneMatch_ = entityTag
841 return c
842 }
843
844
845 func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
846 c.ctx_ = ctx
847 return c
848 }
849
850
851
852 func (c *OperationsGetCall) Header() http.Header {
853 if c.header_ == nil {
854 c.header_ = make(http.Header)
855 }
856 return c.header_
857 }
858
859 func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
860 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
861 if c.ifNoneMatch_ != "" {
862 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
863 }
864 var body io.Reader = nil
865 c.urlParams_.Set("alt", alt)
866 c.urlParams_.Set("prettyPrint", "false")
867 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
868 urls += "?" + c.urlParams_.Encode()
869 req, err := http.NewRequest("GET", urls, body)
870 if err != nil {
871 return nil, err
872 }
873 req.Header = reqHeaders
874 googleapi.Expand(req.URL, map[string]string{
875 "name": c.name,
876 })
877 return gensupport.SendRequest(c.ctx_, c.s.client, req)
878 }
879
880
881
882
883
884
885 func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
886 gensupport.SetOptions(c.urlParams_, opts...)
887 res, err := c.doRequest("json")
888 if res != nil && res.StatusCode == http.StatusNotModified {
889 if res.Body != nil {
890 res.Body.Close()
891 }
892 return nil, gensupport.WrapError(&googleapi.Error{
893 Code: res.StatusCode,
894 Header: res.Header,
895 })
896 }
897 if err != nil {
898 return nil, err
899 }
900 defer googleapi.CloseBody(res)
901 if err := googleapi.CheckResponse(res); err != nil {
902 return nil, gensupport.WrapError(err)
903 }
904 ret := &Operation{
905 ServerResponse: googleapi.ServerResponse{
906 Header: res.Header,
907 HTTPStatusCode: res.StatusCode,
908 },
909 }
910 target := &ret
911 if err := gensupport.DecodeResponse(target, res); err != nil {
912 return nil, err
913 }
914 return ret, nil
915 }
916
917 type OperationsListCall struct {
918 s *Service
919 name string
920 urlParams_ gensupport.URLParams
921 ifNoneMatch_ string
922 ctx_ context.Context
923 header_ http.Header
924 }
925
926
927
928
929
930 func (r *OperationsService) List(name string) *OperationsListCall {
931 c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
932 c.name = name
933 return c
934 }
935
936
937 func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
938 c.urlParams_.Set("filter", filter)
939 return c
940 }
941
942
943
944 func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
945 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
946 return c
947 }
948
949
950
951 func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
952 c.urlParams_.Set("pageToken", pageToken)
953 return c
954 }
955
956
957
958
959 func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
960 c.urlParams_.Set("fields", googleapi.CombineFields(s))
961 return c
962 }
963
964
965
966
967 func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
968 c.ifNoneMatch_ = entityTag
969 return c
970 }
971
972
973 func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
974 c.ctx_ = ctx
975 return c
976 }
977
978
979
980 func (c *OperationsListCall) Header() http.Header {
981 if c.header_ == nil {
982 c.header_ = make(http.Header)
983 }
984 return c.header_
985 }
986
987 func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
988 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
989 if c.ifNoneMatch_ != "" {
990 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
991 }
992 var body io.Reader = nil
993 c.urlParams_.Set("alt", alt)
994 c.urlParams_.Set("prettyPrint", "false")
995 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
996 urls += "?" + c.urlParams_.Encode()
997 req, err := http.NewRequest("GET", urls, body)
998 if err != nil {
999 return nil, err
1000 }
1001 req.Header = reqHeaders
1002 googleapi.Expand(req.URL, map[string]string{
1003 "name": c.name,
1004 })
1005 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1006 }
1007
1008
1009
1010
1011
1012
1013
1014 func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
1015 gensupport.SetOptions(c.urlParams_, opts...)
1016 res, err := c.doRequest("json")
1017 if res != nil && res.StatusCode == http.StatusNotModified {
1018 if res.Body != nil {
1019 res.Body.Close()
1020 }
1021 return nil, gensupport.WrapError(&googleapi.Error{
1022 Code: res.StatusCode,
1023 Header: res.Header,
1024 })
1025 }
1026 if err != nil {
1027 return nil, err
1028 }
1029 defer googleapi.CloseBody(res)
1030 if err := googleapi.CheckResponse(res); err != nil {
1031 return nil, gensupport.WrapError(err)
1032 }
1033 ret := &ListOperationsResponse{
1034 ServerResponse: googleapi.ServerResponse{
1035 Header: res.Header,
1036 HTTPStatusCode: res.StatusCode,
1037 },
1038 }
1039 target := &ret
1040 if err := gensupport.DecodeResponse(target, res); err != nil {
1041 return nil, err
1042 }
1043 return ret, nil
1044 }
1045
1046
1047
1048
1049 func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
1050 c.ctx_ = ctx
1051 defer c.PageToken(c.urlParams_.Get("pageToken"))
1052 for {
1053 x, err := c.Do()
1054 if err != nil {
1055 return err
1056 }
1057 if err := f(x); err != nil {
1058 return err
1059 }
1060 if x.NextPageToken == "" {
1061 return nil
1062 }
1063 c.PageToken(x.NextPageToken)
1064 }
1065 }
1066
1067 type UsersEnvironmentsAddPublicKeyCall struct {
1068 s *Service
1069 environment string
1070 addpublickeyrequest *AddPublicKeyRequest
1071 urlParams_ gensupport.URLParams
1072 ctx_ context.Context
1073 header_ http.Header
1074 }
1075
1076
1077
1078
1079
1080
1081
1082
1083 func (r *UsersEnvironmentsService) AddPublicKey(environment string, addpublickeyrequest *AddPublicKeyRequest) *UsersEnvironmentsAddPublicKeyCall {
1084 c := &UsersEnvironmentsAddPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1085 c.environment = environment
1086 c.addpublickeyrequest = addpublickeyrequest
1087 return c
1088 }
1089
1090
1091
1092
1093 func (c *UsersEnvironmentsAddPublicKeyCall) Fields(s ...googleapi.Field) *UsersEnvironmentsAddPublicKeyCall {
1094 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1095 return c
1096 }
1097
1098
1099 func (c *UsersEnvironmentsAddPublicKeyCall) Context(ctx context.Context) *UsersEnvironmentsAddPublicKeyCall {
1100 c.ctx_ = ctx
1101 return c
1102 }
1103
1104
1105
1106 func (c *UsersEnvironmentsAddPublicKeyCall) Header() http.Header {
1107 if c.header_ == nil {
1108 c.header_ = make(http.Header)
1109 }
1110 return c.header_
1111 }
1112
1113 func (c *UsersEnvironmentsAddPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1114 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1115 var body io.Reader = nil
1116 body, err := googleapi.WithoutDataWrapper.JSONReader(c.addpublickeyrequest)
1117 if err != nil {
1118 return nil, err
1119 }
1120 c.urlParams_.Set("alt", alt)
1121 c.urlParams_.Set("prettyPrint", "false")
1122 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+environment}:addPublicKey")
1123 urls += "?" + c.urlParams_.Encode()
1124 req, err := http.NewRequest("POST", urls, body)
1125 if err != nil {
1126 return nil, err
1127 }
1128 req.Header = reqHeaders
1129 googleapi.Expand(req.URL, map[string]string{
1130 "environment": c.environment,
1131 })
1132 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1133 }
1134
1135
1136
1137
1138
1139
1140 func (c *UsersEnvironmentsAddPublicKeyCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1141 gensupport.SetOptions(c.urlParams_, opts...)
1142 res, err := c.doRequest("json")
1143 if res != nil && res.StatusCode == http.StatusNotModified {
1144 if res.Body != nil {
1145 res.Body.Close()
1146 }
1147 return nil, gensupport.WrapError(&googleapi.Error{
1148 Code: res.StatusCode,
1149 Header: res.Header,
1150 })
1151 }
1152 if err != nil {
1153 return nil, err
1154 }
1155 defer googleapi.CloseBody(res)
1156 if err := googleapi.CheckResponse(res); err != nil {
1157 return nil, gensupport.WrapError(err)
1158 }
1159 ret := &Operation{
1160 ServerResponse: googleapi.ServerResponse{
1161 Header: res.Header,
1162 HTTPStatusCode: res.StatusCode,
1163 },
1164 }
1165 target := &ret
1166 if err := gensupport.DecodeResponse(target, res); err != nil {
1167 return nil, err
1168 }
1169 return ret, nil
1170 }
1171
1172 type UsersEnvironmentsAuthorizeCall struct {
1173 s *Service
1174 name string
1175 authorizeenvironmentrequest *AuthorizeEnvironmentRequest
1176 urlParams_ gensupport.URLParams
1177 ctx_ context.Context
1178 header_ http.Header
1179 }
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189 func (r *UsersEnvironmentsService) Authorize(name string, authorizeenvironmentrequest *AuthorizeEnvironmentRequest) *UsersEnvironmentsAuthorizeCall {
1190 c := &UsersEnvironmentsAuthorizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1191 c.name = name
1192 c.authorizeenvironmentrequest = authorizeenvironmentrequest
1193 return c
1194 }
1195
1196
1197
1198
1199 func (c *UsersEnvironmentsAuthorizeCall) Fields(s ...googleapi.Field) *UsersEnvironmentsAuthorizeCall {
1200 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1201 return c
1202 }
1203
1204
1205 func (c *UsersEnvironmentsAuthorizeCall) Context(ctx context.Context) *UsersEnvironmentsAuthorizeCall {
1206 c.ctx_ = ctx
1207 return c
1208 }
1209
1210
1211
1212 func (c *UsersEnvironmentsAuthorizeCall) Header() http.Header {
1213 if c.header_ == nil {
1214 c.header_ = make(http.Header)
1215 }
1216 return c.header_
1217 }
1218
1219 func (c *UsersEnvironmentsAuthorizeCall) doRequest(alt string) (*http.Response, error) {
1220 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1221 var body io.Reader = nil
1222 body, err := googleapi.WithoutDataWrapper.JSONReader(c.authorizeenvironmentrequest)
1223 if err != nil {
1224 return nil, err
1225 }
1226 c.urlParams_.Set("alt", alt)
1227 c.urlParams_.Set("prettyPrint", "false")
1228 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:authorize")
1229 urls += "?" + c.urlParams_.Encode()
1230 req, err := http.NewRequest("POST", urls, body)
1231 if err != nil {
1232 return nil, err
1233 }
1234 req.Header = reqHeaders
1235 googleapi.Expand(req.URL, map[string]string{
1236 "name": c.name,
1237 })
1238 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1239 }
1240
1241
1242
1243
1244
1245
1246 func (c *UsersEnvironmentsAuthorizeCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1247 gensupport.SetOptions(c.urlParams_, opts...)
1248 res, err := c.doRequest("json")
1249 if res != nil && res.StatusCode == http.StatusNotModified {
1250 if res.Body != nil {
1251 res.Body.Close()
1252 }
1253 return nil, gensupport.WrapError(&googleapi.Error{
1254 Code: res.StatusCode,
1255 Header: res.Header,
1256 })
1257 }
1258 if err != nil {
1259 return nil, err
1260 }
1261 defer googleapi.CloseBody(res)
1262 if err := googleapi.CheckResponse(res); err != nil {
1263 return nil, gensupport.WrapError(err)
1264 }
1265 ret := &Operation{
1266 ServerResponse: googleapi.ServerResponse{
1267 Header: res.Header,
1268 HTTPStatusCode: res.StatusCode,
1269 },
1270 }
1271 target := &ret
1272 if err := gensupport.DecodeResponse(target, res); err != nil {
1273 return nil, err
1274 }
1275 return ret, nil
1276 }
1277
1278 type UsersEnvironmentsGetCall struct {
1279 s *Service
1280 name string
1281 urlParams_ gensupport.URLParams
1282 ifNoneMatch_ string
1283 ctx_ context.Context
1284 header_ http.Header
1285 }
1286
1287
1288
1289
1290
1291
1292
1293 func (r *UsersEnvironmentsService) Get(name string) *UsersEnvironmentsGetCall {
1294 c := &UsersEnvironmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1295 c.name = name
1296 return c
1297 }
1298
1299
1300
1301
1302 func (c *UsersEnvironmentsGetCall) Fields(s ...googleapi.Field) *UsersEnvironmentsGetCall {
1303 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1304 return c
1305 }
1306
1307
1308
1309
1310 func (c *UsersEnvironmentsGetCall) IfNoneMatch(entityTag string) *UsersEnvironmentsGetCall {
1311 c.ifNoneMatch_ = entityTag
1312 return c
1313 }
1314
1315
1316 func (c *UsersEnvironmentsGetCall) Context(ctx context.Context) *UsersEnvironmentsGetCall {
1317 c.ctx_ = ctx
1318 return c
1319 }
1320
1321
1322
1323 func (c *UsersEnvironmentsGetCall) Header() http.Header {
1324 if c.header_ == nil {
1325 c.header_ = make(http.Header)
1326 }
1327 return c.header_
1328 }
1329
1330 func (c *UsersEnvironmentsGetCall) doRequest(alt string) (*http.Response, error) {
1331 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1332 if c.ifNoneMatch_ != "" {
1333 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1334 }
1335 var body io.Reader = nil
1336 c.urlParams_.Set("alt", alt)
1337 c.urlParams_.Set("prettyPrint", "false")
1338 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1339 urls += "?" + c.urlParams_.Encode()
1340 req, err := http.NewRequest("GET", urls, body)
1341 if err != nil {
1342 return nil, err
1343 }
1344 req.Header = reqHeaders
1345 googleapi.Expand(req.URL, map[string]string{
1346 "name": c.name,
1347 })
1348 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1349 }
1350
1351
1352
1353
1354
1355
1356 func (c *UsersEnvironmentsGetCall) Do(opts ...googleapi.CallOption) (*Environment, error) {
1357 gensupport.SetOptions(c.urlParams_, opts...)
1358 res, err := c.doRequest("json")
1359 if res != nil && res.StatusCode == http.StatusNotModified {
1360 if res.Body != nil {
1361 res.Body.Close()
1362 }
1363 return nil, gensupport.WrapError(&googleapi.Error{
1364 Code: res.StatusCode,
1365 Header: res.Header,
1366 })
1367 }
1368 if err != nil {
1369 return nil, err
1370 }
1371 defer googleapi.CloseBody(res)
1372 if err := googleapi.CheckResponse(res); err != nil {
1373 return nil, gensupport.WrapError(err)
1374 }
1375 ret := &Environment{
1376 ServerResponse: googleapi.ServerResponse{
1377 Header: res.Header,
1378 HTTPStatusCode: res.StatusCode,
1379 },
1380 }
1381 target := &ret
1382 if err := gensupport.DecodeResponse(target, res); err != nil {
1383 return nil, err
1384 }
1385 return ret, nil
1386 }
1387
1388 type UsersEnvironmentsRemovePublicKeyCall struct {
1389 s *Service
1390 environment string
1391 removepublickeyrequest *RemovePublicKeyRequest
1392 urlParams_ gensupport.URLParams
1393 ctx_ context.Context
1394 header_ http.Header
1395 }
1396
1397
1398
1399
1400
1401
1402
1403
1404 func (r *UsersEnvironmentsService) RemovePublicKey(environment string, removepublickeyrequest *RemovePublicKeyRequest) *UsersEnvironmentsRemovePublicKeyCall {
1405 c := &UsersEnvironmentsRemovePublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1406 c.environment = environment
1407 c.removepublickeyrequest = removepublickeyrequest
1408 return c
1409 }
1410
1411
1412
1413
1414 func (c *UsersEnvironmentsRemovePublicKeyCall) Fields(s ...googleapi.Field) *UsersEnvironmentsRemovePublicKeyCall {
1415 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1416 return c
1417 }
1418
1419
1420 func (c *UsersEnvironmentsRemovePublicKeyCall) Context(ctx context.Context) *UsersEnvironmentsRemovePublicKeyCall {
1421 c.ctx_ = ctx
1422 return c
1423 }
1424
1425
1426
1427 func (c *UsersEnvironmentsRemovePublicKeyCall) Header() http.Header {
1428 if c.header_ == nil {
1429 c.header_ = make(http.Header)
1430 }
1431 return c.header_
1432 }
1433
1434 func (c *UsersEnvironmentsRemovePublicKeyCall) doRequest(alt string) (*http.Response, error) {
1435 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1436 var body io.Reader = nil
1437 body, err := googleapi.WithoutDataWrapper.JSONReader(c.removepublickeyrequest)
1438 if err != nil {
1439 return nil, err
1440 }
1441 c.urlParams_.Set("alt", alt)
1442 c.urlParams_.Set("prettyPrint", "false")
1443 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+environment}:removePublicKey")
1444 urls += "?" + c.urlParams_.Encode()
1445 req, err := http.NewRequest("POST", urls, body)
1446 if err != nil {
1447 return nil, err
1448 }
1449 req.Header = reqHeaders
1450 googleapi.Expand(req.URL, map[string]string{
1451 "environment": c.environment,
1452 })
1453 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1454 }
1455
1456
1457
1458
1459
1460
1461 func (c *UsersEnvironmentsRemovePublicKeyCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1462 gensupport.SetOptions(c.urlParams_, opts...)
1463 res, err := c.doRequest("json")
1464 if res != nil && res.StatusCode == http.StatusNotModified {
1465 if res.Body != nil {
1466 res.Body.Close()
1467 }
1468 return nil, gensupport.WrapError(&googleapi.Error{
1469 Code: res.StatusCode,
1470 Header: res.Header,
1471 })
1472 }
1473 if err != nil {
1474 return nil, err
1475 }
1476 defer googleapi.CloseBody(res)
1477 if err := googleapi.CheckResponse(res); err != nil {
1478 return nil, gensupport.WrapError(err)
1479 }
1480 ret := &Operation{
1481 ServerResponse: googleapi.ServerResponse{
1482 Header: res.Header,
1483 HTTPStatusCode: res.StatusCode,
1484 },
1485 }
1486 target := &ret
1487 if err := gensupport.DecodeResponse(target, res); err != nil {
1488 return nil, err
1489 }
1490 return ret, nil
1491 }
1492
1493 type UsersEnvironmentsStartCall struct {
1494 s *Service
1495 name string
1496 startenvironmentrequest *StartEnvironmentRequest
1497 urlParams_ gensupport.URLParams
1498 ctx_ context.Context
1499 header_ http.Header
1500 }
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512 func (r *UsersEnvironmentsService) Start(name string, startenvironmentrequest *StartEnvironmentRequest) *UsersEnvironmentsStartCall {
1513 c := &UsersEnvironmentsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1514 c.name = name
1515 c.startenvironmentrequest = startenvironmentrequest
1516 return c
1517 }
1518
1519
1520
1521
1522 func (c *UsersEnvironmentsStartCall) Fields(s ...googleapi.Field) *UsersEnvironmentsStartCall {
1523 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1524 return c
1525 }
1526
1527
1528 func (c *UsersEnvironmentsStartCall) Context(ctx context.Context) *UsersEnvironmentsStartCall {
1529 c.ctx_ = ctx
1530 return c
1531 }
1532
1533
1534
1535 func (c *UsersEnvironmentsStartCall) Header() http.Header {
1536 if c.header_ == nil {
1537 c.header_ = make(http.Header)
1538 }
1539 return c.header_
1540 }
1541
1542 func (c *UsersEnvironmentsStartCall) doRequest(alt string) (*http.Response, error) {
1543 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1544 var body io.Reader = nil
1545 body, err := googleapi.WithoutDataWrapper.JSONReader(c.startenvironmentrequest)
1546 if err != nil {
1547 return nil, err
1548 }
1549 c.urlParams_.Set("alt", alt)
1550 c.urlParams_.Set("prettyPrint", "false")
1551 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:start")
1552 urls += "?" + c.urlParams_.Encode()
1553 req, err := http.NewRequest("POST", urls, body)
1554 if err != nil {
1555 return nil, err
1556 }
1557 req.Header = reqHeaders
1558 googleapi.Expand(req.URL, map[string]string{
1559 "name": c.name,
1560 })
1561 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1562 }
1563
1564
1565
1566
1567
1568
1569 func (c *UsersEnvironmentsStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1570 gensupport.SetOptions(c.urlParams_, opts...)
1571 res, err := c.doRequest("json")
1572 if res != nil && res.StatusCode == http.StatusNotModified {
1573 if res.Body != nil {
1574 res.Body.Close()
1575 }
1576 return nil, gensupport.WrapError(&googleapi.Error{
1577 Code: res.StatusCode,
1578 Header: res.Header,
1579 })
1580 }
1581 if err != nil {
1582 return nil, err
1583 }
1584 defer googleapi.CloseBody(res)
1585 if err := googleapi.CheckResponse(res); err != nil {
1586 return nil, gensupport.WrapError(err)
1587 }
1588 ret := &Operation{
1589 ServerResponse: googleapi.ServerResponse{
1590 Header: res.Header,
1591 HTTPStatusCode: res.StatusCode,
1592 },
1593 }
1594 target := &ret
1595 if err := gensupport.DecodeResponse(target, res); err != nil {
1596 return nil, err
1597 }
1598 return ret, nil
1599 }
1600
View as plain text