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