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 package bigqueryconnection
57
58 import (
59 "bytes"
60 "context"
61 "encoding/json"
62 "errors"
63 "fmt"
64 "io"
65 "net/http"
66 "net/url"
67 "strconv"
68 "strings"
69
70 googleapi "google.golang.org/api/googleapi"
71 internal "google.golang.org/api/internal"
72 gensupport "google.golang.org/api/internal/gensupport"
73 option "google.golang.org/api/option"
74 internaloption "google.golang.org/api/option/internaloption"
75 htransport "google.golang.org/api/transport/http"
76 )
77
78
79
80 var _ = bytes.NewBuffer
81 var _ = strconv.Itoa
82 var _ = fmt.Sprintf
83 var _ = json.NewDecoder
84 var _ = io.Copy
85 var _ = url.Parse
86 var _ = gensupport.MarshalJSON
87 var _ = googleapi.Version
88 var _ = errors.New
89 var _ = strings.Replace
90 var _ = context.Canceled
91 var _ = internaloption.WithDefaultEndpoint
92 var _ = internal.Version
93
94 const apiId = "bigqueryconnection:v1beta1"
95 const apiName = "bigqueryconnection"
96 const apiVersion = "v1beta1"
97 const basePath = "https://bigqueryconnection.googleapis.com/"
98 const basePathTemplate = "https://bigqueryconnection.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://bigqueryconnection.mtls.googleapis.com/"
100
101
102 const (
103
104
105 BigqueryScope = "https://www.googleapis.com/auth/bigquery"
106
107
108
109 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
110 )
111
112
113 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
114 scopesOption := internaloption.WithDefaultScopes(
115 "https://www.googleapis.com/auth/bigquery",
116 "https://www.googleapis.com/auth/cloud-platform",
117 )
118
119 opts = append([]option.ClientOption{scopesOption}, opts...)
120 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
121 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
122 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
123 opts = append(opts, internaloption.EnableNewAuthLibrary())
124 client, endpoint, err := htransport.NewClient(ctx, opts...)
125 if err != nil {
126 return nil, err
127 }
128 s, err := New(client)
129 if err != nil {
130 return nil, err
131 }
132 if endpoint != "" {
133 s.BasePath = endpoint
134 }
135 return s, nil
136 }
137
138
139
140
141
142
143 func New(client *http.Client) (*Service, error) {
144 if client == nil {
145 return nil, errors.New("client is nil")
146 }
147 s := &Service{client: client, BasePath: basePath}
148 s.Projects = NewProjectsService(s)
149 return s, nil
150 }
151
152 type Service struct {
153 client *http.Client
154 BasePath string
155 UserAgent string
156
157 Projects *ProjectsService
158 }
159
160 func (s *Service) userAgent() string {
161 if s.UserAgent == "" {
162 return googleapi.UserAgent
163 }
164 return googleapi.UserAgent + " " + s.UserAgent
165 }
166
167 func NewProjectsService(s *Service) *ProjectsService {
168 rs := &ProjectsService{s: s}
169 rs.Locations = NewProjectsLocationsService(s)
170 return rs
171 }
172
173 type ProjectsService struct {
174 s *Service
175
176 Locations *ProjectsLocationsService
177 }
178
179 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
180 rs := &ProjectsLocationsService{s: s}
181 rs.Connections = NewProjectsLocationsConnectionsService(s)
182 return rs
183 }
184
185 type ProjectsLocationsService struct {
186 s *Service
187
188 Connections *ProjectsLocationsConnectionsService
189 }
190
191 func NewProjectsLocationsConnectionsService(s *Service) *ProjectsLocationsConnectionsService {
192 rs := &ProjectsLocationsConnectionsService{s: s}
193 return rs
194 }
195
196 type ProjectsLocationsConnectionsService struct {
197 s *Service
198 }
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 type AuditConfig struct {
217
218 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
219
220
221
222 Service string `json:"service,omitempty"`
223
224
225
226
227
228 ForceSendFields []string `json:"-"`
229
230
231
232
233 NullFields []string `json:"-"`
234 }
235
236 func (s *AuditConfig) MarshalJSON() ([]byte, error) {
237 type NoMethod AuditConfig
238 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
239 }
240
241
242
243
244
245
246 type AuditLogConfig struct {
247
248
249 ExemptedMembers []string `json:"exemptedMembers,omitempty"`
250
251
252
253
254
255
256
257 LogType string `json:"logType,omitempty"`
258
259
260
261
262
263 ForceSendFields []string `json:"-"`
264
265
266
267
268 NullFields []string `json:"-"`
269 }
270
271 func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
272 type NoMethod AuditLogConfig
273 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
274 }
275
276
277 type Binding struct {
278
279
280
281
282
283
284
285
286 Condition *Expr `json:"condition,omitempty"`
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349 Members []string `json:"members,omitempty"`
350
351
352
353
354
355
356 Role string `json:"role,omitempty"`
357
358
359
360
361
362 ForceSendFields []string `json:"-"`
363
364
365
366
367 NullFields []string `json:"-"`
368 }
369
370 func (s *Binding) MarshalJSON() ([]byte, error) {
371 type NoMethod Binding
372 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
373 }
374
375
376 type CloudSqlCredential struct {
377
378 Password string `json:"password,omitempty"`
379
380 Username string `json:"username,omitempty"`
381
382
383
384
385
386 ForceSendFields []string `json:"-"`
387
388
389
390
391 NullFields []string `json:"-"`
392 }
393
394 func (s *CloudSqlCredential) MarshalJSON() ([]byte, error) {
395 type NoMethod CloudSqlCredential
396 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
397 }
398
399
400 type CloudSqlProperties struct {
401
402 Credential *CloudSqlCredential `json:"credential,omitempty"`
403
404 Database string `json:"database,omitempty"`
405
406 InstanceId string `json:"instanceId,omitempty"`
407
408
409
410
411 ServiceAccountId string `json:"serviceAccountId,omitempty"`
412
413
414
415
416
417
418 Type string `json:"type,omitempty"`
419
420
421
422
423
424 ForceSendFields []string `json:"-"`
425
426
427
428
429 NullFields []string `json:"-"`
430 }
431
432 func (s *CloudSqlProperties) MarshalJSON() ([]byte, error) {
433 type NoMethod CloudSqlProperties
434 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
435 }
436
437
438
439 type Connection struct {
440
441 CloudSql *CloudSqlProperties `json:"cloudSql,omitempty"`
442
443 CreationTime int64 `json:"creationTime,omitempty,string"`
444
445 Description string `json:"description,omitempty"`
446
447 FriendlyName string `json:"friendlyName,omitempty"`
448
449
450 HasCredential bool `json:"hasCredential,omitempty"`
451
452 LastModifiedTime int64 `json:"lastModifiedTime,omitempty,string"`
453
454
455 Name string `json:"name,omitempty"`
456
457
458 googleapi.ServerResponse `json:"-"`
459
460
461
462
463
464 ForceSendFields []string `json:"-"`
465
466
467
468
469 NullFields []string `json:"-"`
470 }
471
472 func (s *Connection) MarshalJSON() ([]byte, error) {
473 type NoMethod Connection
474 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
475 }
476
477
478 type ConnectionCredential struct {
479
480 CloudSql *CloudSqlCredential `json:"cloudSql,omitempty"`
481
482
483
484
485
486 ForceSendFields []string `json:"-"`
487
488
489
490
491 NullFields []string `json:"-"`
492 }
493
494 func (s *ConnectionCredential) MarshalJSON() ([]byte, error) {
495 type NoMethod ConnectionCredential
496 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
497 }
498
499
500
501
502
503 type Empty struct {
504
505 googleapi.ServerResponse `json:"-"`
506 }
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524 type Expr struct {
525
526
527 Description string `json:"description,omitempty"`
528
529
530 Expression string `json:"expression,omitempty"`
531
532
533 Location string `json:"location,omitempty"`
534
535
536
537 Title string `json:"title,omitempty"`
538
539
540
541
542
543 ForceSendFields []string `json:"-"`
544
545
546
547
548 NullFields []string `json:"-"`
549 }
550
551 func (s *Expr) MarshalJSON() ([]byte, error) {
552 type NoMethod Expr
553 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
554 }
555
556
557 type GetIamPolicyRequest struct {
558
559
560 Options *GetPolicyOptions `json:"options,omitempty"`
561
562
563
564
565
566 ForceSendFields []string `json:"-"`
567
568
569
570
571 NullFields []string `json:"-"`
572 }
573
574 func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) {
575 type NoMethod GetIamPolicyRequest
576 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
577 }
578
579
580 type GetPolicyOptions struct {
581
582
583
584
585
586
587
588
589
590
591
592 RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"`
593
594
595
596
597
598 ForceSendFields []string `json:"-"`
599
600
601
602
603 NullFields []string `json:"-"`
604 }
605
606 func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) {
607 type NoMethod GetPolicyOptions
608 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
609 }
610
611
612 type ListConnectionsResponse struct {
613
614 Connections []*Connection `json:"connections,omitempty"`
615
616 NextPageToken string `json:"nextPageToken,omitempty"`
617
618
619 googleapi.ServerResponse `json:"-"`
620
621
622
623
624
625 ForceSendFields []string `json:"-"`
626
627
628
629
630 NullFields []string `json:"-"`
631 }
632
633 func (s *ListConnectionsResponse) MarshalJSON() ([]byte, error) {
634 type NoMethod ListConnectionsResponse
635 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
636 }
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668 type Policy struct {
669
670 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
671
672
673
674
675
676
677
678
679
680 Bindings []*Binding `json:"bindings,omitempty"`
681
682
683
684
685
686
687
688
689
690
691
692 Etag string `json:"etag,omitempty"`
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708 Version int64 `json:"version,omitempty"`
709
710
711 googleapi.ServerResponse `json:"-"`
712
713
714
715
716
717 ForceSendFields []string `json:"-"`
718
719
720
721
722 NullFields []string `json:"-"`
723 }
724
725 func (s *Policy) MarshalJSON() ([]byte, error) {
726 type NoMethod Policy
727 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
728 }
729
730
731 type SetIamPolicyRequest struct {
732
733
734
735
736 Policy *Policy `json:"policy,omitempty"`
737
738
739
740 UpdateMask string `json:"updateMask,omitempty"`
741
742
743
744
745
746 ForceSendFields []string `json:"-"`
747
748
749
750
751 NullFields []string `json:"-"`
752 }
753
754 func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
755 type NoMethod SetIamPolicyRequest
756 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
757 }
758
759
760 type TestIamPermissionsRequest struct {
761
762
763
764
765 Permissions []string `json:"permissions,omitempty"`
766
767
768
769
770
771 ForceSendFields []string `json:"-"`
772
773
774
775
776 NullFields []string `json:"-"`
777 }
778
779 func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
780 type NoMethod TestIamPermissionsRequest
781 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
782 }
783
784
785
786 type TestIamPermissionsResponse struct {
787
788
789 Permissions []string `json:"permissions,omitempty"`
790
791
792 googleapi.ServerResponse `json:"-"`
793
794
795
796
797
798 ForceSendFields []string `json:"-"`
799
800
801
802
803 NullFields []string `json:"-"`
804 }
805
806 func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
807 type NoMethod TestIamPermissionsResponse
808 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
809 }
810
811 type ProjectsLocationsConnectionsCreateCall struct {
812 s *Service
813 parent string
814 connection *Connection
815 urlParams_ gensupport.URLParams
816 ctx_ context.Context
817 header_ http.Header
818 }
819
820
821
822
823
824 func (r *ProjectsLocationsConnectionsService) Create(parent string, connection *Connection) *ProjectsLocationsConnectionsCreateCall {
825 c := &ProjectsLocationsConnectionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
826 c.parent = parent
827 c.connection = connection
828 return c
829 }
830
831
832
833 func (c *ProjectsLocationsConnectionsCreateCall) ConnectionId(connectionId string) *ProjectsLocationsConnectionsCreateCall {
834 c.urlParams_.Set("connectionId", connectionId)
835 return c
836 }
837
838
839
840
841 func (c *ProjectsLocationsConnectionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsCreateCall {
842 c.urlParams_.Set("fields", googleapi.CombineFields(s))
843 return c
844 }
845
846
847 func (c *ProjectsLocationsConnectionsCreateCall) Context(ctx context.Context) *ProjectsLocationsConnectionsCreateCall {
848 c.ctx_ = ctx
849 return c
850 }
851
852
853
854 func (c *ProjectsLocationsConnectionsCreateCall) Header() http.Header {
855 if c.header_ == nil {
856 c.header_ = make(http.Header)
857 }
858 return c.header_
859 }
860
861 func (c *ProjectsLocationsConnectionsCreateCall) doRequest(alt string) (*http.Response, error) {
862 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
863 var body io.Reader = nil
864 body, err := googleapi.WithoutDataWrapper.JSONReader(c.connection)
865 if err != nil {
866 return nil, err
867 }
868 c.urlParams_.Set("alt", alt)
869 c.urlParams_.Set("prettyPrint", "false")
870 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/connections")
871 urls += "?" + c.urlParams_.Encode()
872 req, err := http.NewRequest("POST", urls, body)
873 if err != nil {
874 return nil, err
875 }
876 req.Header = reqHeaders
877 googleapi.Expand(req.URL, map[string]string{
878 "parent": c.parent,
879 })
880 return gensupport.SendRequest(c.ctx_, c.s.client, req)
881 }
882
883
884
885
886
887
888 func (c *ProjectsLocationsConnectionsCreateCall) Do(opts ...googleapi.CallOption) (*Connection, error) {
889 gensupport.SetOptions(c.urlParams_, opts...)
890 res, err := c.doRequest("json")
891 if res != nil && res.StatusCode == http.StatusNotModified {
892 if res.Body != nil {
893 res.Body.Close()
894 }
895 return nil, gensupport.WrapError(&googleapi.Error{
896 Code: res.StatusCode,
897 Header: res.Header,
898 })
899 }
900 if err != nil {
901 return nil, err
902 }
903 defer googleapi.CloseBody(res)
904 if err := googleapi.CheckResponse(res); err != nil {
905 return nil, gensupport.WrapError(err)
906 }
907 ret := &Connection{
908 ServerResponse: googleapi.ServerResponse{
909 Header: res.Header,
910 HTTPStatusCode: res.StatusCode,
911 },
912 }
913 target := &ret
914 if err := gensupport.DecodeResponse(target, res); err != nil {
915 return nil, err
916 }
917 return ret, nil
918 }
919
920 type ProjectsLocationsConnectionsDeleteCall struct {
921 s *Service
922 name string
923 urlParams_ gensupport.URLParams
924 ctx_ context.Context
925 header_ http.Header
926 }
927
928
929
930
931
932 func (r *ProjectsLocationsConnectionsService) Delete(name string) *ProjectsLocationsConnectionsDeleteCall {
933 c := &ProjectsLocationsConnectionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
934 c.name = name
935 return c
936 }
937
938
939
940
941 func (c *ProjectsLocationsConnectionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsDeleteCall {
942 c.urlParams_.Set("fields", googleapi.CombineFields(s))
943 return c
944 }
945
946
947 func (c *ProjectsLocationsConnectionsDeleteCall) Context(ctx context.Context) *ProjectsLocationsConnectionsDeleteCall {
948 c.ctx_ = ctx
949 return c
950 }
951
952
953
954 func (c *ProjectsLocationsConnectionsDeleteCall) Header() http.Header {
955 if c.header_ == nil {
956 c.header_ = make(http.Header)
957 }
958 return c.header_
959 }
960
961 func (c *ProjectsLocationsConnectionsDeleteCall) doRequest(alt string) (*http.Response, error) {
962 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
963 var body io.Reader = nil
964 c.urlParams_.Set("alt", alt)
965 c.urlParams_.Set("prettyPrint", "false")
966 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
967 urls += "?" + c.urlParams_.Encode()
968 req, err := http.NewRequest("DELETE", urls, body)
969 if err != nil {
970 return nil, err
971 }
972 req.Header = reqHeaders
973 googleapi.Expand(req.URL, map[string]string{
974 "name": c.name,
975 })
976 return gensupport.SendRequest(c.ctx_, c.s.client, req)
977 }
978
979
980
981
982
983
984 func (c *ProjectsLocationsConnectionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, 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 := &Empty{
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 ProjectsLocationsConnectionsGetCall struct {
1017 s *Service
1018 name string
1019 urlParams_ gensupport.URLParams
1020 ifNoneMatch_ string
1021 ctx_ context.Context
1022 header_ http.Header
1023 }
1024
1025
1026
1027
1028
1029 func (r *ProjectsLocationsConnectionsService) Get(name string) *ProjectsLocationsConnectionsGetCall {
1030 c := &ProjectsLocationsConnectionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1031 c.name = name
1032 return c
1033 }
1034
1035
1036
1037
1038 func (c *ProjectsLocationsConnectionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsGetCall {
1039 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1040 return c
1041 }
1042
1043
1044
1045
1046 func (c *ProjectsLocationsConnectionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsConnectionsGetCall {
1047 c.ifNoneMatch_ = entityTag
1048 return c
1049 }
1050
1051
1052 func (c *ProjectsLocationsConnectionsGetCall) Context(ctx context.Context) *ProjectsLocationsConnectionsGetCall {
1053 c.ctx_ = ctx
1054 return c
1055 }
1056
1057
1058
1059 func (c *ProjectsLocationsConnectionsGetCall) Header() http.Header {
1060 if c.header_ == nil {
1061 c.header_ = make(http.Header)
1062 }
1063 return c.header_
1064 }
1065
1066 func (c *ProjectsLocationsConnectionsGetCall) doRequest(alt string) (*http.Response, error) {
1067 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1068 if c.ifNoneMatch_ != "" {
1069 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1070 }
1071 var body io.Reader = nil
1072 c.urlParams_.Set("alt", alt)
1073 c.urlParams_.Set("prettyPrint", "false")
1074 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1075 urls += "?" + c.urlParams_.Encode()
1076 req, err := http.NewRequest("GET", urls, body)
1077 if err != nil {
1078 return nil, err
1079 }
1080 req.Header = reqHeaders
1081 googleapi.Expand(req.URL, map[string]string{
1082 "name": c.name,
1083 })
1084 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1085 }
1086
1087
1088
1089
1090
1091
1092 func (c *ProjectsLocationsConnectionsGetCall) Do(opts ...googleapi.CallOption) (*Connection, error) {
1093 gensupport.SetOptions(c.urlParams_, opts...)
1094 res, err := c.doRequest("json")
1095 if res != nil && res.StatusCode == http.StatusNotModified {
1096 if res.Body != nil {
1097 res.Body.Close()
1098 }
1099 return nil, gensupport.WrapError(&googleapi.Error{
1100 Code: res.StatusCode,
1101 Header: res.Header,
1102 })
1103 }
1104 if err != nil {
1105 return nil, err
1106 }
1107 defer googleapi.CloseBody(res)
1108 if err := googleapi.CheckResponse(res); err != nil {
1109 return nil, gensupport.WrapError(err)
1110 }
1111 ret := &Connection{
1112 ServerResponse: googleapi.ServerResponse{
1113 Header: res.Header,
1114 HTTPStatusCode: res.StatusCode,
1115 },
1116 }
1117 target := &ret
1118 if err := gensupport.DecodeResponse(target, res); err != nil {
1119 return nil, err
1120 }
1121 return ret, nil
1122 }
1123
1124 type ProjectsLocationsConnectionsGetIamPolicyCall struct {
1125 s *Service
1126 resource string
1127 getiampolicyrequest *GetIamPolicyRequest
1128 urlParams_ gensupport.URLParams
1129 ctx_ context.Context
1130 header_ http.Header
1131 }
1132
1133
1134
1135
1136
1137
1138
1139 func (r *ProjectsLocationsConnectionsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsConnectionsGetIamPolicyCall {
1140 c := &ProjectsLocationsConnectionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1141 c.resource = resource
1142 c.getiampolicyrequest = getiampolicyrequest
1143 return c
1144 }
1145
1146
1147
1148
1149 func (c *ProjectsLocationsConnectionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsGetIamPolicyCall {
1150 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1151 return c
1152 }
1153
1154
1155 func (c *ProjectsLocationsConnectionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsConnectionsGetIamPolicyCall {
1156 c.ctx_ = ctx
1157 return c
1158 }
1159
1160
1161
1162 func (c *ProjectsLocationsConnectionsGetIamPolicyCall) Header() http.Header {
1163 if c.header_ == nil {
1164 c.header_ = make(http.Header)
1165 }
1166 return c.header_
1167 }
1168
1169 func (c *ProjectsLocationsConnectionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
1170 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1171 var body io.Reader = nil
1172 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
1173 if err != nil {
1174 return nil, err
1175 }
1176 c.urlParams_.Set("alt", alt)
1177 c.urlParams_.Set("prettyPrint", "false")
1178 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
1179 urls += "?" + c.urlParams_.Encode()
1180 req, err := http.NewRequest("POST", urls, body)
1181 if err != nil {
1182 return nil, err
1183 }
1184 req.Header = reqHeaders
1185 googleapi.Expand(req.URL, map[string]string{
1186 "resource": c.resource,
1187 })
1188 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1189 }
1190
1191
1192
1193
1194
1195
1196 func (c *ProjectsLocationsConnectionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
1197 gensupport.SetOptions(c.urlParams_, opts...)
1198 res, err := c.doRequest("json")
1199 if res != nil && res.StatusCode == http.StatusNotModified {
1200 if res.Body != nil {
1201 res.Body.Close()
1202 }
1203 return nil, gensupport.WrapError(&googleapi.Error{
1204 Code: res.StatusCode,
1205 Header: res.Header,
1206 })
1207 }
1208 if err != nil {
1209 return nil, err
1210 }
1211 defer googleapi.CloseBody(res)
1212 if err := googleapi.CheckResponse(res); err != nil {
1213 return nil, gensupport.WrapError(err)
1214 }
1215 ret := &Policy{
1216 ServerResponse: googleapi.ServerResponse{
1217 Header: res.Header,
1218 HTTPStatusCode: res.StatusCode,
1219 },
1220 }
1221 target := &ret
1222 if err := gensupport.DecodeResponse(target, res); err != nil {
1223 return nil, err
1224 }
1225 return ret, nil
1226 }
1227
1228 type ProjectsLocationsConnectionsListCall struct {
1229 s *Service
1230 parent string
1231 urlParams_ gensupport.URLParams
1232 ifNoneMatch_ string
1233 ctx_ context.Context
1234 header_ http.Header
1235 }
1236
1237
1238
1239
1240
1241 func (r *ProjectsLocationsConnectionsService) List(parent string) *ProjectsLocationsConnectionsListCall {
1242 c := &ProjectsLocationsConnectionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1243 c.parent = parent
1244 return c
1245 }
1246
1247
1248
1249 func (c *ProjectsLocationsConnectionsListCall) MaxResults(maxResults int64) *ProjectsLocationsConnectionsListCall {
1250 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1251 return c
1252 }
1253
1254
1255 func (c *ProjectsLocationsConnectionsListCall) PageToken(pageToken string) *ProjectsLocationsConnectionsListCall {
1256 c.urlParams_.Set("pageToken", pageToken)
1257 return c
1258 }
1259
1260
1261
1262
1263 func (c *ProjectsLocationsConnectionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsListCall {
1264 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1265 return c
1266 }
1267
1268
1269
1270
1271 func (c *ProjectsLocationsConnectionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsConnectionsListCall {
1272 c.ifNoneMatch_ = entityTag
1273 return c
1274 }
1275
1276
1277 func (c *ProjectsLocationsConnectionsListCall) Context(ctx context.Context) *ProjectsLocationsConnectionsListCall {
1278 c.ctx_ = ctx
1279 return c
1280 }
1281
1282
1283
1284 func (c *ProjectsLocationsConnectionsListCall) Header() http.Header {
1285 if c.header_ == nil {
1286 c.header_ = make(http.Header)
1287 }
1288 return c.header_
1289 }
1290
1291 func (c *ProjectsLocationsConnectionsListCall) doRequest(alt string) (*http.Response, error) {
1292 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1293 if c.ifNoneMatch_ != "" {
1294 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1295 }
1296 var body io.Reader = nil
1297 c.urlParams_.Set("alt", alt)
1298 c.urlParams_.Set("prettyPrint", "false")
1299 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/connections")
1300 urls += "?" + c.urlParams_.Encode()
1301 req, err := http.NewRequest("GET", urls, body)
1302 if err != nil {
1303 return nil, err
1304 }
1305 req.Header = reqHeaders
1306 googleapi.Expand(req.URL, map[string]string{
1307 "parent": c.parent,
1308 })
1309 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1310 }
1311
1312
1313
1314
1315
1316
1317
1318 func (c *ProjectsLocationsConnectionsListCall) Do(opts ...googleapi.CallOption) (*ListConnectionsResponse, error) {
1319 gensupport.SetOptions(c.urlParams_, opts...)
1320 res, err := c.doRequest("json")
1321 if res != nil && res.StatusCode == http.StatusNotModified {
1322 if res.Body != nil {
1323 res.Body.Close()
1324 }
1325 return nil, gensupport.WrapError(&googleapi.Error{
1326 Code: res.StatusCode,
1327 Header: res.Header,
1328 })
1329 }
1330 if err != nil {
1331 return nil, err
1332 }
1333 defer googleapi.CloseBody(res)
1334 if err := googleapi.CheckResponse(res); err != nil {
1335 return nil, gensupport.WrapError(err)
1336 }
1337 ret := &ListConnectionsResponse{
1338 ServerResponse: googleapi.ServerResponse{
1339 Header: res.Header,
1340 HTTPStatusCode: res.StatusCode,
1341 },
1342 }
1343 target := &ret
1344 if err := gensupport.DecodeResponse(target, res); err != nil {
1345 return nil, err
1346 }
1347 return ret, nil
1348 }
1349
1350
1351
1352
1353 func (c *ProjectsLocationsConnectionsListCall) Pages(ctx context.Context, f func(*ListConnectionsResponse) error) error {
1354 c.ctx_ = ctx
1355 defer c.PageToken(c.urlParams_.Get("pageToken"))
1356 for {
1357 x, err := c.Do()
1358 if err != nil {
1359 return err
1360 }
1361 if err := f(x); err != nil {
1362 return err
1363 }
1364 if x.NextPageToken == "" {
1365 return nil
1366 }
1367 c.PageToken(x.NextPageToken)
1368 }
1369 }
1370
1371 type ProjectsLocationsConnectionsPatchCall struct {
1372 s *Service
1373 name string
1374 connection *Connection
1375 urlParams_ gensupport.URLParams
1376 ctx_ context.Context
1377 header_ http.Header
1378 }
1379
1380
1381
1382
1383
1384
1385 func (r *ProjectsLocationsConnectionsService) Patch(name string, connection *Connection) *ProjectsLocationsConnectionsPatchCall {
1386 c := &ProjectsLocationsConnectionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1387 c.name = name
1388 c.connection = connection
1389 return c
1390 }
1391
1392
1393
1394 func (c *ProjectsLocationsConnectionsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsConnectionsPatchCall {
1395 c.urlParams_.Set("updateMask", updateMask)
1396 return c
1397 }
1398
1399
1400
1401
1402 func (c *ProjectsLocationsConnectionsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsPatchCall {
1403 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1404 return c
1405 }
1406
1407
1408 func (c *ProjectsLocationsConnectionsPatchCall) Context(ctx context.Context) *ProjectsLocationsConnectionsPatchCall {
1409 c.ctx_ = ctx
1410 return c
1411 }
1412
1413
1414
1415 func (c *ProjectsLocationsConnectionsPatchCall) Header() http.Header {
1416 if c.header_ == nil {
1417 c.header_ = make(http.Header)
1418 }
1419 return c.header_
1420 }
1421
1422 func (c *ProjectsLocationsConnectionsPatchCall) doRequest(alt string) (*http.Response, error) {
1423 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1424 var body io.Reader = nil
1425 body, err := googleapi.WithoutDataWrapper.JSONReader(c.connection)
1426 if err != nil {
1427 return nil, err
1428 }
1429 c.urlParams_.Set("alt", alt)
1430 c.urlParams_.Set("prettyPrint", "false")
1431 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1432 urls += "?" + c.urlParams_.Encode()
1433 req, err := http.NewRequest("PATCH", urls, body)
1434 if err != nil {
1435 return nil, err
1436 }
1437 req.Header = reqHeaders
1438 googleapi.Expand(req.URL, map[string]string{
1439 "name": c.name,
1440 })
1441 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1442 }
1443
1444
1445
1446
1447
1448
1449 func (c *ProjectsLocationsConnectionsPatchCall) Do(opts ...googleapi.CallOption) (*Connection, error) {
1450 gensupport.SetOptions(c.urlParams_, opts...)
1451 res, err := c.doRequest("json")
1452 if res != nil && res.StatusCode == http.StatusNotModified {
1453 if res.Body != nil {
1454 res.Body.Close()
1455 }
1456 return nil, gensupport.WrapError(&googleapi.Error{
1457 Code: res.StatusCode,
1458 Header: res.Header,
1459 })
1460 }
1461 if err != nil {
1462 return nil, err
1463 }
1464 defer googleapi.CloseBody(res)
1465 if err := googleapi.CheckResponse(res); err != nil {
1466 return nil, gensupport.WrapError(err)
1467 }
1468 ret := &Connection{
1469 ServerResponse: googleapi.ServerResponse{
1470 Header: res.Header,
1471 HTTPStatusCode: res.StatusCode,
1472 },
1473 }
1474 target := &ret
1475 if err := gensupport.DecodeResponse(target, res); err != nil {
1476 return nil, err
1477 }
1478 return ret, nil
1479 }
1480
1481 type ProjectsLocationsConnectionsSetIamPolicyCall struct {
1482 s *Service
1483 resource string
1484 setiampolicyrequest *SetIamPolicyRequest
1485 urlParams_ gensupport.URLParams
1486 ctx_ context.Context
1487 header_ http.Header
1488 }
1489
1490
1491
1492
1493
1494
1495
1496
1497 func (r *ProjectsLocationsConnectionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsConnectionsSetIamPolicyCall {
1498 c := &ProjectsLocationsConnectionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1499 c.resource = resource
1500 c.setiampolicyrequest = setiampolicyrequest
1501 return c
1502 }
1503
1504
1505
1506
1507 func (c *ProjectsLocationsConnectionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsSetIamPolicyCall {
1508 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1509 return c
1510 }
1511
1512
1513 func (c *ProjectsLocationsConnectionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsConnectionsSetIamPolicyCall {
1514 c.ctx_ = ctx
1515 return c
1516 }
1517
1518
1519
1520 func (c *ProjectsLocationsConnectionsSetIamPolicyCall) Header() http.Header {
1521 if c.header_ == nil {
1522 c.header_ = make(http.Header)
1523 }
1524 return c.header_
1525 }
1526
1527 func (c *ProjectsLocationsConnectionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
1528 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1529 var body io.Reader = nil
1530 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
1531 if err != nil {
1532 return nil, err
1533 }
1534 c.urlParams_.Set("alt", alt)
1535 c.urlParams_.Set("prettyPrint", "false")
1536 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
1537 urls += "?" + c.urlParams_.Encode()
1538 req, err := http.NewRequest("POST", urls, body)
1539 if err != nil {
1540 return nil, err
1541 }
1542 req.Header = reqHeaders
1543 googleapi.Expand(req.URL, map[string]string{
1544 "resource": c.resource,
1545 })
1546 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1547 }
1548
1549
1550
1551
1552
1553
1554 func (c *ProjectsLocationsConnectionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
1555 gensupport.SetOptions(c.urlParams_, opts...)
1556 res, err := c.doRequest("json")
1557 if res != nil && res.StatusCode == http.StatusNotModified {
1558 if res.Body != nil {
1559 res.Body.Close()
1560 }
1561 return nil, gensupport.WrapError(&googleapi.Error{
1562 Code: res.StatusCode,
1563 Header: res.Header,
1564 })
1565 }
1566 if err != nil {
1567 return nil, err
1568 }
1569 defer googleapi.CloseBody(res)
1570 if err := googleapi.CheckResponse(res); err != nil {
1571 return nil, gensupport.WrapError(err)
1572 }
1573 ret := &Policy{
1574 ServerResponse: googleapi.ServerResponse{
1575 Header: res.Header,
1576 HTTPStatusCode: res.StatusCode,
1577 },
1578 }
1579 target := &ret
1580 if err := gensupport.DecodeResponse(target, res); err != nil {
1581 return nil, err
1582 }
1583 return ret, nil
1584 }
1585
1586 type ProjectsLocationsConnectionsTestIamPermissionsCall struct {
1587 s *Service
1588 resource string
1589 testiampermissionsrequest *TestIamPermissionsRequest
1590 urlParams_ gensupport.URLParams
1591 ctx_ context.Context
1592 header_ http.Header
1593 }
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605 func (r *ProjectsLocationsConnectionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsConnectionsTestIamPermissionsCall {
1606 c := &ProjectsLocationsConnectionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1607 c.resource = resource
1608 c.testiampermissionsrequest = testiampermissionsrequest
1609 return c
1610 }
1611
1612
1613
1614
1615 func (c *ProjectsLocationsConnectionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsTestIamPermissionsCall {
1616 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1617 return c
1618 }
1619
1620
1621 func (c *ProjectsLocationsConnectionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsConnectionsTestIamPermissionsCall {
1622 c.ctx_ = ctx
1623 return c
1624 }
1625
1626
1627
1628 func (c *ProjectsLocationsConnectionsTestIamPermissionsCall) Header() http.Header {
1629 if c.header_ == nil {
1630 c.header_ = make(http.Header)
1631 }
1632 return c.header_
1633 }
1634
1635 func (c *ProjectsLocationsConnectionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
1636 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1637 var body io.Reader = nil
1638 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
1639 if err != nil {
1640 return nil, err
1641 }
1642 c.urlParams_.Set("alt", alt)
1643 c.urlParams_.Set("prettyPrint", "false")
1644 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
1645 urls += "?" + c.urlParams_.Encode()
1646 req, err := http.NewRequest("POST", urls, body)
1647 if err != nil {
1648 return nil, err
1649 }
1650 req.Header = reqHeaders
1651 googleapi.Expand(req.URL, map[string]string{
1652 "resource": c.resource,
1653 })
1654 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1655 }
1656
1657
1658
1659
1660
1661
1662
1663 func (c *ProjectsLocationsConnectionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
1664 gensupport.SetOptions(c.urlParams_, opts...)
1665 res, err := c.doRequest("json")
1666 if res != nil && res.StatusCode == http.StatusNotModified {
1667 if res.Body != nil {
1668 res.Body.Close()
1669 }
1670 return nil, gensupport.WrapError(&googleapi.Error{
1671 Code: res.StatusCode,
1672 Header: res.Header,
1673 })
1674 }
1675 if err != nil {
1676 return nil, err
1677 }
1678 defer googleapi.CloseBody(res)
1679 if err := googleapi.CheckResponse(res); err != nil {
1680 return nil, gensupport.WrapError(err)
1681 }
1682 ret := &TestIamPermissionsResponse{
1683 ServerResponse: googleapi.ServerResponse{
1684 Header: res.Header,
1685 HTTPStatusCode: res.StatusCode,
1686 },
1687 }
1688 target := &ret
1689 if err := gensupport.DecodeResponse(target, res); err != nil {
1690 return nil, err
1691 }
1692 return ret, nil
1693 }
1694
1695 type ProjectsLocationsConnectionsUpdateCredentialCall struct {
1696 s *Service
1697 name string
1698 connectioncredential *ConnectionCredential
1699 urlParams_ gensupport.URLParams
1700 ctx_ context.Context
1701 header_ http.Header
1702 }
1703
1704
1705
1706
1707
1708
1709 func (r *ProjectsLocationsConnectionsService) UpdateCredential(name string, connectioncredential *ConnectionCredential) *ProjectsLocationsConnectionsUpdateCredentialCall {
1710 c := &ProjectsLocationsConnectionsUpdateCredentialCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1711 c.name = name
1712 c.connectioncredential = connectioncredential
1713 return c
1714 }
1715
1716
1717
1718
1719 func (c *ProjectsLocationsConnectionsUpdateCredentialCall) Fields(s ...googleapi.Field) *ProjectsLocationsConnectionsUpdateCredentialCall {
1720 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1721 return c
1722 }
1723
1724
1725 func (c *ProjectsLocationsConnectionsUpdateCredentialCall) Context(ctx context.Context) *ProjectsLocationsConnectionsUpdateCredentialCall {
1726 c.ctx_ = ctx
1727 return c
1728 }
1729
1730
1731
1732 func (c *ProjectsLocationsConnectionsUpdateCredentialCall) Header() http.Header {
1733 if c.header_ == nil {
1734 c.header_ = make(http.Header)
1735 }
1736 return c.header_
1737 }
1738
1739 func (c *ProjectsLocationsConnectionsUpdateCredentialCall) doRequest(alt string) (*http.Response, error) {
1740 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1741 var body io.Reader = nil
1742 body, err := googleapi.WithoutDataWrapper.JSONReader(c.connectioncredential)
1743 if err != nil {
1744 return nil, err
1745 }
1746 c.urlParams_.Set("alt", alt)
1747 c.urlParams_.Set("prettyPrint", "false")
1748 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1749 urls += "?" + c.urlParams_.Encode()
1750 req, err := http.NewRequest("PATCH", urls, body)
1751 if err != nil {
1752 return nil, err
1753 }
1754 req.Header = reqHeaders
1755 googleapi.Expand(req.URL, map[string]string{
1756 "name": c.name,
1757 })
1758 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1759 }
1760
1761
1762
1763
1764
1765
1766 func (c *ProjectsLocationsConnectionsUpdateCredentialCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1767 gensupport.SetOptions(c.urlParams_, opts...)
1768 res, err := c.doRequest("json")
1769 if res != nil && res.StatusCode == http.StatusNotModified {
1770 if res.Body != nil {
1771 res.Body.Close()
1772 }
1773 return nil, gensupport.WrapError(&googleapi.Error{
1774 Code: res.StatusCode,
1775 Header: res.Header,
1776 })
1777 }
1778 if err != nil {
1779 return nil, err
1780 }
1781 defer googleapi.CloseBody(res)
1782 if err := googleapi.CheckResponse(res); err != nil {
1783 return nil, gensupport.WrapError(err)
1784 }
1785 ret := &Empty{
1786 ServerResponse: googleapi.ServerResponse{
1787 Header: res.Header,
1788 HTTPStatusCode: res.StatusCode,
1789 },
1790 }
1791 target := &ret
1792 if err := gensupport.DecodeResponse(target, res); err != nil {
1793 return nil, err
1794 }
1795 return ret, nil
1796 }
1797
View as plain text