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