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:v1alpha"
97 const apiName = "oslogin"
98 const apiVersion = "v1alpha"
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
530
531
532
533
534
535
536
537
538 func (c *UsersGetLoginProfileCall) OperatingSystemType(operatingSystemType string) *UsersGetLoginProfileCall {
539 c.urlParams_.Set("operatingSystemType", operatingSystemType)
540 return c
541 }
542
543
544
545 func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
546 c.urlParams_.Set("projectId", projectId)
547 return c
548 }
549
550
551
552 func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
553 c.urlParams_.Set("systemId", systemId)
554 return c
555 }
556
557
558
559
560
561
562
563
564
565
566
567
568 func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
569 c.urlParams_.Set("view", view)
570 return c
571 }
572
573
574
575
576 func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
577 c.urlParams_.Set("fields", googleapi.CombineFields(s))
578 return c
579 }
580
581
582
583
584 func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
585 c.ifNoneMatch_ = entityTag
586 return c
587 }
588
589
590 func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
591 c.ctx_ = ctx
592 return c
593 }
594
595
596
597 func (c *UsersGetLoginProfileCall) Header() http.Header {
598 if c.header_ == nil {
599 c.header_ = make(http.Header)
600 }
601 return c.header_
602 }
603
604 func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
605 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
606 if c.ifNoneMatch_ != "" {
607 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
608 }
609 var body io.Reader = nil
610 c.urlParams_.Set("alt", alt)
611 c.urlParams_.Set("prettyPrint", "false")
612 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}/loginProfile")
613 urls += "?" + c.urlParams_.Encode()
614 req, err := http.NewRequest("GET", urls, body)
615 if err != nil {
616 return nil, err
617 }
618 req.Header = reqHeaders
619 googleapi.Expand(req.URL, map[string]string{
620 "name": c.name,
621 })
622 return gensupport.SendRequest(c.ctx_, c.s.client, req)
623 }
624
625
626
627
628
629
630 func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
631 gensupport.SetOptions(c.urlParams_, opts...)
632 res, err := c.doRequest("json")
633 if res != nil && res.StatusCode == http.StatusNotModified {
634 if res.Body != nil {
635 res.Body.Close()
636 }
637 return nil, gensupport.WrapError(&googleapi.Error{
638 Code: res.StatusCode,
639 Header: res.Header,
640 })
641 }
642 if err != nil {
643 return nil, err
644 }
645 defer googleapi.CloseBody(res)
646 if err := googleapi.CheckResponse(res); err != nil {
647 return nil, gensupport.WrapError(err)
648 }
649 ret := &LoginProfile{
650 ServerResponse: googleapi.ServerResponse{
651 Header: res.Header,
652 HTTPStatusCode: res.StatusCode,
653 },
654 }
655 target := &ret
656 if err := gensupport.DecodeResponse(target, res); err != nil {
657 return nil, err
658 }
659 return ret, nil
660 }
661
662 type UsersImportSshPublicKeyCall struct {
663 s *Service
664 parent string
665 sshpublickey *SshPublicKey
666 urlParams_ gensupport.URLParams
667 ctx_ context.Context
668 header_ http.Header
669 }
670
671
672
673
674
675
676 func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
677 c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
678 c.parent = parent
679 c.sshpublickey = sshpublickey
680 return c
681 }
682
683
684
685 func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
686 c.urlParams_.Set("projectId", projectId)
687 return c
688 }
689
690
691
692
693 func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
694 c.urlParams_.SetMulti("regions", append([]string{}, regions...))
695 return c
696 }
697
698
699
700
701
702
703
704
705
706
707
708
709 func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
710 c.urlParams_.Set("view", view)
711 return c
712 }
713
714
715
716
717 func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
718 c.urlParams_.Set("fields", googleapi.CombineFields(s))
719 return c
720 }
721
722
723 func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
724 c.ctx_ = ctx
725 return c
726 }
727
728
729
730 func (c *UsersImportSshPublicKeyCall) Header() http.Header {
731 if c.header_ == nil {
732 c.header_ = make(http.Header)
733 }
734 return c.header_
735 }
736
737 func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
738 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
739 var body io.Reader = nil
740 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
741 if err != nil {
742 return nil, err
743 }
744 c.urlParams_.Set("alt", alt)
745 c.urlParams_.Set("prettyPrint", "false")
746 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:importSshPublicKey")
747 urls += "?" + c.urlParams_.Encode()
748 req, err := http.NewRequest("POST", urls, body)
749 if err != nil {
750 return nil, err
751 }
752 req.Header = reqHeaders
753 googleapi.Expand(req.URL, map[string]string{
754 "parent": c.parent,
755 })
756 return gensupport.SendRequest(c.ctx_, c.s.client, req)
757 }
758
759
760
761
762
763
764
765 func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
766 gensupport.SetOptions(c.urlParams_, opts...)
767 res, err := c.doRequest("json")
768 if res != nil && res.StatusCode == http.StatusNotModified {
769 if res.Body != nil {
770 res.Body.Close()
771 }
772 return nil, gensupport.WrapError(&googleapi.Error{
773 Code: res.StatusCode,
774 Header: res.Header,
775 })
776 }
777 if err != nil {
778 return nil, err
779 }
780 defer googleapi.CloseBody(res)
781 if err := googleapi.CheckResponse(res); err != nil {
782 return nil, gensupport.WrapError(err)
783 }
784 ret := &ImportSshPublicKeyResponse{
785 ServerResponse: googleapi.ServerResponse{
786 Header: res.Header,
787 HTTPStatusCode: res.StatusCode,
788 },
789 }
790 target := &ret
791 if err := gensupport.DecodeResponse(target, res); err != nil {
792 return nil, err
793 }
794 return ret, nil
795 }
796
797 type UsersProjectsDeleteCall struct {
798 s *Service
799 name string
800 urlParams_ gensupport.URLParams
801 ctx_ context.Context
802 header_ http.Header
803 }
804
805
806
807
808
809
810 func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
811 c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
812 c.name = name
813 return c
814 }
815
816
817
818
819
820
821
822
823
824
825
826
827 func (c *UsersProjectsDeleteCall) OperatingSystemType(operatingSystemType string) *UsersProjectsDeleteCall {
828 c.urlParams_.Set("operatingSystemType", operatingSystemType)
829 return c
830 }
831
832
833
834
835 func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
836 c.urlParams_.Set("fields", googleapi.CombineFields(s))
837 return c
838 }
839
840
841 func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
842 c.ctx_ = ctx
843 return c
844 }
845
846
847
848 func (c *UsersProjectsDeleteCall) Header() http.Header {
849 if c.header_ == nil {
850 c.header_ = make(http.Header)
851 }
852 return c.header_
853 }
854
855 func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
856 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
857 var body io.Reader = nil
858 c.urlParams_.Set("alt", alt)
859 c.urlParams_.Set("prettyPrint", "false")
860 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
861 urls += "?" + c.urlParams_.Encode()
862 req, err := http.NewRequest("DELETE", urls, body)
863 if err != nil {
864 return nil, err
865 }
866 req.Header = reqHeaders
867 googleapi.Expand(req.URL, map[string]string{
868 "name": c.name,
869 })
870 return gensupport.SendRequest(c.ctx_, c.s.client, req)
871 }
872
873
874
875
876
877
878 func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
879 gensupport.SetOptions(c.urlParams_, opts...)
880 res, err := c.doRequest("json")
881 if res != nil && res.StatusCode == http.StatusNotModified {
882 if res.Body != nil {
883 res.Body.Close()
884 }
885 return nil, gensupport.WrapError(&googleapi.Error{
886 Code: res.StatusCode,
887 Header: res.Header,
888 })
889 }
890 if err != nil {
891 return nil, err
892 }
893 defer googleapi.CloseBody(res)
894 if err := googleapi.CheckResponse(res); err != nil {
895 return nil, gensupport.WrapError(err)
896 }
897 ret := &Empty{
898 ServerResponse: googleapi.ServerResponse{
899 Header: res.Header,
900 HTTPStatusCode: res.StatusCode,
901 },
902 }
903 target := &ret
904 if err := gensupport.DecodeResponse(target, res); err != nil {
905 return nil, err
906 }
907 return ret, nil
908 }
909
910 type UsersProjectsLocationsSignSshPublicKeyCall struct {
911 s *Service
912 parent string
913 signsshpublickeyrequest *SignSshPublicKeyRequest
914 urlParams_ gensupport.URLParams
915 ctx_ context.Context
916 header_ http.Header
917 }
918
919
920
921
922
923
924
925
926 func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
927 c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
928 c.parent = parent
929 c.signsshpublickeyrequest = signsshpublickeyrequest
930 return c
931 }
932
933
934
935
936 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
937 c.urlParams_.Set("fields", googleapi.CombineFields(s))
938 return c
939 }
940
941
942 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
943 c.ctx_ = ctx
944 return c
945 }
946
947
948
949 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
950 if c.header_ == nil {
951 c.header_ = make(http.Header)
952 }
953 return c.header_
954 }
955
956 func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
957 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
958 var body io.Reader = nil
959 body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
960 if err != nil {
961 return nil, err
962 }
963 c.urlParams_.Set("alt", alt)
964 c.urlParams_.Set("prettyPrint", "false")
965 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
966 urls += "?" + c.urlParams_.Encode()
967 req, err := http.NewRequest("POST", urls, body)
968 if err != nil {
969 return nil, err
970 }
971 req.Header = reqHeaders
972 googleapi.Expand(req.URL, map[string]string{
973 "parent": c.parent,
974 })
975 return gensupport.SendRequest(c.ctx_, c.s.client, req)
976 }
977
978
979
980
981
982
983
984 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
985 gensupport.SetOptions(c.urlParams_, opts...)
986 res, err := c.doRequest("json")
987 if res != nil && res.StatusCode == http.StatusNotModified {
988 if res.Body != nil {
989 res.Body.Close()
990 }
991 return nil, gensupport.WrapError(&googleapi.Error{
992 Code: res.StatusCode,
993 Header: res.Header,
994 })
995 }
996 if err != nil {
997 return nil, err
998 }
999 defer googleapi.CloseBody(res)
1000 if err := googleapi.CheckResponse(res); err != nil {
1001 return nil, gensupport.WrapError(err)
1002 }
1003 ret := &SignSshPublicKeyResponse{
1004 ServerResponse: googleapi.ServerResponse{
1005 Header: res.Header,
1006 HTTPStatusCode: res.StatusCode,
1007 },
1008 }
1009 target := &ret
1010 if err := gensupport.DecodeResponse(target, res); err != nil {
1011 return nil, err
1012 }
1013 return ret, nil
1014 }
1015
1016 type UsersProjectsZonesSignSshPublicKeyCall struct {
1017 s *Service
1018 parent string
1019 signsshpublickeyrequest *SignSshPublicKeyRequest
1020 urlParams_ gensupport.URLParams
1021 ctx_ context.Context
1022 header_ http.Header
1023 }
1024
1025
1026
1027
1028
1029
1030
1031
1032 func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
1033 c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1034 c.parent = parent
1035 c.signsshpublickeyrequest = signsshpublickeyrequest
1036 return c
1037 }
1038
1039
1040
1041
1042 func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
1043 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1044 return c
1045 }
1046
1047
1048 func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
1049 c.ctx_ = ctx
1050 return c
1051 }
1052
1053
1054
1055 func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
1056 if c.header_ == nil {
1057 c.header_ = make(http.Header)
1058 }
1059 return c.header_
1060 }
1061
1062 func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1063 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1064 var body io.Reader = nil
1065 body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
1066 if err != nil {
1067 return nil, err
1068 }
1069 c.urlParams_.Set("alt", alt)
1070 c.urlParams_.Set("prettyPrint", "false")
1071 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
1072 urls += "?" + c.urlParams_.Encode()
1073 req, err := http.NewRequest("POST", urls, body)
1074 if err != nil {
1075 return nil, err
1076 }
1077 req.Header = reqHeaders
1078 googleapi.Expand(req.URL, map[string]string{
1079 "parent": c.parent,
1080 })
1081 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1082 }
1083
1084
1085
1086
1087
1088
1089
1090 func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1091 gensupport.SetOptions(c.urlParams_, opts...)
1092 res, err := c.doRequest("json")
1093 if res != nil && res.StatusCode == http.StatusNotModified {
1094 if res.Body != nil {
1095 res.Body.Close()
1096 }
1097 return nil, gensupport.WrapError(&googleapi.Error{
1098 Code: res.StatusCode,
1099 Header: res.Header,
1100 })
1101 }
1102 if err != nil {
1103 return nil, err
1104 }
1105 defer googleapi.CloseBody(res)
1106 if err := googleapi.CheckResponse(res); err != nil {
1107 return nil, gensupport.WrapError(err)
1108 }
1109 ret := &SignSshPublicKeyResponse{
1110 ServerResponse: googleapi.ServerResponse{
1111 Header: res.Header,
1112 HTTPStatusCode: res.StatusCode,
1113 },
1114 }
1115 target := &ret
1116 if err := gensupport.DecodeResponse(target, res); err != nil {
1117 return nil, err
1118 }
1119 return ret, nil
1120 }
1121
1122 type UsersSshPublicKeysCreateCall struct {
1123 s *Service
1124 parent string
1125 sshpublickey *SshPublicKey
1126 urlParams_ gensupport.URLParams
1127 ctx_ context.Context
1128 header_ http.Header
1129 }
1130
1131
1132
1133
1134 func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
1135 c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1136 c.parent = parent
1137 c.sshpublickey = sshpublickey
1138 return c
1139 }
1140
1141
1142
1143
1144 func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
1145 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1146 return c
1147 }
1148
1149
1150 func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
1151 c.ctx_ = ctx
1152 return c
1153 }
1154
1155
1156
1157 func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
1158 if c.header_ == nil {
1159 c.header_ = make(http.Header)
1160 }
1161 return c.header_
1162 }
1163
1164 func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
1165 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1166 var body io.Reader = nil
1167 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
1168 if err != nil {
1169 return nil, err
1170 }
1171 c.urlParams_.Set("alt", alt)
1172 c.urlParams_.Set("prettyPrint", "false")
1173 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/sshPublicKeys")
1174 urls += "?" + c.urlParams_.Encode()
1175 req, err := http.NewRequest("POST", urls, body)
1176 if err != nil {
1177 return nil, err
1178 }
1179 req.Header = reqHeaders
1180 googleapi.Expand(req.URL, map[string]string{
1181 "parent": c.parent,
1182 })
1183 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1184 }
1185
1186
1187
1188
1189
1190
1191 func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1192 gensupport.SetOptions(c.urlParams_, opts...)
1193 res, err := c.doRequest("json")
1194 if res != nil && res.StatusCode == http.StatusNotModified {
1195 if res.Body != nil {
1196 res.Body.Close()
1197 }
1198 return nil, gensupport.WrapError(&googleapi.Error{
1199 Code: res.StatusCode,
1200 Header: res.Header,
1201 })
1202 }
1203 if err != nil {
1204 return nil, err
1205 }
1206 defer googleapi.CloseBody(res)
1207 if err := googleapi.CheckResponse(res); err != nil {
1208 return nil, gensupport.WrapError(err)
1209 }
1210 ret := &SshPublicKey{
1211 ServerResponse: googleapi.ServerResponse{
1212 Header: res.Header,
1213 HTTPStatusCode: res.StatusCode,
1214 },
1215 }
1216 target := &ret
1217 if err := gensupport.DecodeResponse(target, res); err != nil {
1218 return nil, err
1219 }
1220 return ret, nil
1221 }
1222
1223 type UsersSshPublicKeysDeleteCall struct {
1224 s *Service
1225 name string
1226 urlParams_ gensupport.URLParams
1227 ctx_ context.Context
1228 header_ http.Header
1229 }
1230
1231
1232
1233
1234
1235
1236 func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
1237 c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1238 c.name = name
1239 return c
1240 }
1241
1242
1243
1244
1245 func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
1246 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1247 return c
1248 }
1249
1250
1251 func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
1252 c.ctx_ = ctx
1253 return c
1254 }
1255
1256
1257
1258 func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
1259 if c.header_ == nil {
1260 c.header_ = make(http.Header)
1261 }
1262 return c.header_
1263 }
1264
1265 func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
1266 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1267 var body io.Reader = nil
1268 c.urlParams_.Set("alt", alt)
1269 c.urlParams_.Set("prettyPrint", "false")
1270 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1271 urls += "?" + c.urlParams_.Encode()
1272 req, err := http.NewRequest("DELETE", urls, body)
1273 if err != nil {
1274 return nil, err
1275 }
1276 req.Header = reqHeaders
1277 googleapi.Expand(req.URL, map[string]string{
1278 "name": c.name,
1279 })
1280 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1281 }
1282
1283
1284
1285
1286
1287
1288 func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1289 gensupport.SetOptions(c.urlParams_, opts...)
1290 res, err := c.doRequest("json")
1291 if res != nil && res.StatusCode == http.StatusNotModified {
1292 if res.Body != nil {
1293 res.Body.Close()
1294 }
1295 return nil, gensupport.WrapError(&googleapi.Error{
1296 Code: res.StatusCode,
1297 Header: res.Header,
1298 })
1299 }
1300 if err != nil {
1301 return nil, err
1302 }
1303 defer googleapi.CloseBody(res)
1304 if err := googleapi.CheckResponse(res); err != nil {
1305 return nil, gensupport.WrapError(err)
1306 }
1307 ret := &Empty{
1308 ServerResponse: googleapi.ServerResponse{
1309 Header: res.Header,
1310 HTTPStatusCode: res.StatusCode,
1311 },
1312 }
1313 target := &ret
1314 if err := gensupport.DecodeResponse(target, res); err != nil {
1315 return nil, err
1316 }
1317 return ret, nil
1318 }
1319
1320 type UsersSshPublicKeysGetCall struct {
1321 s *Service
1322 name string
1323 urlParams_ gensupport.URLParams
1324 ifNoneMatch_ string
1325 ctx_ context.Context
1326 header_ http.Header
1327 }
1328
1329
1330
1331
1332
1333
1334 func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
1335 c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1336 c.name = name
1337 return c
1338 }
1339
1340
1341
1342
1343 func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
1344 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1345 return c
1346 }
1347
1348
1349
1350
1351 func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
1352 c.ifNoneMatch_ = entityTag
1353 return c
1354 }
1355
1356
1357 func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
1358 c.ctx_ = ctx
1359 return c
1360 }
1361
1362
1363
1364 func (c *UsersSshPublicKeysGetCall) Header() http.Header {
1365 if c.header_ == nil {
1366 c.header_ = make(http.Header)
1367 }
1368 return c.header_
1369 }
1370
1371 func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
1372 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1373 if c.ifNoneMatch_ != "" {
1374 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1375 }
1376 var body io.Reader = nil
1377 c.urlParams_.Set("alt", alt)
1378 c.urlParams_.Set("prettyPrint", "false")
1379 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1380 urls += "?" + c.urlParams_.Encode()
1381 req, err := http.NewRequest("GET", urls, body)
1382 if err != nil {
1383 return nil, err
1384 }
1385 req.Header = reqHeaders
1386 googleapi.Expand(req.URL, map[string]string{
1387 "name": c.name,
1388 })
1389 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1390 }
1391
1392
1393
1394
1395
1396
1397 func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1398 gensupport.SetOptions(c.urlParams_, opts...)
1399 res, err := c.doRequest("json")
1400 if res != nil && res.StatusCode == http.StatusNotModified {
1401 if res.Body != nil {
1402 res.Body.Close()
1403 }
1404 return nil, gensupport.WrapError(&googleapi.Error{
1405 Code: res.StatusCode,
1406 Header: res.Header,
1407 })
1408 }
1409 if err != nil {
1410 return nil, err
1411 }
1412 defer googleapi.CloseBody(res)
1413 if err := googleapi.CheckResponse(res); err != nil {
1414 return nil, gensupport.WrapError(err)
1415 }
1416 ret := &SshPublicKey{
1417 ServerResponse: googleapi.ServerResponse{
1418 Header: res.Header,
1419 HTTPStatusCode: res.StatusCode,
1420 },
1421 }
1422 target := &ret
1423 if err := gensupport.DecodeResponse(target, res); err != nil {
1424 return nil, err
1425 }
1426 return ret, nil
1427 }
1428
1429 type UsersSshPublicKeysPatchCall struct {
1430 s *Service
1431 name string
1432 sshpublickey *SshPublicKey
1433 urlParams_ gensupport.URLParams
1434 ctx_ context.Context
1435 header_ http.Header
1436 }
1437
1438
1439
1440
1441
1442
1443
1444 func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
1445 c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1446 c.name = name
1447 c.sshpublickey = sshpublickey
1448 return c
1449 }
1450
1451
1452
1453 func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
1454 c.urlParams_.Set("updateMask", updateMask)
1455 return c
1456 }
1457
1458
1459
1460
1461 func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
1462 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1463 return c
1464 }
1465
1466
1467 func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
1468 c.ctx_ = ctx
1469 return c
1470 }
1471
1472
1473
1474 func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
1475 if c.header_ == nil {
1476 c.header_ = make(http.Header)
1477 }
1478 return c.header_
1479 }
1480
1481 func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
1482 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1483 var body io.Reader = nil
1484 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
1485 if err != nil {
1486 return nil, err
1487 }
1488 c.urlParams_.Set("alt", alt)
1489 c.urlParams_.Set("prettyPrint", "false")
1490 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1491 urls += "?" + c.urlParams_.Encode()
1492 req, err := http.NewRequest("PATCH", urls, body)
1493 if err != nil {
1494 return nil, err
1495 }
1496 req.Header = reqHeaders
1497 googleapi.Expand(req.URL, map[string]string{
1498 "name": c.name,
1499 })
1500 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1501 }
1502
1503
1504
1505
1506
1507
1508 func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1509 gensupport.SetOptions(c.urlParams_, opts...)
1510 res, err := c.doRequest("json")
1511 if res != nil && res.StatusCode == http.StatusNotModified {
1512 if res.Body != nil {
1513 res.Body.Close()
1514 }
1515 return nil, gensupport.WrapError(&googleapi.Error{
1516 Code: res.StatusCode,
1517 Header: res.Header,
1518 })
1519 }
1520 if err != nil {
1521 return nil, err
1522 }
1523 defer googleapi.CloseBody(res)
1524 if err := googleapi.CheckResponse(res); err != nil {
1525 return nil, gensupport.WrapError(err)
1526 }
1527 ret := &SshPublicKey{
1528 ServerResponse: googleapi.ServerResponse{
1529 Header: res.Header,
1530 HTTPStatusCode: res.StatusCode,
1531 },
1532 }
1533 target := &ret
1534 if err := gensupport.DecodeResponse(target, res); err != nil {
1535 return nil, err
1536 }
1537 return ret, nil
1538 }
1539
View as plain text