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