1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 package oslogin
59
60 import (
61 "bytes"
62 "context"
63 "encoding/json"
64 "errors"
65 "fmt"
66 "io"
67 "net/http"
68 "net/url"
69 "strconv"
70 "strings"
71
72 googleapi "google.golang.org/api/googleapi"
73 internal "google.golang.org/api/internal"
74 gensupport "google.golang.org/api/internal/gensupport"
75 option "google.golang.org/api/option"
76 internaloption "google.golang.org/api/option/internaloption"
77 htransport "google.golang.org/api/transport/http"
78 )
79
80
81
82 var _ = bytes.NewBuffer
83 var _ = strconv.Itoa
84 var _ = fmt.Sprintf
85 var _ = json.NewDecoder
86 var _ = io.Copy
87 var _ = url.Parse
88 var _ = gensupport.MarshalJSON
89 var _ = googleapi.Version
90 var _ = errors.New
91 var _ = strings.Replace
92 var _ = context.Canceled
93 var _ = internaloption.WithDefaultEndpoint
94 var _ = internal.Version
95
96 const apiId = "oslogin:v1beta"
97 const apiName = "oslogin"
98 const apiVersion = "v1beta"
99 const basePath = "https://oslogin.googleapis.com/"
100 const basePathTemplate = "https://oslogin.UNIVERSE_DOMAIN/"
101 const mtlsBasePath = "https://oslogin.mtls.googleapis.com/"
102
103
104 const (
105
106
107 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
108
109
110
111 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
112
113
114 ComputeScope = "https://www.googleapis.com/auth/compute"
115
116
117 ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
118 )
119
120
121 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
122 scopesOption := internaloption.WithDefaultScopes(
123 "https://www.googleapis.com/auth/cloud-platform",
124 "https://www.googleapis.com/auth/cloud-platform.read-only",
125 "https://www.googleapis.com/auth/compute",
126 "https://www.googleapis.com/auth/compute.readonly",
127 )
128
129 opts = append([]option.ClientOption{scopesOption}, opts...)
130 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
131 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
132 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
133 opts = append(opts, internaloption.EnableNewAuthLibrary())
134 client, endpoint, err := htransport.NewClient(ctx, opts...)
135 if err != nil {
136 return nil, err
137 }
138 s, err := New(client)
139 if err != nil {
140 return nil, err
141 }
142 if endpoint != "" {
143 s.BasePath = endpoint
144 }
145 return s, nil
146 }
147
148
149
150
151
152
153 func New(client *http.Client) (*Service, error) {
154 if client == nil {
155 return nil, errors.New("client is nil")
156 }
157 s := &Service{client: client, BasePath: basePath}
158 s.Users = NewUsersService(s)
159 return s, nil
160 }
161
162 type Service struct {
163 client *http.Client
164 BasePath string
165 UserAgent string
166
167 Users *UsersService
168 }
169
170 func (s *Service) userAgent() string {
171 if s.UserAgent == "" {
172 return googleapi.UserAgent
173 }
174 return googleapi.UserAgent + " " + s.UserAgent
175 }
176
177 func NewUsersService(s *Service) *UsersService {
178 rs := &UsersService{s: s}
179 rs.Projects = NewUsersProjectsService(s)
180 rs.SshPublicKeys = NewUsersSshPublicKeysService(s)
181 return rs
182 }
183
184 type UsersService struct {
185 s *Service
186
187 Projects *UsersProjectsService
188
189 SshPublicKeys *UsersSshPublicKeysService
190 }
191
192 func NewUsersProjectsService(s *Service) *UsersProjectsService {
193 rs := &UsersProjectsService{s: s}
194 rs.Locations = NewUsersProjectsLocationsService(s)
195 rs.Zones = NewUsersProjectsZonesService(s)
196 return rs
197 }
198
199 type UsersProjectsService struct {
200 s *Service
201
202 Locations *UsersProjectsLocationsService
203
204 Zones *UsersProjectsZonesService
205 }
206
207 func NewUsersProjectsLocationsService(s *Service) *UsersProjectsLocationsService {
208 rs := &UsersProjectsLocationsService{s: s}
209 return rs
210 }
211
212 type UsersProjectsLocationsService struct {
213 s *Service
214 }
215
216 func NewUsersProjectsZonesService(s *Service) *UsersProjectsZonesService {
217 rs := &UsersProjectsZonesService{s: s}
218 return rs
219 }
220
221 type UsersProjectsZonesService struct {
222 s *Service
223 }
224
225 func NewUsersSshPublicKeysService(s *Service) *UsersSshPublicKeysService {
226 rs := &UsersSshPublicKeysService{s: s}
227 return rs
228 }
229
230 type UsersSshPublicKeysService struct {
231 s *Service
232 }
233
234
235
236
237
238 type Empty struct {
239
240 googleapi.ServerResponse `json:"-"`
241 }
242
243
244
245 type ImportSshPublicKeyResponse struct {
246
247 Details string `json:"details,omitempty"`
248
249 LoginProfile *LoginProfile `json:"loginProfile,omitempty"`
250
251
252 googleapi.ServerResponse `json:"-"`
253
254
255
256
257
258 ForceSendFields []string `json:"-"`
259
260
261
262
263 NullFields []string `json:"-"`
264 }
265
266 func (s *ImportSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
267 type NoMethod ImportSshPublicKeyResponse
268 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
269 }
270
271
272
273 type LoginProfile struct {
274
275 Name string `json:"name,omitempty"`
276
277 PosixAccounts []*PosixAccount `json:"posixAccounts,omitempty"`
278
279 SecurityKeys []*SecurityKey `json:"securityKeys,omitempty"`
280
281
282 SshPublicKeys map[string]SshPublicKey `json:"sshPublicKeys,omitempty"`
283
284
285 googleapi.ServerResponse `json:"-"`
286
287
288
289
290
291 ForceSendFields []string `json:"-"`
292
293
294
295
296 NullFields []string `json:"-"`
297 }
298
299 func (s *LoginProfile) MarshalJSON() ([]byte, error) {
300 type NoMethod LoginProfile
301 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
302 }
303
304
305
306 type PosixAccount struct {
307
308 AccountId string `json:"accountId,omitempty"`
309
310 Gecos string `json:"gecos,omitempty"`
311
312 Gid int64 `json:"gid,omitempty,string"`
313
314 HomeDirectory string `json:"homeDirectory,omitempty"`
315
316 Name string `json:"name,omitempty"`
317
318
319
320
321
322
323
324 OperatingSystemType string `json:"operatingSystemType,omitempty"`
325
326 Primary bool `json:"primary,omitempty"`
327
328 Shell string `json:"shell,omitempty"`
329
330
331 SystemId string `json:"systemId,omitempty"`
332
333 Uid int64 `json:"uid,omitempty,string"`
334
335 Username string `json:"username,omitempty"`
336
337
338
339
340
341 ForceSendFields []string `json:"-"`
342
343
344
345
346 NullFields []string `json:"-"`
347 }
348
349 func (s *PosixAccount) MarshalJSON() ([]byte, error) {
350 type NoMethod PosixAccount
351 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
352 }
353
354
355
356 type SecurityKey struct {
357
358 DeviceNickname string `json:"deviceNickname,omitempty"`
359
360 PrivateKey string `json:"privateKey,omitempty"`
361
362
363 PublicKey string `json:"publicKey,omitempty"`
364
365 UniversalTwoFactor *UniversalTwoFactor `json:"universalTwoFactor,omitempty"`
366
367 WebAuthn *WebAuthn `json:"webAuthn,omitempty"`
368
369
370
371
372
373 ForceSendFields []string `json:"-"`
374
375
376
377
378 NullFields []string `json:"-"`
379 }
380
381 func (s *SecurityKey) MarshalJSON() ([]byte, error) {
382 type NoMethod SecurityKey
383 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
384 }
385
386 type SignSshPublicKeyRequest struct {
387
388 SshPublicKey string `json:"sshPublicKey,omitempty"`
389
390
391
392
393
394 ForceSendFields []string `json:"-"`
395
396
397
398
399 NullFields []string `json:"-"`
400 }
401
402 func (s *SignSshPublicKeyRequest) MarshalJSON() ([]byte, error) {
403 type NoMethod SignSshPublicKeyRequest
404 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
405 }
406
407 type SignSshPublicKeyResponse struct {
408
409 SignedSshPublicKey string `json:"signedSshPublicKey,omitempty"`
410
411
412 googleapi.ServerResponse `json:"-"`
413
414
415
416
417
418 ForceSendFields []string `json:"-"`
419
420
421
422
423 NullFields []string `json:"-"`
424 }
425
426 func (s *SignSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
427 type NoMethod SignSshPublicKeyResponse
428 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
429 }
430
431
432
433 type SshPublicKey struct {
434
435 ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
436
437 Fingerprint string `json:"fingerprint,omitempty"`
438
439 Key string `json:"key,omitempty"`
440
441 Name string `json:"name,omitempty"`
442
443
444 googleapi.ServerResponse `json:"-"`
445
446
447
448
449
450 ForceSendFields []string `json:"-"`
451
452
453
454
455 NullFields []string `json:"-"`
456 }
457
458 func (s *SshPublicKey) MarshalJSON() ([]byte, error) {
459 type NoMethod SshPublicKey
460 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
461 }
462
463
464 type UniversalTwoFactor struct {
465
466 AppId string `json:"appId,omitempty"`
467
468
469
470
471
472 ForceSendFields []string `json:"-"`
473
474
475
476
477 NullFields []string `json:"-"`
478 }
479
480 func (s *UniversalTwoFactor) MarshalJSON() ([]byte, error) {
481 type NoMethod UniversalTwoFactor
482 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
483 }
484
485
486
487 type WebAuthn struct {
488
489 RpId string `json:"rpId,omitempty"`
490
491
492
493
494
495 ForceSendFields []string `json:"-"`
496
497
498
499
500 NullFields []string `json:"-"`
501 }
502
503 func (s *WebAuthn) MarshalJSON() ([]byte, error) {
504 type NoMethod WebAuthn
505 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
506 }
507
508 type UsersGetLoginProfileCall struct {
509 s *Service
510 name string
511 urlParams_ gensupport.URLParams
512 ifNoneMatch_ string
513 ctx_ context.Context
514 header_ http.Header
515 }
516
517
518
519
520
521 func (r *UsersService) GetLoginProfile(name string) *UsersGetLoginProfileCall {
522 c := &UsersGetLoginProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
523 c.name = name
524 return c
525 }
526
527
528
529 func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
530 c.urlParams_.Set("projectId", projectId)
531 return c
532 }
533
534
535
536 func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
537 c.urlParams_.Set("systemId", systemId)
538 return c
539 }
540
541
542
543
544
545
546
547
548
549
550
551
552 func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
553 c.urlParams_.Set("view", view)
554 return c
555 }
556
557
558
559
560 func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
561 c.urlParams_.Set("fields", googleapi.CombineFields(s))
562 return c
563 }
564
565
566
567
568 func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
569 c.ifNoneMatch_ = entityTag
570 return c
571 }
572
573
574 func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
575 c.ctx_ = ctx
576 return c
577 }
578
579
580
581 func (c *UsersGetLoginProfileCall) Header() http.Header {
582 if c.header_ == nil {
583 c.header_ = make(http.Header)
584 }
585 return c.header_
586 }
587
588 func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
589 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
590 if c.ifNoneMatch_ != "" {
591 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
592 }
593 var body io.Reader = nil
594 c.urlParams_.Set("alt", alt)
595 c.urlParams_.Set("prettyPrint", "false")
596 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}/loginProfile")
597 urls += "?" + c.urlParams_.Encode()
598 req, err := http.NewRequest("GET", urls, body)
599 if err != nil {
600 return nil, err
601 }
602 req.Header = reqHeaders
603 googleapi.Expand(req.URL, map[string]string{
604 "name": c.name,
605 })
606 return gensupport.SendRequest(c.ctx_, c.s.client, req)
607 }
608
609
610
611
612
613
614 func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
615 gensupport.SetOptions(c.urlParams_, opts...)
616 res, err := c.doRequest("json")
617 if res != nil && res.StatusCode == http.StatusNotModified {
618 if res.Body != nil {
619 res.Body.Close()
620 }
621 return nil, gensupport.WrapError(&googleapi.Error{
622 Code: res.StatusCode,
623 Header: res.Header,
624 })
625 }
626 if err != nil {
627 return nil, err
628 }
629 defer googleapi.CloseBody(res)
630 if err := googleapi.CheckResponse(res); err != nil {
631 return nil, gensupport.WrapError(err)
632 }
633 ret := &LoginProfile{
634 ServerResponse: googleapi.ServerResponse{
635 Header: res.Header,
636 HTTPStatusCode: res.StatusCode,
637 },
638 }
639 target := &ret
640 if err := gensupport.DecodeResponse(target, res); err != nil {
641 return nil, err
642 }
643 return ret, nil
644 }
645
646 type UsersImportSshPublicKeyCall struct {
647 s *Service
648 parent string
649 sshpublickey *SshPublicKey
650 urlParams_ gensupport.URLParams
651 ctx_ context.Context
652 header_ http.Header
653 }
654
655
656
657
658
659
660 func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
661 c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
662 c.parent = parent
663 c.sshpublickey = sshpublickey
664 return c
665 }
666
667
668
669 func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
670 c.urlParams_.Set("projectId", projectId)
671 return c
672 }
673
674
675
676
677 func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
678 c.urlParams_.SetMulti("regions", append([]string{}, regions...))
679 return c
680 }
681
682
683
684
685
686
687
688
689
690
691
692
693 func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
694 c.urlParams_.Set("view", view)
695 return c
696 }
697
698
699
700
701 func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
702 c.urlParams_.Set("fields", googleapi.CombineFields(s))
703 return c
704 }
705
706
707 func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
708 c.ctx_ = ctx
709 return c
710 }
711
712
713
714 func (c *UsersImportSshPublicKeyCall) Header() http.Header {
715 if c.header_ == nil {
716 c.header_ = make(http.Header)
717 }
718 return c.header_
719 }
720
721 func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
722 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
723 var body io.Reader = nil
724 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
725 if err != nil {
726 return nil, err
727 }
728 c.urlParams_.Set("alt", alt)
729 c.urlParams_.Set("prettyPrint", "false")
730 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:importSshPublicKey")
731 urls += "?" + c.urlParams_.Encode()
732 req, err := http.NewRequest("POST", urls, body)
733 if err != nil {
734 return nil, err
735 }
736 req.Header = reqHeaders
737 googleapi.Expand(req.URL, map[string]string{
738 "parent": c.parent,
739 })
740 return gensupport.SendRequest(c.ctx_, c.s.client, req)
741 }
742
743
744
745
746
747
748
749 func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
750 gensupport.SetOptions(c.urlParams_, opts...)
751 res, err := c.doRequest("json")
752 if res != nil && res.StatusCode == http.StatusNotModified {
753 if res.Body != nil {
754 res.Body.Close()
755 }
756 return nil, gensupport.WrapError(&googleapi.Error{
757 Code: res.StatusCode,
758 Header: res.Header,
759 })
760 }
761 if err != nil {
762 return nil, err
763 }
764 defer googleapi.CloseBody(res)
765 if err := googleapi.CheckResponse(res); err != nil {
766 return nil, gensupport.WrapError(err)
767 }
768 ret := &ImportSshPublicKeyResponse{
769 ServerResponse: googleapi.ServerResponse{
770 Header: res.Header,
771 HTTPStatusCode: res.StatusCode,
772 },
773 }
774 target := &ret
775 if err := gensupport.DecodeResponse(target, res); err != nil {
776 return nil, err
777 }
778 return ret, nil
779 }
780
781 type UsersProjectsDeleteCall struct {
782 s *Service
783 name string
784 urlParams_ gensupport.URLParams
785 ctx_ context.Context
786 header_ http.Header
787 }
788
789
790
791
792
793
794 func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
795 c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
796 c.name = name
797 return c
798 }
799
800
801
802
803 func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
804 c.urlParams_.Set("fields", googleapi.CombineFields(s))
805 return c
806 }
807
808
809 func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
810 c.ctx_ = ctx
811 return c
812 }
813
814
815
816 func (c *UsersProjectsDeleteCall) Header() http.Header {
817 if c.header_ == nil {
818 c.header_ = make(http.Header)
819 }
820 return c.header_
821 }
822
823 func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
824 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
825 var body io.Reader = nil
826 c.urlParams_.Set("alt", alt)
827 c.urlParams_.Set("prettyPrint", "false")
828 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
829 urls += "?" + c.urlParams_.Encode()
830 req, err := http.NewRequest("DELETE", urls, body)
831 if err != nil {
832 return nil, err
833 }
834 req.Header = reqHeaders
835 googleapi.Expand(req.URL, map[string]string{
836 "name": c.name,
837 })
838 return gensupport.SendRequest(c.ctx_, c.s.client, req)
839 }
840
841
842
843
844
845
846 func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
847 gensupport.SetOptions(c.urlParams_, opts...)
848 res, err := c.doRequest("json")
849 if res != nil && res.StatusCode == http.StatusNotModified {
850 if res.Body != nil {
851 res.Body.Close()
852 }
853 return nil, gensupport.WrapError(&googleapi.Error{
854 Code: res.StatusCode,
855 Header: res.Header,
856 })
857 }
858 if err != nil {
859 return nil, err
860 }
861 defer googleapi.CloseBody(res)
862 if err := googleapi.CheckResponse(res); err != nil {
863 return nil, gensupport.WrapError(err)
864 }
865 ret := &Empty{
866 ServerResponse: googleapi.ServerResponse{
867 Header: res.Header,
868 HTTPStatusCode: res.StatusCode,
869 },
870 }
871 target := &ret
872 if err := gensupport.DecodeResponse(target, res); err != nil {
873 return nil, err
874 }
875 return ret, nil
876 }
877
878 type UsersProjectsLocationsSignSshPublicKeyCall struct {
879 s *Service
880 parent string
881 signsshpublickeyrequest *SignSshPublicKeyRequest
882 urlParams_ gensupport.URLParams
883 ctx_ context.Context
884 header_ http.Header
885 }
886
887
888
889
890
891
892
893
894 func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
895 c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
896 c.parent = parent
897 c.signsshpublickeyrequest = signsshpublickeyrequest
898 return c
899 }
900
901
902
903
904 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
905 c.urlParams_.Set("fields", googleapi.CombineFields(s))
906 return c
907 }
908
909
910 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
911 c.ctx_ = ctx
912 return c
913 }
914
915
916
917 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
918 if c.header_ == nil {
919 c.header_ = make(http.Header)
920 }
921 return c.header_
922 }
923
924 func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
925 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
926 var body io.Reader = nil
927 body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
928 if err != nil {
929 return nil, err
930 }
931 c.urlParams_.Set("alt", alt)
932 c.urlParams_.Set("prettyPrint", "false")
933 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
934 urls += "?" + c.urlParams_.Encode()
935 req, err := http.NewRequest("POST", urls, body)
936 if err != nil {
937 return nil, err
938 }
939 req.Header = reqHeaders
940 googleapi.Expand(req.URL, map[string]string{
941 "parent": c.parent,
942 })
943 return gensupport.SendRequest(c.ctx_, c.s.client, req)
944 }
945
946
947
948
949
950
951
952 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
953 gensupport.SetOptions(c.urlParams_, opts...)
954 res, err := c.doRequest("json")
955 if res != nil && res.StatusCode == http.StatusNotModified {
956 if res.Body != nil {
957 res.Body.Close()
958 }
959 return nil, gensupport.WrapError(&googleapi.Error{
960 Code: res.StatusCode,
961 Header: res.Header,
962 })
963 }
964 if err != nil {
965 return nil, err
966 }
967 defer googleapi.CloseBody(res)
968 if err := googleapi.CheckResponse(res); err != nil {
969 return nil, gensupport.WrapError(err)
970 }
971 ret := &SignSshPublicKeyResponse{
972 ServerResponse: googleapi.ServerResponse{
973 Header: res.Header,
974 HTTPStatusCode: res.StatusCode,
975 },
976 }
977 target := &ret
978 if err := gensupport.DecodeResponse(target, res); err != nil {
979 return nil, err
980 }
981 return ret, nil
982 }
983
984 type UsersProjectsZonesSignSshPublicKeyCall struct {
985 s *Service
986 parent string
987 signsshpublickeyrequest *SignSshPublicKeyRequest
988 urlParams_ gensupport.URLParams
989 ctx_ context.Context
990 header_ http.Header
991 }
992
993
994
995
996
997
998
999
1000 func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
1001 c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1002 c.parent = parent
1003 c.signsshpublickeyrequest = signsshpublickeyrequest
1004 return c
1005 }
1006
1007
1008
1009
1010 func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
1011 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1012 return c
1013 }
1014
1015
1016 func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
1017 c.ctx_ = ctx
1018 return c
1019 }
1020
1021
1022
1023 func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
1024 if c.header_ == nil {
1025 c.header_ = make(http.Header)
1026 }
1027 return c.header_
1028 }
1029
1030 func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1031 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1032 var body io.Reader = nil
1033 body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
1034 if err != nil {
1035 return nil, err
1036 }
1037 c.urlParams_.Set("alt", alt)
1038 c.urlParams_.Set("prettyPrint", "false")
1039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
1040 urls += "?" + c.urlParams_.Encode()
1041 req, err := http.NewRequest("POST", urls, body)
1042 if err != nil {
1043 return nil, err
1044 }
1045 req.Header = reqHeaders
1046 googleapi.Expand(req.URL, map[string]string{
1047 "parent": c.parent,
1048 })
1049 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1050 }
1051
1052
1053
1054
1055
1056
1057
1058 func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1059 gensupport.SetOptions(c.urlParams_, opts...)
1060 res, err := c.doRequest("json")
1061 if res != nil && res.StatusCode == http.StatusNotModified {
1062 if res.Body != nil {
1063 res.Body.Close()
1064 }
1065 return nil, gensupport.WrapError(&googleapi.Error{
1066 Code: res.StatusCode,
1067 Header: res.Header,
1068 })
1069 }
1070 if err != nil {
1071 return nil, err
1072 }
1073 defer googleapi.CloseBody(res)
1074 if err := googleapi.CheckResponse(res); err != nil {
1075 return nil, gensupport.WrapError(err)
1076 }
1077 ret := &SignSshPublicKeyResponse{
1078 ServerResponse: googleapi.ServerResponse{
1079 Header: res.Header,
1080 HTTPStatusCode: res.StatusCode,
1081 },
1082 }
1083 target := &ret
1084 if err := gensupport.DecodeResponse(target, res); err != nil {
1085 return nil, err
1086 }
1087 return ret, nil
1088 }
1089
1090 type UsersSshPublicKeysCreateCall struct {
1091 s *Service
1092 parent string
1093 sshpublickey *SshPublicKey
1094 urlParams_ gensupport.URLParams
1095 ctx_ context.Context
1096 header_ http.Header
1097 }
1098
1099
1100
1101
1102 func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
1103 c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1104 c.parent = parent
1105 c.sshpublickey = sshpublickey
1106 return c
1107 }
1108
1109
1110
1111
1112 func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
1113 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1114 return c
1115 }
1116
1117
1118 func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
1119 c.ctx_ = ctx
1120 return c
1121 }
1122
1123
1124
1125 func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
1126 if c.header_ == nil {
1127 c.header_ = make(http.Header)
1128 }
1129 return c.header_
1130 }
1131
1132 func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
1133 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1134 var body io.Reader = nil
1135 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
1136 if err != nil {
1137 return nil, err
1138 }
1139 c.urlParams_.Set("alt", alt)
1140 c.urlParams_.Set("prettyPrint", "false")
1141 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/sshPublicKeys")
1142 urls += "?" + c.urlParams_.Encode()
1143 req, err := http.NewRequest("POST", urls, body)
1144 if err != nil {
1145 return nil, err
1146 }
1147 req.Header = reqHeaders
1148 googleapi.Expand(req.URL, map[string]string{
1149 "parent": c.parent,
1150 })
1151 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1152 }
1153
1154
1155
1156
1157
1158
1159 func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, 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 := &SshPublicKey{
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 UsersSshPublicKeysDeleteCall struct {
1192 s *Service
1193 name string
1194 urlParams_ gensupport.URLParams
1195 ctx_ context.Context
1196 header_ http.Header
1197 }
1198
1199
1200
1201
1202
1203
1204 func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
1205 c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1206 c.name = name
1207 return c
1208 }
1209
1210
1211
1212
1213 func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
1214 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1215 return c
1216 }
1217
1218
1219 func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
1220 c.ctx_ = ctx
1221 return c
1222 }
1223
1224
1225
1226 func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
1227 if c.header_ == nil {
1228 c.header_ = make(http.Header)
1229 }
1230 return c.header_
1231 }
1232
1233 func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
1234 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1235 var body io.Reader = nil
1236 c.urlParams_.Set("alt", alt)
1237 c.urlParams_.Set("prettyPrint", "false")
1238 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1239 urls += "?" + c.urlParams_.Encode()
1240 req, err := http.NewRequest("DELETE", urls, body)
1241 if err != nil {
1242 return nil, err
1243 }
1244 req.Header = reqHeaders
1245 googleapi.Expand(req.URL, map[string]string{
1246 "name": c.name,
1247 })
1248 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1249 }
1250
1251
1252
1253
1254
1255
1256 func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1257 gensupport.SetOptions(c.urlParams_, opts...)
1258 res, err := c.doRequest("json")
1259 if res != nil && res.StatusCode == http.StatusNotModified {
1260 if res.Body != nil {
1261 res.Body.Close()
1262 }
1263 return nil, gensupport.WrapError(&googleapi.Error{
1264 Code: res.StatusCode,
1265 Header: res.Header,
1266 })
1267 }
1268 if err != nil {
1269 return nil, err
1270 }
1271 defer googleapi.CloseBody(res)
1272 if err := googleapi.CheckResponse(res); err != nil {
1273 return nil, gensupport.WrapError(err)
1274 }
1275 ret := &Empty{
1276 ServerResponse: googleapi.ServerResponse{
1277 Header: res.Header,
1278 HTTPStatusCode: res.StatusCode,
1279 },
1280 }
1281 target := &ret
1282 if err := gensupport.DecodeResponse(target, res); err != nil {
1283 return nil, err
1284 }
1285 return ret, nil
1286 }
1287
1288 type UsersSshPublicKeysGetCall struct {
1289 s *Service
1290 name string
1291 urlParams_ gensupport.URLParams
1292 ifNoneMatch_ string
1293 ctx_ context.Context
1294 header_ http.Header
1295 }
1296
1297
1298
1299
1300
1301
1302 func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
1303 c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1304 c.name = name
1305 return c
1306 }
1307
1308
1309
1310
1311 func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
1312 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1313 return c
1314 }
1315
1316
1317
1318
1319 func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
1320 c.ifNoneMatch_ = entityTag
1321 return c
1322 }
1323
1324
1325 func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
1326 c.ctx_ = ctx
1327 return c
1328 }
1329
1330
1331
1332 func (c *UsersSshPublicKeysGetCall) Header() http.Header {
1333 if c.header_ == nil {
1334 c.header_ = make(http.Header)
1335 }
1336 return c.header_
1337 }
1338
1339 func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
1340 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1341 if c.ifNoneMatch_ != "" {
1342 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1343 }
1344 var body io.Reader = nil
1345 c.urlParams_.Set("alt", alt)
1346 c.urlParams_.Set("prettyPrint", "false")
1347 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1348 urls += "?" + c.urlParams_.Encode()
1349 req, err := http.NewRequest("GET", urls, body)
1350 if err != nil {
1351 return nil, err
1352 }
1353 req.Header = reqHeaders
1354 googleapi.Expand(req.URL, map[string]string{
1355 "name": c.name,
1356 })
1357 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1358 }
1359
1360
1361
1362
1363
1364
1365 func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1366 gensupport.SetOptions(c.urlParams_, opts...)
1367 res, err := c.doRequest("json")
1368 if res != nil && res.StatusCode == http.StatusNotModified {
1369 if res.Body != nil {
1370 res.Body.Close()
1371 }
1372 return nil, gensupport.WrapError(&googleapi.Error{
1373 Code: res.StatusCode,
1374 Header: res.Header,
1375 })
1376 }
1377 if err != nil {
1378 return nil, err
1379 }
1380 defer googleapi.CloseBody(res)
1381 if err := googleapi.CheckResponse(res); err != nil {
1382 return nil, gensupport.WrapError(err)
1383 }
1384 ret := &SshPublicKey{
1385 ServerResponse: googleapi.ServerResponse{
1386 Header: res.Header,
1387 HTTPStatusCode: res.StatusCode,
1388 },
1389 }
1390 target := &ret
1391 if err := gensupport.DecodeResponse(target, res); err != nil {
1392 return nil, err
1393 }
1394 return ret, nil
1395 }
1396
1397 type UsersSshPublicKeysPatchCall struct {
1398 s *Service
1399 name string
1400 sshpublickey *SshPublicKey
1401 urlParams_ gensupport.URLParams
1402 ctx_ context.Context
1403 header_ http.Header
1404 }
1405
1406
1407
1408
1409
1410
1411
1412 func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
1413 c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1414 c.name = name
1415 c.sshpublickey = sshpublickey
1416 return c
1417 }
1418
1419
1420
1421 func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
1422 c.urlParams_.Set("updateMask", updateMask)
1423 return c
1424 }
1425
1426
1427
1428
1429 func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
1430 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1431 return c
1432 }
1433
1434
1435 func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
1436 c.ctx_ = ctx
1437 return c
1438 }
1439
1440
1441
1442 func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
1443 if c.header_ == nil {
1444 c.header_ = make(http.Header)
1445 }
1446 return c.header_
1447 }
1448
1449 func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
1450 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1451 var body io.Reader = nil
1452 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
1453 if err != nil {
1454 return nil, err
1455 }
1456 c.urlParams_.Set("alt", alt)
1457 c.urlParams_.Set("prettyPrint", "false")
1458 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1459 urls += "?" + c.urlParams_.Encode()
1460 req, err := http.NewRequest("PATCH", urls, body)
1461 if err != nil {
1462 return nil, err
1463 }
1464 req.Header = reqHeaders
1465 googleapi.Expand(req.URL, map[string]string{
1466 "name": c.name,
1467 })
1468 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1469 }
1470
1471
1472
1473
1474
1475
1476 func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1477 gensupport.SetOptions(c.urlParams_, opts...)
1478 res, err := c.doRequest("json")
1479 if res != nil && res.StatusCode == http.StatusNotModified {
1480 if res.Body != nil {
1481 res.Body.Close()
1482 }
1483 return nil, gensupport.WrapError(&googleapi.Error{
1484 Code: res.StatusCode,
1485 Header: res.Header,
1486 })
1487 }
1488 if err != nil {
1489 return nil, err
1490 }
1491 defer googleapi.CloseBody(res)
1492 if err := googleapi.CheckResponse(res); err != nil {
1493 return nil, gensupport.WrapError(err)
1494 }
1495 ret := &SshPublicKey{
1496 ServerResponse: googleapi.ServerResponse{
1497 Header: res.Header,
1498 HTTPStatusCode: res.StatusCode,
1499 },
1500 }
1501 target := &ret
1502 if err := gensupport.DecodeResponse(target, res); err != nil {
1503 return nil, err
1504 }
1505 return ret, nil
1506 }
1507
View as plain text