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 orgpolicy
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 = "orgpolicy:v2"
90 const apiName = "orgpolicy"
91 const apiVersion = "v2"
92 const basePath = "https://orgpolicy.googleapis.com/"
93 const basePathTemplate = "https://orgpolicy.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://orgpolicy.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.Folders = NewFoldersService(s)
139 s.Organizations = NewOrganizationsService(s)
140 s.Projects = NewProjectsService(s)
141 return s, nil
142 }
143
144 type Service struct {
145 client *http.Client
146 BasePath string
147 UserAgent string
148
149 Folders *FoldersService
150
151 Organizations *OrganizationsService
152
153 Projects *ProjectsService
154 }
155
156 func (s *Service) userAgent() string {
157 if s.UserAgent == "" {
158 return googleapi.UserAgent
159 }
160 return googleapi.UserAgent + " " + s.UserAgent
161 }
162
163 func NewFoldersService(s *Service) *FoldersService {
164 rs := &FoldersService{s: s}
165 rs.Constraints = NewFoldersConstraintsService(s)
166 rs.Policies = NewFoldersPoliciesService(s)
167 return rs
168 }
169
170 type FoldersService struct {
171 s *Service
172
173 Constraints *FoldersConstraintsService
174
175 Policies *FoldersPoliciesService
176 }
177
178 func NewFoldersConstraintsService(s *Service) *FoldersConstraintsService {
179 rs := &FoldersConstraintsService{s: s}
180 return rs
181 }
182
183 type FoldersConstraintsService struct {
184 s *Service
185 }
186
187 func NewFoldersPoliciesService(s *Service) *FoldersPoliciesService {
188 rs := &FoldersPoliciesService{s: s}
189 return rs
190 }
191
192 type FoldersPoliciesService struct {
193 s *Service
194 }
195
196 func NewOrganizationsService(s *Service) *OrganizationsService {
197 rs := &OrganizationsService{s: s}
198 rs.Constraints = NewOrganizationsConstraintsService(s)
199 rs.CustomConstraints = NewOrganizationsCustomConstraintsService(s)
200 rs.Policies = NewOrganizationsPoliciesService(s)
201 return rs
202 }
203
204 type OrganizationsService struct {
205 s *Service
206
207 Constraints *OrganizationsConstraintsService
208
209 CustomConstraints *OrganizationsCustomConstraintsService
210
211 Policies *OrganizationsPoliciesService
212 }
213
214 func NewOrganizationsConstraintsService(s *Service) *OrganizationsConstraintsService {
215 rs := &OrganizationsConstraintsService{s: s}
216 return rs
217 }
218
219 type OrganizationsConstraintsService struct {
220 s *Service
221 }
222
223 func NewOrganizationsCustomConstraintsService(s *Service) *OrganizationsCustomConstraintsService {
224 rs := &OrganizationsCustomConstraintsService{s: s}
225 return rs
226 }
227
228 type OrganizationsCustomConstraintsService struct {
229 s *Service
230 }
231
232 func NewOrganizationsPoliciesService(s *Service) *OrganizationsPoliciesService {
233 rs := &OrganizationsPoliciesService{s: s}
234 return rs
235 }
236
237 type OrganizationsPoliciesService struct {
238 s *Service
239 }
240
241 func NewProjectsService(s *Service) *ProjectsService {
242 rs := &ProjectsService{s: s}
243 rs.Constraints = NewProjectsConstraintsService(s)
244 rs.Policies = NewProjectsPoliciesService(s)
245 return rs
246 }
247
248 type ProjectsService struct {
249 s *Service
250
251 Constraints *ProjectsConstraintsService
252
253 Policies *ProjectsPoliciesService
254 }
255
256 func NewProjectsConstraintsService(s *Service) *ProjectsConstraintsService {
257 rs := &ProjectsConstraintsService{s: s}
258 return rs
259 }
260
261 type ProjectsConstraintsService struct {
262 s *Service
263 }
264
265 func NewProjectsPoliciesService(s *Service) *ProjectsPoliciesService {
266 rs := &ProjectsPoliciesService{s: s}
267 return rs
268 }
269
270 type ProjectsPoliciesService struct {
271 s *Service
272 }
273
274
275
276
277 type GoogleCloudOrgpolicyV2AlternatePolicySpec struct {
278
279
280 Launch string `json:"launch,omitempty"`
281
282 Spec *GoogleCloudOrgpolicyV2PolicySpec `json:"spec,omitempty"`
283
284
285
286
287
288 ForceSendFields []string `json:"-"`
289
290
291
292
293 NullFields []string `json:"-"`
294 }
295
296 func (s *GoogleCloudOrgpolicyV2AlternatePolicySpec) MarshalJSON() ([]byte, error) {
297 type NoMethod GoogleCloudOrgpolicyV2AlternatePolicySpec
298 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
299 }
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314 type GoogleCloudOrgpolicyV2Constraint struct {
315
316 BooleanConstraint *GoogleCloudOrgpolicyV2ConstraintBooleanConstraint `json:"booleanConstraint,omitempty"`
317
318
319
320
321
322
323
324
325
326
327 ConstraintDefault string `json:"constraintDefault,omitempty"`
328
329
330 Description string `json:"description,omitempty"`
331
332 DisplayName string `json:"displayName,omitempty"`
333
334
335 GoogleManagedConstraint *GoogleCloudOrgpolicyV2ConstraintGoogleManagedConstraint `json:"googleManagedConstraint,omitempty"`
336
337 ListConstraint *GoogleCloudOrgpolicyV2ConstraintListConstraint `json:"listConstraint,omitempty"`
338
339
340
341
342
343 Name string `json:"name,omitempty"`
344
345 SupportsDryRun bool `json:"supportsDryRun,omitempty"`
346
347
348
349
350
351 ForceSendFields []string `json:"-"`
352
353
354
355
356 NullFields []string `json:"-"`
357 }
358
359 func (s *GoogleCloudOrgpolicyV2Constraint) MarshalJSON() ([]byte, error) {
360 type NoMethod GoogleCloudOrgpolicyV2Constraint
361 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
362 }
363
364
365
366
367
368 type GoogleCloudOrgpolicyV2ConstraintBooleanConstraint struct {
369 }
370
371
372
373
374 type GoogleCloudOrgpolicyV2ConstraintGoogleManagedConstraint struct {
375
376
377
378
379
380
381 ActionType string `json:"actionType,omitempty"`
382
383
384
385
386 Condition string `json:"condition,omitempty"`
387
388
389
390
391
392
393
394
395 MethodTypes []string `json:"methodTypes,omitempty"`
396
397
398
399 ResourceTypes []string `json:"resourceTypes,omitempty"`
400
401
402
403
404
405 ForceSendFields []string `json:"-"`
406
407
408
409
410 NullFields []string `json:"-"`
411 }
412
413 func (s *GoogleCloudOrgpolicyV2ConstraintGoogleManagedConstraint) MarshalJSON() ([]byte, error) {
414 type NoMethod GoogleCloudOrgpolicyV2ConstraintGoogleManagedConstraint
415 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
416 }
417
418
419
420
421 type GoogleCloudOrgpolicyV2ConstraintListConstraint struct {
422
423
424
425 SupportsIn bool `json:"supportsIn,omitempty"`
426
427
428
429
430 SupportsUnder bool `json:"supportsUnder,omitempty"`
431
432
433
434
435
436 ForceSendFields []string `json:"-"`
437
438
439
440
441 NullFields []string `json:"-"`
442 }
443
444 func (s *GoogleCloudOrgpolicyV2ConstraintListConstraint) MarshalJSON() ([]byte, error) {
445 type NoMethod GoogleCloudOrgpolicyV2ConstraintListConstraint
446 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
447 }
448
449
450
451
452
453
454 type GoogleCloudOrgpolicyV2CustomConstraint struct {
455
456
457
458
459
460
461 ActionType string `json:"actionType,omitempty"`
462
463
464
465
466 Condition string `json:"condition,omitempty"`
467
468
469 Description string `json:"description,omitempty"`
470
471
472 DisplayName string `json:"displayName,omitempty"`
473
474
475
476
477
478
479
480
481
482
483 MethodTypes []string `json:"methodTypes,omitempty"`
484
485
486
487
488
489
490 Name string `json:"name,omitempty"`
491
492
493
494 ResourceTypes []string `json:"resourceTypes,omitempty"`
495
496
497
498 UpdateTime string `json:"updateTime,omitempty"`
499
500
501 googleapi.ServerResponse `json:"-"`
502
503
504
505
506
507 ForceSendFields []string `json:"-"`
508
509
510
511
512 NullFields []string `json:"-"`
513 }
514
515 func (s *GoogleCloudOrgpolicyV2CustomConstraint) MarshalJSON() ([]byte, error) {
516 type NoMethod GoogleCloudOrgpolicyV2CustomConstraint
517 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
518 }
519
520
521
522 type GoogleCloudOrgpolicyV2ListConstraintsResponse struct {
523
524
525 Constraints []*GoogleCloudOrgpolicyV2Constraint `json:"constraints,omitempty"`
526
527
528 NextPageToken string `json:"nextPageToken,omitempty"`
529
530
531 googleapi.ServerResponse `json:"-"`
532
533
534
535
536
537 ForceSendFields []string `json:"-"`
538
539
540
541
542 NullFields []string `json:"-"`
543 }
544
545 func (s *GoogleCloudOrgpolicyV2ListConstraintsResponse) MarshalJSON() ([]byte, error) {
546 type NoMethod GoogleCloudOrgpolicyV2ListConstraintsResponse
547 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
548 }
549
550
551
552
553 type GoogleCloudOrgpolicyV2ListCustomConstraintsResponse struct {
554
555
556 CustomConstraints []*GoogleCloudOrgpolicyV2CustomConstraint `json:"customConstraints,omitempty"`
557
558
559 NextPageToken string `json:"nextPageToken,omitempty"`
560
561
562 googleapi.ServerResponse `json:"-"`
563
564
565
566
567
568 ForceSendFields []string `json:"-"`
569
570
571
572
573 NullFields []string `json:"-"`
574 }
575
576 func (s *GoogleCloudOrgpolicyV2ListCustomConstraintsResponse) MarshalJSON() ([]byte, error) {
577 type NoMethod GoogleCloudOrgpolicyV2ListCustomConstraintsResponse
578 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
579 }
580
581
582
583
584 type GoogleCloudOrgpolicyV2ListPoliciesResponse struct {
585
586
587 NextPageToken string `json:"nextPageToken,omitempty"`
588
589
590 Policies []*GoogleCloudOrgpolicyV2Policy `json:"policies,omitempty"`
591
592
593 googleapi.ServerResponse `json:"-"`
594
595
596
597
598
599 ForceSendFields []string `json:"-"`
600
601
602
603
604 NullFields []string `json:"-"`
605 }
606
607 func (s *GoogleCloudOrgpolicyV2ListPoliciesResponse) MarshalJSON() ([]byte, error) {
608 type NoMethod GoogleCloudOrgpolicyV2ListPoliciesResponse
609 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
610 }
611
612
613
614 type GoogleCloudOrgpolicyV2Policy struct {
615
616 Alternate *GoogleCloudOrgpolicyV2AlternatePolicySpec `json:"alternate,omitempty"`
617
618
619
620 DryRunSpec *GoogleCloudOrgpolicyV2PolicySpec `json:"dryRunSpec,omitempty"`
621
622
623
624
625 Etag string `json:"etag,omitempty"`
626
627
628
629
630
631
632
633
634
635
636 Name string `json:"name,omitempty"`
637
638 Spec *GoogleCloudOrgpolicyV2PolicySpec `json:"spec,omitempty"`
639
640
641 googleapi.ServerResponse `json:"-"`
642
643
644
645
646
647 ForceSendFields []string `json:"-"`
648
649
650
651
652 NullFields []string `json:"-"`
653 }
654
655 func (s *GoogleCloudOrgpolicyV2Policy) MarshalJSON() ([]byte, error) {
656 type NoMethod GoogleCloudOrgpolicyV2Policy
657 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
658 }
659
660
661
662
663 type GoogleCloudOrgpolicyV2PolicySpec struct {
664
665
666
667
668
669
670 Etag string `json:"etag,omitempty"`
671
672
673
674
675
676
677 InheritFromParent bool `json:"inheritFromParent,omitempty"`
678
679
680
681
682
683 Reset bool `json:"reset,omitempty"`
684
685
686
687
688
689
690 Rules []*GoogleCloudOrgpolicyV2PolicySpecPolicyRule `json:"rules,omitempty"`
691
692
693
694 UpdateTime string `json:"updateTime,omitempty"`
695
696
697
698
699
700 ForceSendFields []string `json:"-"`
701
702
703
704
705 NullFields []string `json:"-"`
706 }
707
708 func (s *GoogleCloudOrgpolicyV2PolicySpec) MarshalJSON() ([]byte, error) {
709 type NoMethod GoogleCloudOrgpolicyV2PolicySpec
710 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
711 }
712
713
714
715 type GoogleCloudOrgpolicyV2PolicySpecPolicyRule struct {
716
717
718 AllowAll bool `json:"allowAll,omitempty"`
719
720
721
722
723
724
725
726
727
728
729 Condition *GoogleTypeExpr `json:"condition,omitempty"`
730
731
732 DenyAll bool `json:"denyAll,omitempty"`
733
734
735
736 Enforce bool `json:"enforce,omitempty"`
737
738
739 Values *GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues `json:"values,omitempty"`
740
741
742
743
744
745 ForceSendFields []string `json:"-"`
746
747
748
749
750 NullFields []string `json:"-"`
751 }
752
753 func (s *GoogleCloudOrgpolicyV2PolicySpecPolicyRule) MarshalJSON() ([]byte, error) {
754 type NoMethod GoogleCloudOrgpolicyV2PolicySpecPolicyRule
755 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
756 }
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771 type GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues struct {
772
773 AllowedValues []string `json:"allowedValues,omitempty"`
774
775 DeniedValues []string `json:"deniedValues,omitempty"`
776
777
778
779
780
781 ForceSendFields []string `json:"-"`
782
783
784
785
786 NullFields []string `json:"-"`
787 }
788
789 func (s *GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues) MarshalJSON() ([]byte, error) {
790 type NoMethod GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues
791 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
792 }
793
794
795
796
797
798
799 type GoogleProtobufEmpty struct {
800
801 googleapi.ServerResponse `json:"-"`
802 }
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820 type GoogleTypeExpr struct {
821
822
823 Description string `json:"description,omitempty"`
824
825
826 Expression string `json:"expression,omitempty"`
827
828
829 Location string `json:"location,omitempty"`
830
831
832
833 Title string `json:"title,omitempty"`
834
835
836
837
838
839 ForceSendFields []string `json:"-"`
840
841
842
843
844 NullFields []string `json:"-"`
845 }
846
847 func (s *GoogleTypeExpr) MarshalJSON() ([]byte, error) {
848 type NoMethod GoogleTypeExpr
849 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
850 }
851
852 type FoldersConstraintsListCall struct {
853 s *Service
854 parent string
855 urlParams_ gensupport.URLParams
856 ifNoneMatch_ string
857 ctx_ context.Context
858 header_ http.Header
859 }
860
861
862
863
864
865
866
867 func (r *FoldersConstraintsService) List(parent string) *FoldersConstraintsListCall {
868 c := &FoldersConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
869 c.parent = parent
870 return c
871 }
872
873
874
875
876 func (c *FoldersConstraintsListCall) PageSize(pageSize int64) *FoldersConstraintsListCall {
877 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
878 return c
879 }
880
881
882
883
884 func (c *FoldersConstraintsListCall) PageToken(pageToken string) *FoldersConstraintsListCall {
885 c.urlParams_.Set("pageToken", pageToken)
886 return c
887 }
888
889
890
891
892 func (c *FoldersConstraintsListCall) Fields(s ...googleapi.Field) *FoldersConstraintsListCall {
893 c.urlParams_.Set("fields", googleapi.CombineFields(s))
894 return c
895 }
896
897
898
899
900 func (c *FoldersConstraintsListCall) IfNoneMatch(entityTag string) *FoldersConstraintsListCall {
901 c.ifNoneMatch_ = entityTag
902 return c
903 }
904
905
906 func (c *FoldersConstraintsListCall) Context(ctx context.Context) *FoldersConstraintsListCall {
907 c.ctx_ = ctx
908 return c
909 }
910
911
912
913 func (c *FoldersConstraintsListCall) Header() http.Header {
914 if c.header_ == nil {
915 c.header_ = make(http.Header)
916 }
917 return c.header_
918 }
919
920 func (c *FoldersConstraintsListCall) doRequest(alt string) (*http.Response, error) {
921 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
922 if c.ifNoneMatch_ != "" {
923 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
924 }
925 var body io.Reader = nil
926 c.urlParams_.Set("alt", alt)
927 c.urlParams_.Set("prettyPrint", "false")
928 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
929 urls += "?" + c.urlParams_.Encode()
930 req, err := http.NewRequest("GET", urls, body)
931 if err != nil {
932 return nil, err
933 }
934 req.Header = reqHeaders
935 googleapi.Expand(req.URL, map[string]string{
936 "parent": c.parent,
937 })
938 return gensupport.SendRequest(c.ctx_, c.s.client, req)
939 }
940
941
942
943
944
945
946
947 func (c *FoldersConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
948 gensupport.SetOptions(c.urlParams_, opts...)
949 res, err := c.doRequest("json")
950 if res != nil && res.StatusCode == http.StatusNotModified {
951 if res.Body != nil {
952 res.Body.Close()
953 }
954 return nil, gensupport.WrapError(&googleapi.Error{
955 Code: res.StatusCode,
956 Header: res.Header,
957 })
958 }
959 if err != nil {
960 return nil, err
961 }
962 defer googleapi.CloseBody(res)
963 if err := googleapi.CheckResponse(res); err != nil {
964 return nil, gensupport.WrapError(err)
965 }
966 ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
967 ServerResponse: googleapi.ServerResponse{
968 Header: res.Header,
969 HTTPStatusCode: res.StatusCode,
970 },
971 }
972 target := &ret
973 if err := gensupport.DecodeResponse(target, res); err != nil {
974 return nil, err
975 }
976 return ret, nil
977 }
978
979
980
981
982 func (c *FoldersConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
983 c.ctx_ = ctx
984 defer c.PageToken(c.urlParams_.Get("pageToken"))
985 for {
986 x, err := c.Do()
987 if err != nil {
988 return err
989 }
990 if err := f(x); err != nil {
991 return err
992 }
993 if x.NextPageToken == "" {
994 return nil
995 }
996 c.PageToken(x.NextPageToken)
997 }
998 }
999
1000 type FoldersPoliciesCreateCall struct {
1001 s *Service
1002 parent string
1003 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
1004 urlParams_ gensupport.URLParams
1005 ctx_ context.Context
1006 header_ http.Header
1007 }
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018 func (r *FoldersPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *FoldersPoliciesCreateCall {
1019 c := &FoldersPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1020 c.parent = parent
1021 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
1022 return c
1023 }
1024
1025
1026
1027
1028 func (c *FoldersPoliciesCreateCall) Fields(s ...googleapi.Field) *FoldersPoliciesCreateCall {
1029 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1030 return c
1031 }
1032
1033
1034 func (c *FoldersPoliciesCreateCall) Context(ctx context.Context) *FoldersPoliciesCreateCall {
1035 c.ctx_ = ctx
1036 return c
1037 }
1038
1039
1040
1041 func (c *FoldersPoliciesCreateCall) Header() http.Header {
1042 if c.header_ == nil {
1043 c.header_ = make(http.Header)
1044 }
1045 return c.header_
1046 }
1047
1048 func (c *FoldersPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
1049 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1050 var body io.Reader = nil
1051 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
1052 if err != nil {
1053 return nil, err
1054 }
1055 c.urlParams_.Set("alt", alt)
1056 c.urlParams_.Set("prettyPrint", "false")
1057 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
1058 urls += "?" + c.urlParams_.Encode()
1059 req, err := http.NewRequest("POST", urls, body)
1060 if err != nil {
1061 return nil, err
1062 }
1063 req.Header = reqHeaders
1064 googleapi.Expand(req.URL, map[string]string{
1065 "parent": c.parent,
1066 })
1067 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1068 }
1069
1070
1071
1072
1073
1074
1075
1076 func (c *FoldersPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1077 gensupport.SetOptions(c.urlParams_, opts...)
1078 res, err := c.doRequest("json")
1079 if res != nil && res.StatusCode == http.StatusNotModified {
1080 if res.Body != nil {
1081 res.Body.Close()
1082 }
1083 return nil, gensupport.WrapError(&googleapi.Error{
1084 Code: res.StatusCode,
1085 Header: res.Header,
1086 })
1087 }
1088 if err != nil {
1089 return nil, err
1090 }
1091 defer googleapi.CloseBody(res)
1092 if err := googleapi.CheckResponse(res); err != nil {
1093 return nil, gensupport.WrapError(err)
1094 }
1095 ret := &GoogleCloudOrgpolicyV2Policy{
1096 ServerResponse: googleapi.ServerResponse{
1097 Header: res.Header,
1098 HTTPStatusCode: res.StatusCode,
1099 },
1100 }
1101 target := &ret
1102 if err := gensupport.DecodeResponse(target, res); err != nil {
1103 return nil, err
1104 }
1105 return ret, nil
1106 }
1107
1108 type FoldersPoliciesDeleteCall struct {
1109 s *Service
1110 name string
1111 urlParams_ gensupport.URLParams
1112 ctx_ context.Context
1113 header_ http.Header
1114 }
1115
1116
1117
1118
1119
1120
1121 func (r *FoldersPoliciesService) Delete(name string) *FoldersPoliciesDeleteCall {
1122 c := &FoldersPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1123 c.name = name
1124 return c
1125 }
1126
1127
1128
1129
1130 func (c *FoldersPoliciesDeleteCall) Etag(etag string) *FoldersPoliciesDeleteCall {
1131 c.urlParams_.Set("etag", etag)
1132 return c
1133 }
1134
1135
1136
1137
1138 func (c *FoldersPoliciesDeleteCall) Fields(s ...googleapi.Field) *FoldersPoliciesDeleteCall {
1139 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1140 return c
1141 }
1142
1143
1144 func (c *FoldersPoliciesDeleteCall) Context(ctx context.Context) *FoldersPoliciesDeleteCall {
1145 c.ctx_ = ctx
1146 return c
1147 }
1148
1149
1150
1151 func (c *FoldersPoliciesDeleteCall) Header() http.Header {
1152 if c.header_ == nil {
1153 c.header_ = make(http.Header)
1154 }
1155 return c.header_
1156 }
1157
1158 func (c *FoldersPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
1159 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1160 var body io.Reader = nil
1161 c.urlParams_.Set("alt", alt)
1162 c.urlParams_.Set("prettyPrint", "false")
1163 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1164 urls += "?" + c.urlParams_.Encode()
1165 req, err := http.NewRequest("DELETE", urls, body)
1166 if err != nil {
1167 return nil, err
1168 }
1169 req.Header = reqHeaders
1170 googleapi.Expand(req.URL, map[string]string{
1171 "name": c.name,
1172 })
1173 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1174 }
1175
1176
1177
1178
1179
1180
1181
1182 func (c *FoldersPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
1183 gensupport.SetOptions(c.urlParams_, opts...)
1184 res, err := c.doRequest("json")
1185 if res != nil && res.StatusCode == http.StatusNotModified {
1186 if res.Body != nil {
1187 res.Body.Close()
1188 }
1189 return nil, gensupport.WrapError(&googleapi.Error{
1190 Code: res.StatusCode,
1191 Header: res.Header,
1192 })
1193 }
1194 if err != nil {
1195 return nil, err
1196 }
1197 defer googleapi.CloseBody(res)
1198 if err := googleapi.CheckResponse(res); err != nil {
1199 return nil, gensupport.WrapError(err)
1200 }
1201 ret := &GoogleProtobufEmpty{
1202 ServerResponse: googleapi.ServerResponse{
1203 Header: res.Header,
1204 HTTPStatusCode: res.StatusCode,
1205 },
1206 }
1207 target := &ret
1208 if err := gensupport.DecodeResponse(target, res); err != nil {
1209 return nil, err
1210 }
1211 return ret, nil
1212 }
1213
1214 type FoldersPoliciesGetCall struct {
1215 s *Service
1216 name string
1217 urlParams_ gensupport.URLParams
1218 ifNoneMatch_ string
1219 ctx_ context.Context
1220 header_ http.Header
1221 }
1222
1223
1224
1225
1226
1227
1228 func (r *FoldersPoliciesService) Get(name string) *FoldersPoliciesGetCall {
1229 c := &FoldersPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1230 c.name = name
1231 return c
1232 }
1233
1234
1235
1236
1237 func (c *FoldersPoliciesGetCall) Fields(s ...googleapi.Field) *FoldersPoliciesGetCall {
1238 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1239 return c
1240 }
1241
1242
1243
1244
1245 func (c *FoldersPoliciesGetCall) IfNoneMatch(entityTag string) *FoldersPoliciesGetCall {
1246 c.ifNoneMatch_ = entityTag
1247 return c
1248 }
1249
1250
1251 func (c *FoldersPoliciesGetCall) Context(ctx context.Context) *FoldersPoliciesGetCall {
1252 c.ctx_ = ctx
1253 return c
1254 }
1255
1256
1257
1258 func (c *FoldersPoliciesGetCall) Header() http.Header {
1259 if c.header_ == nil {
1260 c.header_ = make(http.Header)
1261 }
1262 return c.header_
1263 }
1264
1265 func (c *FoldersPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
1266 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1267 if c.ifNoneMatch_ != "" {
1268 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1269 }
1270 var body io.Reader = nil
1271 c.urlParams_.Set("alt", alt)
1272 c.urlParams_.Set("prettyPrint", "false")
1273 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1274 urls += "?" + c.urlParams_.Encode()
1275 req, err := http.NewRequest("GET", urls, body)
1276 if err != nil {
1277 return nil, err
1278 }
1279 req.Header = reqHeaders
1280 googleapi.Expand(req.URL, map[string]string{
1281 "name": c.name,
1282 })
1283 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1284 }
1285
1286
1287
1288
1289
1290
1291
1292 func (c *FoldersPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1293 gensupport.SetOptions(c.urlParams_, opts...)
1294 res, err := c.doRequest("json")
1295 if res != nil && res.StatusCode == http.StatusNotModified {
1296 if res.Body != nil {
1297 res.Body.Close()
1298 }
1299 return nil, gensupport.WrapError(&googleapi.Error{
1300 Code: res.StatusCode,
1301 Header: res.Header,
1302 })
1303 }
1304 if err != nil {
1305 return nil, err
1306 }
1307 defer googleapi.CloseBody(res)
1308 if err := googleapi.CheckResponse(res); err != nil {
1309 return nil, gensupport.WrapError(err)
1310 }
1311 ret := &GoogleCloudOrgpolicyV2Policy{
1312 ServerResponse: googleapi.ServerResponse{
1313 Header: res.Header,
1314 HTTPStatusCode: res.StatusCode,
1315 },
1316 }
1317 target := &ret
1318 if err := gensupport.DecodeResponse(target, res); err != nil {
1319 return nil, err
1320 }
1321 return ret, nil
1322 }
1323
1324 type FoldersPoliciesGetEffectivePolicyCall struct {
1325 s *Service
1326 name string
1327 urlParams_ gensupport.URLParams
1328 ifNoneMatch_ string
1329 ctx_ context.Context
1330 header_ http.Header
1331 }
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341 func (r *FoldersPoliciesService) GetEffectivePolicy(name string) *FoldersPoliciesGetEffectivePolicyCall {
1342 c := &FoldersPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1343 c.name = name
1344 return c
1345 }
1346
1347
1348
1349
1350 func (c *FoldersPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *FoldersPoliciesGetEffectivePolicyCall {
1351 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1352 return c
1353 }
1354
1355
1356
1357
1358 func (c *FoldersPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *FoldersPoliciesGetEffectivePolicyCall {
1359 c.ifNoneMatch_ = entityTag
1360 return c
1361 }
1362
1363
1364 func (c *FoldersPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *FoldersPoliciesGetEffectivePolicyCall {
1365 c.ctx_ = ctx
1366 return c
1367 }
1368
1369
1370
1371 func (c *FoldersPoliciesGetEffectivePolicyCall) Header() http.Header {
1372 if c.header_ == nil {
1373 c.header_ = make(http.Header)
1374 }
1375 return c.header_
1376 }
1377
1378 func (c *FoldersPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
1379 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1380 if c.ifNoneMatch_ != "" {
1381 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1382 }
1383 var body io.Reader = nil
1384 c.urlParams_.Set("alt", alt)
1385 c.urlParams_.Set("prettyPrint", "false")
1386 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
1387 urls += "?" + c.urlParams_.Encode()
1388 req, err := http.NewRequest("GET", urls, body)
1389 if err != nil {
1390 return nil, err
1391 }
1392 req.Header = reqHeaders
1393 googleapi.Expand(req.URL, map[string]string{
1394 "name": c.name,
1395 })
1396 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1397 }
1398
1399
1400
1401
1402
1403
1404
1405 func (c *FoldersPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1406 gensupport.SetOptions(c.urlParams_, opts...)
1407 res, err := c.doRequest("json")
1408 if res != nil && res.StatusCode == http.StatusNotModified {
1409 if res.Body != nil {
1410 res.Body.Close()
1411 }
1412 return nil, gensupport.WrapError(&googleapi.Error{
1413 Code: res.StatusCode,
1414 Header: res.Header,
1415 })
1416 }
1417 if err != nil {
1418 return nil, err
1419 }
1420 defer googleapi.CloseBody(res)
1421 if err := googleapi.CheckResponse(res); err != nil {
1422 return nil, gensupport.WrapError(err)
1423 }
1424 ret := &GoogleCloudOrgpolicyV2Policy{
1425 ServerResponse: googleapi.ServerResponse{
1426 Header: res.Header,
1427 HTTPStatusCode: res.StatusCode,
1428 },
1429 }
1430 target := &ret
1431 if err := gensupport.DecodeResponse(target, res); err != nil {
1432 return nil, err
1433 }
1434 return ret, nil
1435 }
1436
1437 type FoldersPoliciesListCall struct {
1438 s *Service
1439 parent string
1440 urlParams_ gensupport.URLParams
1441 ifNoneMatch_ string
1442 ctx_ context.Context
1443 header_ http.Header
1444 }
1445
1446
1447
1448
1449
1450
1451
1452
1453 func (r *FoldersPoliciesService) List(parent string) *FoldersPoliciesListCall {
1454 c := &FoldersPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1455 c.parent = parent
1456 return c
1457 }
1458
1459
1460
1461
1462 func (c *FoldersPoliciesListCall) PageSize(pageSize int64) *FoldersPoliciesListCall {
1463 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1464 return c
1465 }
1466
1467
1468
1469
1470 func (c *FoldersPoliciesListCall) PageToken(pageToken string) *FoldersPoliciesListCall {
1471 c.urlParams_.Set("pageToken", pageToken)
1472 return c
1473 }
1474
1475
1476
1477
1478 func (c *FoldersPoliciesListCall) Fields(s ...googleapi.Field) *FoldersPoliciesListCall {
1479 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1480 return c
1481 }
1482
1483
1484
1485
1486 func (c *FoldersPoliciesListCall) IfNoneMatch(entityTag string) *FoldersPoliciesListCall {
1487 c.ifNoneMatch_ = entityTag
1488 return c
1489 }
1490
1491
1492 func (c *FoldersPoliciesListCall) Context(ctx context.Context) *FoldersPoliciesListCall {
1493 c.ctx_ = ctx
1494 return c
1495 }
1496
1497
1498
1499 func (c *FoldersPoliciesListCall) Header() http.Header {
1500 if c.header_ == nil {
1501 c.header_ = make(http.Header)
1502 }
1503 return c.header_
1504 }
1505
1506 func (c *FoldersPoliciesListCall) doRequest(alt string) (*http.Response, error) {
1507 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1508 if c.ifNoneMatch_ != "" {
1509 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1510 }
1511 var body io.Reader = nil
1512 c.urlParams_.Set("alt", alt)
1513 c.urlParams_.Set("prettyPrint", "false")
1514 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
1515 urls += "?" + c.urlParams_.Encode()
1516 req, err := http.NewRequest("GET", urls, body)
1517 if err != nil {
1518 return nil, err
1519 }
1520 req.Header = reqHeaders
1521 googleapi.Expand(req.URL, map[string]string{
1522 "parent": c.parent,
1523 })
1524 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1525 }
1526
1527
1528
1529
1530
1531
1532
1533 func (c *FoldersPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
1534 gensupport.SetOptions(c.urlParams_, opts...)
1535 res, err := c.doRequest("json")
1536 if res != nil && res.StatusCode == http.StatusNotModified {
1537 if res.Body != nil {
1538 res.Body.Close()
1539 }
1540 return nil, gensupport.WrapError(&googleapi.Error{
1541 Code: res.StatusCode,
1542 Header: res.Header,
1543 })
1544 }
1545 if err != nil {
1546 return nil, err
1547 }
1548 defer googleapi.CloseBody(res)
1549 if err := googleapi.CheckResponse(res); err != nil {
1550 return nil, gensupport.WrapError(err)
1551 }
1552 ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
1553 ServerResponse: googleapi.ServerResponse{
1554 Header: res.Header,
1555 HTTPStatusCode: res.StatusCode,
1556 },
1557 }
1558 target := &ret
1559 if err := gensupport.DecodeResponse(target, res); err != nil {
1560 return nil, err
1561 }
1562 return ret, nil
1563 }
1564
1565
1566
1567
1568 func (c *FoldersPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
1569 c.ctx_ = ctx
1570 defer c.PageToken(c.urlParams_.Get("pageToken"))
1571 for {
1572 x, err := c.Do()
1573 if err != nil {
1574 return err
1575 }
1576 if err := f(x); err != nil {
1577 return err
1578 }
1579 if x.NextPageToken == "" {
1580 return nil
1581 }
1582 c.PageToken(x.NextPageToken)
1583 }
1584 }
1585
1586 type FoldersPoliciesPatchCall struct {
1587 s *Service
1588 name string
1589 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
1590 urlParams_ gensupport.URLParams
1591 ctx_ context.Context
1592 header_ http.Header
1593 }
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611 func (r *FoldersPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *FoldersPoliciesPatchCall {
1612 c := &FoldersPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1613 c.name = name
1614 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
1615 return c
1616 }
1617
1618
1619
1620
1621
1622 func (c *FoldersPoliciesPatchCall) UpdateMask(updateMask string) *FoldersPoliciesPatchCall {
1623 c.urlParams_.Set("updateMask", updateMask)
1624 return c
1625 }
1626
1627
1628
1629
1630 func (c *FoldersPoliciesPatchCall) Fields(s ...googleapi.Field) *FoldersPoliciesPatchCall {
1631 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1632 return c
1633 }
1634
1635
1636 func (c *FoldersPoliciesPatchCall) Context(ctx context.Context) *FoldersPoliciesPatchCall {
1637 c.ctx_ = ctx
1638 return c
1639 }
1640
1641
1642
1643 func (c *FoldersPoliciesPatchCall) Header() http.Header {
1644 if c.header_ == nil {
1645 c.header_ = make(http.Header)
1646 }
1647 return c.header_
1648 }
1649
1650 func (c *FoldersPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
1651 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1652 var body io.Reader = nil
1653 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
1654 if err != nil {
1655 return nil, err
1656 }
1657 c.urlParams_.Set("alt", alt)
1658 c.urlParams_.Set("prettyPrint", "false")
1659 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1660 urls += "?" + c.urlParams_.Encode()
1661 req, err := http.NewRequest("PATCH", urls, body)
1662 if err != nil {
1663 return nil, err
1664 }
1665 req.Header = reqHeaders
1666 googleapi.Expand(req.URL, map[string]string{
1667 "name": c.name,
1668 })
1669 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1670 }
1671
1672
1673
1674
1675
1676
1677
1678 func (c *FoldersPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1679 gensupport.SetOptions(c.urlParams_, opts...)
1680 res, err := c.doRequest("json")
1681 if res != nil && res.StatusCode == http.StatusNotModified {
1682 if res.Body != nil {
1683 res.Body.Close()
1684 }
1685 return nil, gensupport.WrapError(&googleapi.Error{
1686 Code: res.StatusCode,
1687 Header: res.Header,
1688 })
1689 }
1690 if err != nil {
1691 return nil, err
1692 }
1693 defer googleapi.CloseBody(res)
1694 if err := googleapi.CheckResponse(res); err != nil {
1695 return nil, gensupport.WrapError(err)
1696 }
1697 ret := &GoogleCloudOrgpolicyV2Policy{
1698 ServerResponse: googleapi.ServerResponse{
1699 Header: res.Header,
1700 HTTPStatusCode: res.StatusCode,
1701 },
1702 }
1703 target := &ret
1704 if err := gensupport.DecodeResponse(target, res); err != nil {
1705 return nil, err
1706 }
1707 return ret, nil
1708 }
1709
1710 type OrganizationsConstraintsListCall struct {
1711 s *Service
1712 parent string
1713 urlParams_ gensupport.URLParams
1714 ifNoneMatch_ string
1715 ctx_ context.Context
1716 header_ http.Header
1717 }
1718
1719
1720
1721
1722
1723
1724
1725 func (r *OrganizationsConstraintsService) List(parent string) *OrganizationsConstraintsListCall {
1726 c := &OrganizationsConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1727 c.parent = parent
1728 return c
1729 }
1730
1731
1732
1733
1734 func (c *OrganizationsConstraintsListCall) PageSize(pageSize int64) *OrganizationsConstraintsListCall {
1735 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1736 return c
1737 }
1738
1739
1740
1741
1742 func (c *OrganizationsConstraintsListCall) PageToken(pageToken string) *OrganizationsConstraintsListCall {
1743 c.urlParams_.Set("pageToken", pageToken)
1744 return c
1745 }
1746
1747
1748
1749
1750 func (c *OrganizationsConstraintsListCall) Fields(s ...googleapi.Field) *OrganizationsConstraintsListCall {
1751 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1752 return c
1753 }
1754
1755
1756
1757
1758 func (c *OrganizationsConstraintsListCall) IfNoneMatch(entityTag string) *OrganizationsConstraintsListCall {
1759 c.ifNoneMatch_ = entityTag
1760 return c
1761 }
1762
1763
1764 func (c *OrganizationsConstraintsListCall) Context(ctx context.Context) *OrganizationsConstraintsListCall {
1765 c.ctx_ = ctx
1766 return c
1767 }
1768
1769
1770
1771 func (c *OrganizationsConstraintsListCall) Header() http.Header {
1772 if c.header_ == nil {
1773 c.header_ = make(http.Header)
1774 }
1775 return c.header_
1776 }
1777
1778 func (c *OrganizationsConstraintsListCall) doRequest(alt string) (*http.Response, error) {
1779 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1780 if c.ifNoneMatch_ != "" {
1781 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1782 }
1783 var body io.Reader = nil
1784 c.urlParams_.Set("alt", alt)
1785 c.urlParams_.Set("prettyPrint", "false")
1786 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
1787 urls += "?" + c.urlParams_.Encode()
1788 req, err := http.NewRequest("GET", urls, body)
1789 if err != nil {
1790 return nil, err
1791 }
1792 req.Header = reqHeaders
1793 googleapi.Expand(req.URL, map[string]string{
1794 "parent": c.parent,
1795 })
1796 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1797 }
1798
1799
1800
1801
1802
1803
1804
1805 func (c *OrganizationsConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
1806 gensupport.SetOptions(c.urlParams_, opts...)
1807 res, err := c.doRequest("json")
1808 if res != nil && res.StatusCode == http.StatusNotModified {
1809 if res.Body != nil {
1810 res.Body.Close()
1811 }
1812 return nil, gensupport.WrapError(&googleapi.Error{
1813 Code: res.StatusCode,
1814 Header: res.Header,
1815 })
1816 }
1817 if err != nil {
1818 return nil, err
1819 }
1820 defer googleapi.CloseBody(res)
1821 if err := googleapi.CheckResponse(res); err != nil {
1822 return nil, gensupport.WrapError(err)
1823 }
1824 ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
1825 ServerResponse: googleapi.ServerResponse{
1826 Header: res.Header,
1827 HTTPStatusCode: res.StatusCode,
1828 },
1829 }
1830 target := &ret
1831 if err := gensupport.DecodeResponse(target, res); err != nil {
1832 return nil, err
1833 }
1834 return ret, nil
1835 }
1836
1837
1838
1839
1840 func (c *OrganizationsConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
1841 c.ctx_ = ctx
1842 defer c.PageToken(c.urlParams_.Get("pageToken"))
1843 for {
1844 x, err := c.Do()
1845 if err != nil {
1846 return err
1847 }
1848 if err := f(x); err != nil {
1849 return err
1850 }
1851 if x.NextPageToken == "" {
1852 return nil
1853 }
1854 c.PageToken(x.NextPageToken)
1855 }
1856 }
1857
1858 type OrganizationsCustomConstraintsCreateCall struct {
1859 s *Service
1860 parent string
1861 googlecloudorgpolicyv2customconstraint *GoogleCloudOrgpolicyV2CustomConstraint
1862 urlParams_ gensupport.URLParams
1863 ctx_ context.Context
1864 header_ http.Header
1865 }
1866
1867
1868
1869
1870
1871
1872
1873 func (r *OrganizationsCustomConstraintsService) Create(parent string, googlecloudorgpolicyv2customconstraint *GoogleCloudOrgpolicyV2CustomConstraint) *OrganizationsCustomConstraintsCreateCall {
1874 c := &OrganizationsCustomConstraintsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1875 c.parent = parent
1876 c.googlecloudorgpolicyv2customconstraint = googlecloudorgpolicyv2customconstraint
1877 return c
1878 }
1879
1880
1881
1882
1883 func (c *OrganizationsCustomConstraintsCreateCall) Fields(s ...googleapi.Field) *OrganizationsCustomConstraintsCreateCall {
1884 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1885 return c
1886 }
1887
1888
1889 func (c *OrganizationsCustomConstraintsCreateCall) Context(ctx context.Context) *OrganizationsCustomConstraintsCreateCall {
1890 c.ctx_ = ctx
1891 return c
1892 }
1893
1894
1895
1896 func (c *OrganizationsCustomConstraintsCreateCall) Header() http.Header {
1897 if c.header_ == nil {
1898 c.header_ = make(http.Header)
1899 }
1900 return c.header_
1901 }
1902
1903 func (c *OrganizationsCustomConstraintsCreateCall) doRequest(alt string) (*http.Response, error) {
1904 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1905 var body io.Reader = nil
1906 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2customconstraint)
1907 if err != nil {
1908 return nil, err
1909 }
1910 c.urlParams_.Set("alt", alt)
1911 c.urlParams_.Set("prettyPrint", "false")
1912 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/customConstraints")
1913 urls += "?" + c.urlParams_.Encode()
1914 req, err := http.NewRequest("POST", urls, body)
1915 if err != nil {
1916 return nil, err
1917 }
1918 req.Header = reqHeaders
1919 googleapi.Expand(req.URL, map[string]string{
1920 "parent": c.parent,
1921 })
1922 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1923 }
1924
1925
1926
1927
1928
1929
1930
1931 func (c *OrganizationsCustomConstraintsCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2CustomConstraint, error) {
1932 gensupport.SetOptions(c.urlParams_, opts...)
1933 res, err := c.doRequest("json")
1934 if res != nil && res.StatusCode == http.StatusNotModified {
1935 if res.Body != nil {
1936 res.Body.Close()
1937 }
1938 return nil, gensupport.WrapError(&googleapi.Error{
1939 Code: res.StatusCode,
1940 Header: res.Header,
1941 })
1942 }
1943 if err != nil {
1944 return nil, err
1945 }
1946 defer googleapi.CloseBody(res)
1947 if err := googleapi.CheckResponse(res); err != nil {
1948 return nil, gensupport.WrapError(err)
1949 }
1950 ret := &GoogleCloudOrgpolicyV2CustomConstraint{
1951 ServerResponse: googleapi.ServerResponse{
1952 Header: res.Header,
1953 HTTPStatusCode: res.StatusCode,
1954 },
1955 }
1956 target := &ret
1957 if err := gensupport.DecodeResponse(target, res); err != nil {
1958 return nil, err
1959 }
1960 return ret, nil
1961 }
1962
1963 type OrganizationsCustomConstraintsDeleteCall struct {
1964 s *Service
1965 name string
1966 urlParams_ gensupport.URLParams
1967 ctx_ context.Context
1968 header_ http.Header
1969 }
1970
1971
1972
1973
1974
1975
1976 func (r *OrganizationsCustomConstraintsService) Delete(name string) *OrganizationsCustomConstraintsDeleteCall {
1977 c := &OrganizationsCustomConstraintsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1978 c.name = name
1979 return c
1980 }
1981
1982
1983
1984
1985 func (c *OrganizationsCustomConstraintsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsCustomConstraintsDeleteCall {
1986 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1987 return c
1988 }
1989
1990
1991 func (c *OrganizationsCustomConstraintsDeleteCall) Context(ctx context.Context) *OrganizationsCustomConstraintsDeleteCall {
1992 c.ctx_ = ctx
1993 return c
1994 }
1995
1996
1997
1998 func (c *OrganizationsCustomConstraintsDeleteCall) Header() http.Header {
1999 if c.header_ == nil {
2000 c.header_ = make(http.Header)
2001 }
2002 return c.header_
2003 }
2004
2005 func (c *OrganizationsCustomConstraintsDeleteCall) doRequest(alt string) (*http.Response, error) {
2006 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2007 var body io.Reader = nil
2008 c.urlParams_.Set("alt", alt)
2009 c.urlParams_.Set("prettyPrint", "false")
2010 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2011 urls += "?" + c.urlParams_.Encode()
2012 req, err := http.NewRequest("DELETE", urls, body)
2013 if err != nil {
2014 return nil, err
2015 }
2016 req.Header = reqHeaders
2017 googleapi.Expand(req.URL, map[string]string{
2018 "name": c.name,
2019 })
2020 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2021 }
2022
2023
2024
2025
2026
2027
2028
2029 func (c *OrganizationsCustomConstraintsDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
2030 gensupport.SetOptions(c.urlParams_, opts...)
2031 res, err := c.doRequest("json")
2032 if res != nil && res.StatusCode == http.StatusNotModified {
2033 if res.Body != nil {
2034 res.Body.Close()
2035 }
2036 return nil, gensupport.WrapError(&googleapi.Error{
2037 Code: res.StatusCode,
2038 Header: res.Header,
2039 })
2040 }
2041 if err != nil {
2042 return nil, err
2043 }
2044 defer googleapi.CloseBody(res)
2045 if err := googleapi.CheckResponse(res); err != nil {
2046 return nil, gensupport.WrapError(err)
2047 }
2048 ret := &GoogleProtobufEmpty{
2049 ServerResponse: googleapi.ServerResponse{
2050 Header: res.Header,
2051 HTTPStatusCode: res.StatusCode,
2052 },
2053 }
2054 target := &ret
2055 if err := gensupport.DecodeResponse(target, res); err != nil {
2056 return nil, err
2057 }
2058 return ret, nil
2059 }
2060
2061 type OrganizationsCustomConstraintsGetCall struct {
2062 s *Service
2063 name string
2064 urlParams_ gensupport.URLParams
2065 ifNoneMatch_ string
2066 ctx_ context.Context
2067 header_ http.Header
2068 }
2069
2070
2071
2072
2073
2074
2075 func (r *OrganizationsCustomConstraintsService) Get(name string) *OrganizationsCustomConstraintsGetCall {
2076 c := &OrganizationsCustomConstraintsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2077 c.name = name
2078 return c
2079 }
2080
2081
2082
2083
2084 func (c *OrganizationsCustomConstraintsGetCall) Fields(s ...googleapi.Field) *OrganizationsCustomConstraintsGetCall {
2085 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2086 return c
2087 }
2088
2089
2090
2091
2092 func (c *OrganizationsCustomConstraintsGetCall) IfNoneMatch(entityTag string) *OrganizationsCustomConstraintsGetCall {
2093 c.ifNoneMatch_ = entityTag
2094 return c
2095 }
2096
2097
2098 func (c *OrganizationsCustomConstraintsGetCall) Context(ctx context.Context) *OrganizationsCustomConstraintsGetCall {
2099 c.ctx_ = ctx
2100 return c
2101 }
2102
2103
2104
2105 func (c *OrganizationsCustomConstraintsGetCall) Header() http.Header {
2106 if c.header_ == nil {
2107 c.header_ = make(http.Header)
2108 }
2109 return c.header_
2110 }
2111
2112 func (c *OrganizationsCustomConstraintsGetCall) doRequest(alt string) (*http.Response, error) {
2113 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2114 if c.ifNoneMatch_ != "" {
2115 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2116 }
2117 var body io.Reader = nil
2118 c.urlParams_.Set("alt", alt)
2119 c.urlParams_.Set("prettyPrint", "false")
2120 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2121 urls += "?" + c.urlParams_.Encode()
2122 req, err := http.NewRequest("GET", urls, body)
2123 if err != nil {
2124 return nil, err
2125 }
2126 req.Header = reqHeaders
2127 googleapi.Expand(req.URL, map[string]string{
2128 "name": c.name,
2129 })
2130 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2131 }
2132
2133
2134
2135
2136
2137
2138
2139 func (c *OrganizationsCustomConstraintsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2CustomConstraint, error) {
2140 gensupport.SetOptions(c.urlParams_, opts...)
2141 res, err := c.doRequest("json")
2142 if res != nil && res.StatusCode == http.StatusNotModified {
2143 if res.Body != nil {
2144 res.Body.Close()
2145 }
2146 return nil, gensupport.WrapError(&googleapi.Error{
2147 Code: res.StatusCode,
2148 Header: res.Header,
2149 })
2150 }
2151 if err != nil {
2152 return nil, err
2153 }
2154 defer googleapi.CloseBody(res)
2155 if err := googleapi.CheckResponse(res); err != nil {
2156 return nil, gensupport.WrapError(err)
2157 }
2158 ret := &GoogleCloudOrgpolicyV2CustomConstraint{
2159 ServerResponse: googleapi.ServerResponse{
2160 Header: res.Header,
2161 HTTPStatusCode: res.StatusCode,
2162 },
2163 }
2164 target := &ret
2165 if err := gensupport.DecodeResponse(target, res); err != nil {
2166 return nil, err
2167 }
2168 return ret, nil
2169 }
2170
2171 type OrganizationsCustomConstraintsListCall struct {
2172 s *Service
2173 parent string
2174 urlParams_ gensupport.URLParams
2175 ifNoneMatch_ string
2176 ctx_ context.Context
2177 header_ http.Header
2178 }
2179
2180
2181
2182
2183
2184
2185
2186 func (r *OrganizationsCustomConstraintsService) List(parent string) *OrganizationsCustomConstraintsListCall {
2187 c := &OrganizationsCustomConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2188 c.parent = parent
2189 return c
2190 }
2191
2192
2193
2194
2195 func (c *OrganizationsCustomConstraintsListCall) PageSize(pageSize int64) *OrganizationsCustomConstraintsListCall {
2196 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2197 return c
2198 }
2199
2200
2201
2202
2203 func (c *OrganizationsCustomConstraintsListCall) PageToken(pageToken string) *OrganizationsCustomConstraintsListCall {
2204 c.urlParams_.Set("pageToken", pageToken)
2205 return c
2206 }
2207
2208
2209
2210
2211 func (c *OrganizationsCustomConstraintsListCall) Fields(s ...googleapi.Field) *OrganizationsCustomConstraintsListCall {
2212 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2213 return c
2214 }
2215
2216
2217
2218
2219 func (c *OrganizationsCustomConstraintsListCall) IfNoneMatch(entityTag string) *OrganizationsCustomConstraintsListCall {
2220 c.ifNoneMatch_ = entityTag
2221 return c
2222 }
2223
2224
2225 func (c *OrganizationsCustomConstraintsListCall) Context(ctx context.Context) *OrganizationsCustomConstraintsListCall {
2226 c.ctx_ = ctx
2227 return c
2228 }
2229
2230
2231
2232 func (c *OrganizationsCustomConstraintsListCall) Header() http.Header {
2233 if c.header_ == nil {
2234 c.header_ = make(http.Header)
2235 }
2236 return c.header_
2237 }
2238
2239 func (c *OrganizationsCustomConstraintsListCall) doRequest(alt string) (*http.Response, error) {
2240 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2241 if c.ifNoneMatch_ != "" {
2242 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2243 }
2244 var body io.Reader = nil
2245 c.urlParams_.Set("alt", alt)
2246 c.urlParams_.Set("prettyPrint", "false")
2247 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/customConstraints")
2248 urls += "?" + c.urlParams_.Encode()
2249 req, err := http.NewRequest("GET", urls, body)
2250 if err != nil {
2251 return nil, err
2252 }
2253 req.Header = reqHeaders
2254 googleapi.Expand(req.URL, map[string]string{
2255 "parent": c.parent,
2256 })
2257 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2258 }
2259
2260
2261
2262
2263
2264
2265
2266 func (c *OrganizationsCustomConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListCustomConstraintsResponse, error) {
2267 gensupport.SetOptions(c.urlParams_, opts...)
2268 res, err := c.doRequest("json")
2269 if res != nil && res.StatusCode == http.StatusNotModified {
2270 if res.Body != nil {
2271 res.Body.Close()
2272 }
2273 return nil, gensupport.WrapError(&googleapi.Error{
2274 Code: res.StatusCode,
2275 Header: res.Header,
2276 })
2277 }
2278 if err != nil {
2279 return nil, err
2280 }
2281 defer googleapi.CloseBody(res)
2282 if err := googleapi.CheckResponse(res); err != nil {
2283 return nil, gensupport.WrapError(err)
2284 }
2285 ret := &GoogleCloudOrgpolicyV2ListCustomConstraintsResponse{
2286 ServerResponse: googleapi.ServerResponse{
2287 Header: res.Header,
2288 HTTPStatusCode: res.StatusCode,
2289 },
2290 }
2291 target := &ret
2292 if err := gensupport.DecodeResponse(target, res); err != nil {
2293 return nil, err
2294 }
2295 return ret, nil
2296 }
2297
2298
2299
2300
2301 func (c *OrganizationsCustomConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListCustomConstraintsResponse) error) error {
2302 c.ctx_ = ctx
2303 defer c.PageToken(c.urlParams_.Get("pageToken"))
2304 for {
2305 x, err := c.Do()
2306 if err != nil {
2307 return err
2308 }
2309 if err := f(x); err != nil {
2310 return err
2311 }
2312 if x.NextPageToken == "" {
2313 return nil
2314 }
2315 c.PageToken(x.NextPageToken)
2316 }
2317 }
2318
2319 type OrganizationsCustomConstraintsPatchCall struct {
2320 s *Service
2321 name string
2322 googlecloudorgpolicyv2customconstraint *GoogleCloudOrgpolicyV2CustomConstraint
2323 urlParams_ gensupport.URLParams
2324 ctx_ context.Context
2325 header_ http.Header
2326 }
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339 func (r *OrganizationsCustomConstraintsService) Patch(name string, googlecloudorgpolicyv2customconstraint *GoogleCloudOrgpolicyV2CustomConstraint) *OrganizationsCustomConstraintsPatchCall {
2340 c := &OrganizationsCustomConstraintsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2341 c.name = name
2342 c.googlecloudorgpolicyv2customconstraint = googlecloudorgpolicyv2customconstraint
2343 return c
2344 }
2345
2346
2347
2348
2349 func (c *OrganizationsCustomConstraintsPatchCall) Fields(s ...googleapi.Field) *OrganizationsCustomConstraintsPatchCall {
2350 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2351 return c
2352 }
2353
2354
2355 func (c *OrganizationsCustomConstraintsPatchCall) Context(ctx context.Context) *OrganizationsCustomConstraintsPatchCall {
2356 c.ctx_ = ctx
2357 return c
2358 }
2359
2360
2361
2362 func (c *OrganizationsCustomConstraintsPatchCall) Header() http.Header {
2363 if c.header_ == nil {
2364 c.header_ = make(http.Header)
2365 }
2366 return c.header_
2367 }
2368
2369 func (c *OrganizationsCustomConstraintsPatchCall) doRequest(alt string) (*http.Response, error) {
2370 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2371 var body io.Reader = nil
2372 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2customconstraint)
2373 if err != nil {
2374 return nil, err
2375 }
2376 c.urlParams_.Set("alt", alt)
2377 c.urlParams_.Set("prettyPrint", "false")
2378 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2379 urls += "?" + c.urlParams_.Encode()
2380 req, err := http.NewRequest("PATCH", urls, body)
2381 if err != nil {
2382 return nil, err
2383 }
2384 req.Header = reqHeaders
2385 googleapi.Expand(req.URL, map[string]string{
2386 "name": c.name,
2387 })
2388 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2389 }
2390
2391
2392
2393
2394
2395
2396
2397 func (c *OrganizationsCustomConstraintsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2CustomConstraint, error) {
2398 gensupport.SetOptions(c.urlParams_, opts...)
2399 res, err := c.doRequest("json")
2400 if res != nil && res.StatusCode == http.StatusNotModified {
2401 if res.Body != nil {
2402 res.Body.Close()
2403 }
2404 return nil, gensupport.WrapError(&googleapi.Error{
2405 Code: res.StatusCode,
2406 Header: res.Header,
2407 })
2408 }
2409 if err != nil {
2410 return nil, err
2411 }
2412 defer googleapi.CloseBody(res)
2413 if err := googleapi.CheckResponse(res); err != nil {
2414 return nil, gensupport.WrapError(err)
2415 }
2416 ret := &GoogleCloudOrgpolicyV2CustomConstraint{
2417 ServerResponse: googleapi.ServerResponse{
2418 Header: res.Header,
2419 HTTPStatusCode: res.StatusCode,
2420 },
2421 }
2422 target := &ret
2423 if err := gensupport.DecodeResponse(target, res); err != nil {
2424 return nil, err
2425 }
2426 return ret, nil
2427 }
2428
2429 type OrganizationsPoliciesCreateCall struct {
2430 s *Service
2431 parent string
2432 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
2433 urlParams_ gensupport.URLParams
2434 ctx_ context.Context
2435 header_ http.Header
2436 }
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447 func (r *OrganizationsPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *OrganizationsPoliciesCreateCall {
2448 c := &OrganizationsPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2449 c.parent = parent
2450 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
2451 return c
2452 }
2453
2454
2455
2456
2457 func (c *OrganizationsPoliciesCreateCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesCreateCall {
2458 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2459 return c
2460 }
2461
2462
2463 func (c *OrganizationsPoliciesCreateCall) Context(ctx context.Context) *OrganizationsPoliciesCreateCall {
2464 c.ctx_ = ctx
2465 return c
2466 }
2467
2468
2469
2470 func (c *OrganizationsPoliciesCreateCall) Header() http.Header {
2471 if c.header_ == nil {
2472 c.header_ = make(http.Header)
2473 }
2474 return c.header_
2475 }
2476
2477 func (c *OrganizationsPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
2478 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2479 var body io.Reader = nil
2480 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
2481 if err != nil {
2482 return nil, err
2483 }
2484 c.urlParams_.Set("alt", alt)
2485 c.urlParams_.Set("prettyPrint", "false")
2486 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
2487 urls += "?" + c.urlParams_.Encode()
2488 req, err := http.NewRequest("POST", urls, body)
2489 if err != nil {
2490 return nil, err
2491 }
2492 req.Header = reqHeaders
2493 googleapi.Expand(req.URL, map[string]string{
2494 "parent": c.parent,
2495 })
2496 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2497 }
2498
2499
2500
2501
2502
2503
2504
2505 func (c *OrganizationsPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2506 gensupport.SetOptions(c.urlParams_, opts...)
2507 res, err := c.doRequest("json")
2508 if res != nil && res.StatusCode == http.StatusNotModified {
2509 if res.Body != nil {
2510 res.Body.Close()
2511 }
2512 return nil, gensupport.WrapError(&googleapi.Error{
2513 Code: res.StatusCode,
2514 Header: res.Header,
2515 })
2516 }
2517 if err != nil {
2518 return nil, err
2519 }
2520 defer googleapi.CloseBody(res)
2521 if err := googleapi.CheckResponse(res); err != nil {
2522 return nil, gensupport.WrapError(err)
2523 }
2524 ret := &GoogleCloudOrgpolicyV2Policy{
2525 ServerResponse: googleapi.ServerResponse{
2526 Header: res.Header,
2527 HTTPStatusCode: res.StatusCode,
2528 },
2529 }
2530 target := &ret
2531 if err := gensupport.DecodeResponse(target, res); err != nil {
2532 return nil, err
2533 }
2534 return ret, nil
2535 }
2536
2537 type OrganizationsPoliciesDeleteCall struct {
2538 s *Service
2539 name string
2540 urlParams_ gensupport.URLParams
2541 ctx_ context.Context
2542 header_ http.Header
2543 }
2544
2545
2546
2547
2548
2549
2550 func (r *OrganizationsPoliciesService) Delete(name string) *OrganizationsPoliciesDeleteCall {
2551 c := &OrganizationsPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2552 c.name = name
2553 return c
2554 }
2555
2556
2557
2558
2559 func (c *OrganizationsPoliciesDeleteCall) Etag(etag string) *OrganizationsPoliciesDeleteCall {
2560 c.urlParams_.Set("etag", etag)
2561 return c
2562 }
2563
2564
2565
2566
2567 func (c *OrganizationsPoliciesDeleteCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesDeleteCall {
2568 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2569 return c
2570 }
2571
2572
2573 func (c *OrganizationsPoliciesDeleteCall) Context(ctx context.Context) *OrganizationsPoliciesDeleteCall {
2574 c.ctx_ = ctx
2575 return c
2576 }
2577
2578
2579
2580 func (c *OrganizationsPoliciesDeleteCall) Header() http.Header {
2581 if c.header_ == nil {
2582 c.header_ = make(http.Header)
2583 }
2584 return c.header_
2585 }
2586
2587 func (c *OrganizationsPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
2588 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2589 var body io.Reader = nil
2590 c.urlParams_.Set("alt", alt)
2591 c.urlParams_.Set("prettyPrint", "false")
2592 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2593 urls += "?" + c.urlParams_.Encode()
2594 req, err := http.NewRequest("DELETE", urls, body)
2595 if err != nil {
2596 return nil, err
2597 }
2598 req.Header = reqHeaders
2599 googleapi.Expand(req.URL, map[string]string{
2600 "name": c.name,
2601 })
2602 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2603 }
2604
2605
2606
2607
2608
2609
2610
2611 func (c *OrganizationsPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
2612 gensupport.SetOptions(c.urlParams_, opts...)
2613 res, err := c.doRequest("json")
2614 if res != nil && res.StatusCode == http.StatusNotModified {
2615 if res.Body != nil {
2616 res.Body.Close()
2617 }
2618 return nil, gensupport.WrapError(&googleapi.Error{
2619 Code: res.StatusCode,
2620 Header: res.Header,
2621 })
2622 }
2623 if err != nil {
2624 return nil, err
2625 }
2626 defer googleapi.CloseBody(res)
2627 if err := googleapi.CheckResponse(res); err != nil {
2628 return nil, gensupport.WrapError(err)
2629 }
2630 ret := &GoogleProtobufEmpty{
2631 ServerResponse: googleapi.ServerResponse{
2632 Header: res.Header,
2633 HTTPStatusCode: res.StatusCode,
2634 },
2635 }
2636 target := &ret
2637 if err := gensupport.DecodeResponse(target, res); err != nil {
2638 return nil, err
2639 }
2640 return ret, nil
2641 }
2642
2643 type OrganizationsPoliciesGetCall struct {
2644 s *Service
2645 name string
2646 urlParams_ gensupport.URLParams
2647 ifNoneMatch_ string
2648 ctx_ context.Context
2649 header_ http.Header
2650 }
2651
2652
2653
2654
2655
2656
2657 func (r *OrganizationsPoliciesService) Get(name string) *OrganizationsPoliciesGetCall {
2658 c := &OrganizationsPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2659 c.name = name
2660 return c
2661 }
2662
2663
2664
2665
2666 func (c *OrganizationsPoliciesGetCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesGetCall {
2667 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2668 return c
2669 }
2670
2671
2672
2673
2674 func (c *OrganizationsPoliciesGetCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesGetCall {
2675 c.ifNoneMatch_ = entityTag
2676 return c
2677 }
2678
2679
2680 func (c *OrganizationsPoliciesGetCall) Context(ctx context.Context) *OrganizationsPoliciesGetCall {
2681 c.ctx_ = ctx
2682 return c
2683 }
2684
2685
2686
2687 func (c *OrganizationsPoliciesGetCall) Header() http.Header {
2688 if c.header_ == nil {
2689 c.header_ = make(http.Header)
2690 }
2691 return c.header_
2692 }
2693
2694 func (c *OrganizationsPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
2695 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2696 if c.ifNoneMatch_ != "" {
2697 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2698 }
2699 var body io.Reader = nil
2700 c.urlParams_.Set("alt", alt)
2701 c.urlParams_.Set("prettyPrint", "false")
2702 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2703 urls += "?" + c.urlParams_.Encode()
2704 req, err := http.NewRequest("GET", urls, body)
2705 if err != nil {
2706 return nil, err
2707 }
2708 req.Header = reqHeaders
2709 googleapi.Expand(req.URL, map[string]string{
2710 "name": c.name,
2711 })
2712 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2713 }
2714
2715
2716
2717
2718
2719
2720
2721 func (c *OrganizationsPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2722 gensupport.SetOptions(c.urlParams_, opts...)
2723 res, err := c.doRequest("json")
2724 if res != nil && res.StatusCode == http.StatusNotModified {
2725 if res.Body != nil {
2726 res.Body.Close()
2727 }
2728 return nil, gensupport.WrapError(&googleapi.Error{
2729 Code: res.StatusCode,
2730 Header: res.Header,
2731 })
2732 }
2733 if err != nil {
2734 return nil, err
2735 }
2736 defer googleapi.CloseBody(res)
2737 if err := googleapi.CheckResponse(res); err != nil {
2738 return nil, gensupport.WrapError(err)
2739 }
2740 ret := &GoogleCloudOrgpolicyV2Policy{
2741 ServerResponse: googleapi.ServerResponse{
2742 Header: res.Header,
2743 HTTPStatusCode: res.StatusCode,
2744 },
2745 }
2746 target := &ret
2747 if err := gensupport.DecodeResponse(target, res); err != nil {
2748 return nil, err
2749 }
2750 return ret, nil
2751 }
2752
2753 type OrganizationsPoliciesGetEffectivePolicyCall struct {
2754 s *Service
2755 name string
2756 urlParams_ gensupport.URLParams
2757 ifNoneMatch_ string
2758 ctx_ context.Context
2759 header_ http.Header
2760 }
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770 func (r *OrganizationsPoliciesService) GetEffectivePolicy(name string) *OrganizationsPoliciesGetEffectivePolicyCall {
2771 c := &OrganizationsPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2772 c.name = name
2773 return c
2774 }
2775
2776
2777
2778
2779 func (c *OrganizationsPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesGetEffectivePolicyCall {
2780 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2781 return c
2782 }
2783
2784
2785
2786
2787 func (c *OrganizationsPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesGetEffectivePolicyCall {
2788 c.ifNoneMatch_ = entityTag
2789 return c
2790 }
2791
2792
2793 func (c *OrganizationsPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *OrganizationsPoliciesGetEffectivePolicyCall {
2794 c.ctx_ = ctx
2795 return c
2796 }
2797
2798
2799
2800 func (c *OrganizationsPoliciesGetEffectivePolicyCall) Header() http.Header {
2801 if c.header_ == nil {
2802 c.header_ = make(http.Header)
2803 }
2804 return c.header_
2805 }
2806
2807 func (c *OrganizationsPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
2808 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2809 if c.ifNoneMatch_ != "" {
2810 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2811 }
2812 var body io.Reader = nil
2813 c.urlParams_.Set("alt", alt)
2814 c.urlParams_.Set("prettyPrint", "false")
2815 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
2816 urls += "?" + c.urlParams_.Encode()
2817 req, err := http.NewRequest("GET", urls, body)
2818 if err != nil {
2819 return nil, err
2820 }
2821 req.Header = reqHeaders
2822 googleapi.Expand(req.URL, map[string]string{
2823 "name": c.name,
2824 })
2825 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2826 }
2827
2828
2829
2830
2831
2832
2833
2834 func (c *OrganizationsPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2835 gensupport.SetOptions(c.urlParams_, opts...)
2836 res, err := c.doRequest("json")
2837 if res != nil && res.StatusCode == http.StatusNotModified {
2838 if res.Body != nil {
2839 res.Body.Close()
2840 }
2841 return nil, gensupport.WrapError(&googleapi.Error{
2842 Code: res.StatusCode,
2843 Header: res.Header,
2844 })
2845 }
2846 if err != nil {
2847 return nil, err
2848 }
2849 defer googleapi.CloseBody(res)
2850 if err := googleapi.CheckResponse(res); err != nil {
2851 return nil, gensupport.WrapError(err)
2852 }
2853 ret := &GoogleCloudOrgpolicyV2Policy{
2854 ServerResponse: googleapi.ServerResponse{
2855 Header: res.Header,
2856 HTTPStatusCode: res.StatusCode,
2857 },
2858 }
2859 target := &ret
2860 if err := gensupport.DecodeResponse(target, res); err != nil {
2861 return nil, err
2862 }
2863 return ret, nil
2864 }
2865
2866 type OrganizationsPoliciesListCall struct {
2867 s *Service
2868 parent string
2869 urlParams_ gensupport.URLParams
2870 ifNoneMatch_ string
2871 ctx_ context.Context
2872 header_ http.Header
2873 }
2874
2875
2876
2877
2878
2879
2880
2881
2882 func (r *OrganizationsPoliciesService) List(parent string) *OrganizationsPoliciesListCall {
2883 c := &OrganizationsPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2884 c.parent = parent
2885 return c
2886 }
2887
2888
2889
2890
2891 func (c *OrganizationsPoliciesListCall) PageSize(pageSize int64) *OrganizationsPoliciesListCall {
2892 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2893 return c
2894 }
2895
2896
2897
2898
2899 func (c *OrganizationsPoliciesListCall) PageToken(pageToken string) *OrganizationsPoliciesListCall {
2900 c.urlParams_.Set("pageToken", pageToken)
2901 return c
2902 }
2903
2904
2905
2906
2907 func (c *OrganizationsPoliciesListCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesListCall {
2908 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2909 return c
2910 }
2911
2912
2913
2914
2915 func (c *OrganizationsPoliciesListCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesListCall {
2916 c.ifNoneMatch_ = entityTag
2917 return c
2918 }
2919
2920
2921 func (c *OrganizationsPoliciesListCall) Context(ctx context.Context) *OrganizationsPoliciesListCall {
2922 c.ctx_ = ctx
2923 return c
2924 }
2925
2926
2927
2928 func (c *OrganizationsPoliciesListCall) Header() http.Header {
2929 if c.header_ == nil {
2930 c.header_ = make(http.Header)
2931 }
2932 return c.header_
2933 }
2934
2935 func (c *OrganizationsPoliciesListCall) doRequest(alt string) (*http.Response, error) {
2936 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2937 if c.ifNoneMatch_ != "" {
2938 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2939 }
2940 var body io.Reader = nil
2941 c.urlParams_.Set("alt", alt)
2942 c.urlParams_.Set("prettyPrint", "false")
2943 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
2944 urls += "?" + c.urlParams_.Encode()
2945 req, err := http.NewRequest("GET", urls, body)
2946 if err != nil {
2947 return nil, err
2948 }
2949 req.Header = reqHeaders
2950 googleapi.Expand(req.URL, map[string]string{
2951 "parent": c.parent,
2952 })
2953 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2954 }
2955
2956
2957
2958
2959
2960
2961
2962 func (c *OrganizationsPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
2963 gensupport.SetOptions(c.urlParams_, opts...)
2964 res, err := c.doRequest("json")
2965 if res != nil && res.StatusCode == http.StatusNotModified {
2966 if res.Body != nil {
2967 res.Body.Close()
2968 }
2969 return nil, gensupport.WrapError(&googleapi.Error{
2970 Code: res.StatusCode,
2971 Header: res.Header,
2972 })
2973 }
2974 if err != nil {
2975 return nil, err
2976 }
2977 defer googleapi.CloseBody(res)
2978 if err := googleapi.CheckResponse(res); err != nil {
2979 return nil, gensupport.WrapError(err)
2980 }
2981 ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
2982 ServerResponse: googleapi.ServerResponse{
2983 Header: res.Header,
2984 HTTPStatusCode: res.StatusCode,
2985 },
2986 }
2987 target := &ret
2988 if err := gensupport.DecodeResponse(target, res); err != nil {
2989 return nil, err
2990 }
2991 return ret, nil
2992 }
2993
2994
2995
2996
2997 func (c *OrganizationsPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
2998 c.ctx_ = ctx
2999 defer c.PageToken(c.urlParams_.Get("pageToken"))
3000 for {
3001 x, err := c.Do()
3002 if err != nil {
3003 return err
3004 }
3005 if err := f(x); err != nil {
3006 return err
3007 }
3008 if x.NextPageToken == "" {
3009 return nil
3010 }
3011 c.PageToken(x.NextPageToken)
3012 }
3013 }
3014
3015 type OrganizationsPoliciesPatchCall struct {
3016 s *Service
3017 name string
3018 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
3019 urlParams_ gensupport.URLParams
3020 ctx_ context.Context
3021 header_ http.Header
3022 }
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040 func (r *OrganizationsPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *OrganizationsPoliciesPatchCall {
3041 c := &OrganizationsPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3042 c.name = name
3043 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
3044 return c
3045 }
3046
3047
3048
3049
3050
3051 func (c *OrganizationsPoliciesPatchCall) UpdateMask(updateMask string) *OrganizationsPoliciesPatchCall {
3052 c.urlParams_.Set("updateMask", updateMask)
3053 return c
3054 }
3055
3056
3057
3058
3059 func (c *OrganizationsPoliciesPatchCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesPatchCall {
3060 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3061 return c
3062 }
3063
3064
3065 func (c *OrganizationsPoliciesPatchCall) Context(ctx context.Context) *OrganizationsPoliciesPatchCall {
3066 c.ctx_ = ctx
3067 return c
3068 }
3069
3070
3071
3072 func (c *OrganizationsPoliciesPatchCall) Header() http.Header {
3073 if c.header_ == nil {
3074 c.header_ = make(http.Header)
3075 }
3076 return c.header_
3077 }
3078
3079 func (c *OrganizationsPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
3080 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3081 var body io.Reader = nil
3082 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
3083 if err != nil {
3084 return nil, err
3085 }
3086 c.urlParams_.Set("alt", alt)
3087 c.urlParams_.Set("prettyPrint", "false")
3088 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3089 urls += "?" + c.urlParams_.Encode()
3090 req, err := http.NewRequest("PATCH", urls, body)
3091 if err != nil {
3092 return nil, err
3093 }
3094 req.Header = reqHeaders
3095 googleapi.Expand(req.URL, map[string]string{
3096 "name": c.name,
3097 })
3098 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3099 }
3100
3101
3102
3103
3104
3105
3106
3107 func (c *OrganizationsPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3108 gensupport.SetOptions(c.urlParams_, opts...)
3109 res, err := c.doRequest("json")
3110 if res != nil && res.StatusCode == http.StatusNotModified {
3111 if res.Body != nil {
3112 res.Body.Close()
3113 }
3114 return nil, gensupport.WrapError(&googleapi.Error{
3115 Code: res.StatusCode,
3116 Header: res.Header,
3117 })
3118 }
3119 if err != nil {
3120 return nil, err
3121 }
3122 defer googleapi.CloseBody(res)
3123 if err := googleapi.CheckResponse(res); err != nil {
3124 return nil, gensupport.WrapError(err)
3125 }
3126 ret := &GoogleCloudOrgpolicyV2Policy{
3127 ServerResponse: googleapi.ServerResponse{
3128 Header: res.Header,
3129 HTTPStatusCode: res.StatusCode,
3130 },
3131 }
3132 target := &ret
3133 if err := gensupport.DecodeResponse(target, res); err != nil {
3134 return nil, err
3135 }
3136 return ret, nil
3137 }
3138
3139 type ProjectsConstraintsListCall struct {
3140 s *Service
3141 parent string
3142 urlParams_ gensupport.URLParams
3143 ifNoneMatch_ string
3144 ctx_ context.Context
3145 header_ http.Header
3146 }
3147
3148
3149
3150
3151
3152
3153
3154 func (r *ProjectsConstraintsService) List(parent string) *ProjectsConstraintsListCall {
3155 c := &ProjectsConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3156 c.parent = parent
3157 return c
3158 }
3159
3160
3161
3162
3163 func (c *ProjectsConstraintsListCall) PageSize(pageSize int64) *ProjectsConstraintsListCall {
3164 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3165 return c
3166 }
3167
3168
3169
3170
3171 func (c *ProjectsConstraintsListCall) PageToken(pageToken string) *ProjectsConstraintsListCall {
3172 c.urlParams_.Set("pageToken", pageToken)
3173 return c
3174 }
3175
3176
3177
3178
3179 func (c *ProjectsConstraintsListCall) Fields(s ...googleapi.Field) *ProjectsConstraintsListCall {
3180 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3181 return c
3182 }
3183
3184
3185
3186
3187 func (c *ProjectsConstraintsListCall) IfNoneMatch(entityTag string) *ProjectsConstraintsListCall {
3188 c.ifNoneMatch_ = entityTag
3189 return c
3190 }
3191
3192
3193 func (c *ProjectsConstraintsListCall) Context(ctx context.Context) *ProjectsConstraintsListCall {
3194 c.ctx_ = ctx
3195 return c
3196 }
3197
3198
3199
3200 func (c *ProjectsConstraintsListCall) Header() http.Header {
3201 if c.header_ == nil {
3202 c.header_ = make(http.Header)
3203 }
3204 return c.header_
3205 }
3206
3207 func (c *ProjectsConstraintsListCall) doRequest(alt string) (*http.Response, error) {
3208 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3209 if c.ifNoneMatch_ != "" {
3210 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3211 }
3212 var body io.Reader = nil
3213 c.urlParams_.Set("alt", alt)
3214 c.urlParams_.Set("prettyPrint", "false")
3215 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
3216 urls += "?" + c.urlParams_.Encode()
3217 req, err := http.NewRequest("GET", urls, body)
3218 if err != nil {
3219 return nil, err
3220 }
3221 req.Header = reqHeaders
3222 googleapi.Expand(req.URL, map[string]string{
3223 "parent": c.parent,
3224 })
3225 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3226 }
3227
3228
3229
3230
3231
3232
3233
3234 func (c *ProjectsConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
3235 gensupport.SetOptions(c.urlParams_, opts...)
3236 res, err := c.doRequest("json")
3237 if res != nil && res.StatusCode == http.StatusNotModified {
3238 if res.Body != nil {
3239 res.Body.Close()
3240 }
3241 return nil, gensupport.WrapError(&googleapi.Error{
3242 Code: res.StatusCode,
3243 Header: res.Header,
3244 })
3245 }
3246 if err != nil {
3247 return nil, err
3248 }
3249 defer googleapi.CloseBody(res)
3250 if err := googleapi.CheckResponse(res); err != nil {
3251 return nil, gensupport.WrapError(err)
3252 }
3253 ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
3254 ServerResponse: googleapi.ServerResponse{
3255 Header: res.Header,
3256 HTTPStatusCode: res.StatusCode,
3257 },
3258 }
3259 target := &ret
3260 if err := gensupport.DecodeResponse(target, res); err != nil {
3261 return nil, err
3262 }
3263 return ret, nil
3264 }
3265
3266
3267
3268
3269 func (c *ProjectsConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
3270 c.ctx_ = ctx
3271 defer c.PageToken(c.urlParams_.Get("pageToken"))
3272 for {
3273 x, err := c.Do()
3274 if err != nil {
3275 return err
3276 }
3277 if err := f(x); err != nil {
3278 return err
3279 }
3280 if x.NextPageToken == "" {
3281 return nil
3282 }
3283 c.PageToken(x.NextPageToken)
3284 }
3285 }
3286
3287 type ProjectsPoliciesCreateCall struct {
3288 s *Service
3289 parent string
3290 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
3291 urlParams_ gensupport.URLParams
3292 ctx_ context.Context
3293 header_ http.Header
3294 }
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305 func (r *ProjectsPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *ProjectsPoliciesCreateCall {
3306 c := &ProjectsPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3307 c.parent = parent
3308 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
3309 return c
3310 }
3311
3312
3313
3314
3315 func (c *ProjectsPoliciesCreateCall) Fields(s ...googleapi.Field) *ProjectsPoliciesCreateCall {
3316 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3317 return c
3318 }
3319
3320
3321 func (c *ProjectsPoliciesCreateCall) Context(ctx context.Context) *ProjectsPoliciesCreateCall {
3322 c.ctx_ = ctx
3323 return c
3324 }
3325
3326
3327
3328 func (c *ProjectsPoliciesCreateCall) Header() http.Header {
3329 if c.header_ == nil {
3330 c.header_ = make(http.Header)
3331 }
3332 return c.header_
3333 }
3334
3335 func (c *ProjectsPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
3336 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3337 var body io.Reader = nil
3338 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
3339 if err != nil {
3340 return nil, err
3341 }
3342 c.urlParams_.Set("alt", alt)
3343 c.urlParams_.Set("prettyPrint", "false")
3344 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
3345 urls += "?" + c.urlParams_.Encode()
3346 req, err := http.NewRequest("POST", urls, body)
3347 if err != nil {
3348 return nil, err
3349 }
3350 req.Header = reqHeaders
3351 googleapi.Expand(req.URL, map[string]string{
3352 "parent": c.parent,
3353 })
3354 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3355 }
3356
3357
3358
3359
3360
3361
3362
3363 func (c *ProjectsPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3364 gensupport.SetOptions(c.urlParams_, opts...)
3365 res, err := c.doRequest("json")
3366 if res != nil && res.StatusCode == http.StatusNotModified {
3367 if res.Body != nil {
3368 res.Body.Close()
3369 }
3370 return nil, gensupport.WrapError(&googleapi.Error{
3371 Code: res.StatusCode,
3372 Header: res.Header,
3373 })
3374 }
3375 if err != nil {
3376 return nil, err
3377 }
3378 defer googleapi.CloseBody(res)
3379 if err := googleapi.CheckResponse(res); err != nil {
3380 return nil, gensupport.WrapError(err)
3381 }
3382 ret := &GoogleCloudOrgpolicyV2Policy{
3383 ServerResponse: googleapi.ServerResponse{
3384 Header: res.Header,
3385 HTTPStatusCode: res.StatusCode,
3386 },
3387 }
3388 target := &ret
3389 if err := gensupport.DecodeResponse(target, res); err != nil {
3390 return nil, err
3391 }
3392 return ret, nil
3393 }
3394
3395 type ProjectsPoliciesDeleteCall struct {
3396 s *Service
3397 name string
3398 urlParams_ gensupport.URLParams
3399 ctx_ context.Context
3400 header_ http.Header
3401 }
3402
3403
3404
3405
3406
3407
3408 func (r *ProjectsPoliciesService) Delete(name string) *ProjectsPoliciesDeleteCall {
3409 c := &ProjectsPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3410 c.name = name
3411 return c
3412 }
3413
3414
3415
3416
3417 func (c *ProjectsPoliciesDeleteCall) Etag(etag string) *ProjectsPoliciesDeleteCall {
3418 c.urlParams_.Set("etag", etag)
3419 return c
3420 }
3421
3422
3423
3424
3425 func (c *ProjectsPoliciesDeleteCall) Fields(s ...googleapi.Field) *ProjectsPoliciesDeleteCall {
3426 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3427 return c
3428 }
3429
3430
3431 func (c *ProjectsPoliciesDeleteCall) Context(ctx context.Context) *ProjectsPoliciesDeleteCall {
3432 c.ctx_ = ctx
3433 return c
3434 }
3435
3436
3437
3438 func (c *ProjectsPoliciesDeleteCall) Header() http.Header {
3439 if c.header_ == nil {
3440 c.header_ = make(http.Header)
3441 }
3442 return c.header_
3443 }
3444
3445 func (c *ProjectsPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
3446 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3447 var body io.Reader = nil
3448 c.urlParams_.Set("alt", alt)
3449 c.urlParams_.Set("prettyPrint", "false")
3450 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3451 urls += "?" + c.urlParams_.Encode()
3452 req, err := http.NewRequest("DELETE", urls, body)
3453 if err != nil {
3454 return nil, err
3455 }
3456 req.Header = reqHeaders
3457 googleapi.Expand(req.URL, map[string]string{
3458 "name": c.name,
3459 })
3460 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3461 }
3462
3463
3464
3465
3466
3467
3468
3469 func (c *ProjectsPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
3470 gensupport.SetOptions(c.urlParams_, opts...)
3471 res, err := c.doRequest("json")
3472 if res != nil && res.StatusCode == http.StatusNotModified {
3473 if res.Body != nil {
3474 res.Body.Close()
3475 }
3476 return nil, gensupport.WrapError(&googleapi.Error{
3477 Code: res.StatusCode,
3478 Header: res.Header,
3479 })
3480 }
3481 if err != nil {
3482 return nil, err
3483 }
3484 defer googleapi.CloseBody(res)
3485 if err := googleapi.CheckResponse(res); err != nil {
3486 return nil, gensupport.WrapError(err)
3487 }
3488 ret := &GoogleProtobufEmpty{
3489 ServerResponse: googleapi.ServerResponse{
3490 Header: res.Header,
3491 HTTPStatusCode: res.StatusCode,
3492 },
3493 }
3494 target := &ret
3495 if err := gensupport.DecodeResponse(target, res); err != nil {
3496 return nil, err
3497 }
3498 return ret, nil
3499 }
3500
3501 type ProjectsPoliciesGetCall struct {
3502 s *Service
3503 name string
3504 urlParams_ gensupport.URLParams
3505 ifNoneMatch_ string
3506 ctx_ context.Context
3507 header_ http.Header
3508 }
3509
3510
3511
3512
3513
3514
3515 func (r *ProjectsPoliciesService) Get(name string) *ProjectsPoliciesGetCall {
3516 c := &ProjectsPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3517 c.name = name
3518 return c
3519 }
3520
3521
3522
3523
3524 func (c *ProjectsPoliciesGetCall) Fields(s ...googleapi.Field) *ProjectsPoliciesGetCall {
3525 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3526 return c
3527 }
3528
3529
3530
3531
3532 func (c *ProjectsPoliciesGetCall) IfNoneMatch(entityTag string) *ProjectsPoliciesGetCall {
3533 c.ifNoneMatch_ = entityTag
3534 return c
3535 }
3536
3537
3538 func (c *ProjectsPoliciesGetCall) Context(ctx context.Context) *ProjectsPoliciesGetCall {
3539 c.ctx_ = ctx
3540 return c
3541 }
3542
3543
3544
3545 func (c *ProjectsPoliciesGetCall) Header() http.Header {
3546 if c.header_ == nil {
3547 c.header_ = make(http.Header)
3548 }
3549 return c.header_
3550 }
3551
3552 func (c *ProjectsPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
3553 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3554 if c.ifNoneMatch_ != "" {
3555 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3556 }
3557 var body io.Reader = nil
3558 c.urlParams_.Set("alt", alt)
3559 c.urlParams_.Set("prettyPrint", "false")
3560 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3561 urls += "?" + c.urlParams_.Encode()
3562 req, err := http.NewRequest("GET", urls, body)
3563 if err != nil {
3564 return nil, err
3565 }
3566 req.Header = reqHeaders
3567 googleapi.Expand(req.URL, map[string]string{
3568 "name": c.name,
3569 })
3570 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3571 }
3572
3573
3574
3575
3576
3577
3578
3579 func (c *ProjectsPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3580 gensupport.SetOptions(c.urlParams_, opts...)
3581 res, err := c.doRequest("json")
3582 if res != nil && res.StatusCode == http.StatusNotModified {
3583 if res.Body != nil {
3584 res.Body.Close()
3585 }
3586 return nil, gensupport.WrapError(&googleapi.Error{
3587 Code: res.StatusCode,
3588 Header: res.Header,
3589 })
3590 }
3591 if err != nil {
3592 return nil, err
3593 }
3594 defer googleapi.CloseBody(res)
3595 if err := googleapi.CheckResponse(res); err != nil {
3596 return nil, gensupport.WrapError(err)
3597 }
3598 ret := &GoogleCloudOrgpolicyV2Policy{
3599 ServerResponse: googleapi.ServerResponse{
3600 Header: res.Header,
3601 HTTPStatusCode: res.StatusCode,
3602 },
3603 }
3604 target := &ret
3605 if err := gensupport.DecodeResponse(target, res); err != nil {
3606 return nil, err
3607 }
3608 return ret, nil
3609 }
3610
3611 type ProjectsPoliciesGetEffectivePolicyCall struct {
3612 s *Service
3613 name string
3614 urlParams_ gensupport.URLParams
3615 ifNoneMatch_ string
3616 ctx_ context.Context
3617 header_ http.Header
3618 }
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628 func (r *ProjectsPoliciesService) GetEffectivePolicy(name string) *ProjectsPoliciesGetEffectivePolicyCall {
3629 c := &ProjectsPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3630 c.name = name
3631 return c
3632 }
3633
3634
3635
3636
3637 func (c *ProjectsPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *ProjectsPoliciesGetEffectivePolicyCall {
3638 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3639 return c
3640 }
3641
3642
3643
3644
3645 func (c *ProjectsPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *ProjectsPoliciesGetEffectivePolicyCall {
3646 c.ifNoneMatch_ = entityTag
3647 return c
3648 }
3649
3650
3651 func (c *ProjectsPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *ProjectsPoliciesGetEffectivePolicyCall {
3652 c.ctx_ = ctx
3653 return c
3654 }
3655
3656
3657
3658 func (c *ProjectsPoliciesGetEffectivePolicyCall) Header() http.Header {
3659 if c.header_ == nil {
3660 c.header_ = make(http.Header)
3661 }
3662 return c.header_
3663 }
3664
3665 func (c *ProjectsPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
3666 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3667 if c.ifNoneMatch_ != "" {
3668 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3669 }
3670 var body io.Reader = nil
3671 c.urlParams_.Set("alt", alt)
3672 c.urlParams_.Set("prettyPrint", "false")
3673 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
3674 urls += "?" + c.urlParams_.Encode()
3675 req, err := http.NewRequest("GET", urls, body)
3676 if err != nil {
3677 return nil, err
3678 }
3679 req.Header = reqHeaders
3680 googleapi.Expand(req.URL, map[string]string{
3681 "name": c.name,
3682 })
3683 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3684 }
3685
3686
3687
3688
3689
3690
3691
3692 func (c *ProjectsPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3693 gensupport.SetOptions(c.urlParams_, opts...)
3694 res, err := c.doRequest("json")
3695 if res != nil && res.StatusCode == http.StatusNotModified {
3696 if res.Body != nil {
3697 res.Body.Close()
3698 }
3699 return nil, gensupport.WrapError(&googleapi.Error{
3700 Code: res.StatusCode,
3701 Header: res.Header,
3702 })
3703 }
3704 if err != nil {
3705 return nil, err
3706 }
3707 defer googleapi.CloseBody(res)
3708 if err := googleapi.CheckResponse(res); err != nil {
3709 return nil, gensupport.WrapError(err)
3710 }
3711 ret := &GoogleCloudOrgpolicyV2Policy{
3712 ServerResponse: googleapi.ServerResponse{
3713 Header: res.Header,
3714 HTTPStatusCode: res.StatusCode,
3715 },
3716 }
3717 target := &ret
3718 if err := gensupport.DecodeResponse(target, res); err != nil {
3719 return nil, err
3720 }
3721 return ret, nil
3722 }
3723
3724 type ProjectsPoliciesListCall struct {
3725 s *Service
3726 parent string
3727 urlParams_ gensupport.URLParams
3728 ifNoneMatch_ string
3729 ctx_ context.Context
3730 header_ http.Header
3731 }
3732
3733
3734
3735
3736
3737
3738
3739
3740 func (r *ProjectsPoliciesService) List(parent string) *ProjectsPoliciesListCall {
3741 c := &ProjectsPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3742 c.parent = parent
3743 return c
3744 }
3745
3746
3747
3748
3749 func (c *ProjectsPoliciesListCall) PageSize(pageSize int64) *ProjectsPoliciesListCall {
3750 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3751 return c
3752 }
3753
3754
3755
3756
3757 func (c *ProjectsPoliciesListCall) PageToken(pageToken string) *ProjectsPoliciesListCall {
3758 c.urlParams_.Set("pageToken", pageToken)
3759 return c
3760 }
3761
3762
3763
3764
3765 func (c *ProjectsPoliciesListCall) Fields(s ...googleapi.Field) *ProjectsPoliciesListCall {
3766 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3767 return c
3768 }
3769
3770
3771
3772
3773 func (c *ProjectsPoliciesListCall) IfNoneMatch(entityTag string) *ProjectsPoliciesListCall {
3774 c.ifNoneMatch_ = entityTag
3775 return c
3776 }
3777
3778
3779 func (c *ProjectsPoliciesListCall) Context(ctx context.Context) *ProjectsPoliciesListCall {
3780 c.ctx_ = ctx
3781 return c
3782 }
3783
3784
3785
3786 func (c *ProjectsPoliciesListCall) Header() http.Header {
3787 if c.header_ == nil {
3788 c.header_ = make(http.Header)
3789 }
3790 return c.header_
3791 }
3792
3793 func (c *ProjectsPoliciesListCall) doRequest(alt string) (*http.Response, error) {
3794 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3795 if c.ifNoneMatch_ != "" {
3796 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3797 }
3798 var body io.Reader = nil
3799 c.urlParams_.Set("alt", alt)
3800 c.urlParams_.Set("prettyPrint", "false")
3801 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
3802 urls += "?" + c.urlParams_.Encode()
3803 req, err := http.NewRequest("GET", urls, body)
3804 if err != nil {
3805 return nil, err
3806 }
3807 req.Header = reqHeaders
3808 googleapi.Expand(req.URL, map[string]string{
3809 "parent": c.parent,
3810 })
3811 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3812 }
3813
3814
3815
3816
3817
3818
3819
3820 func (c *ProjectsPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
3821 gensupport.SetOptions(c.urlParams_, opts...)
3822 res, err := c.doRequest("json")
3823 if res != nil && res.StatusCode == http.StatusNotModified {
3824 if res.Body != nil {
3825 res.Body.Close()
3826 }
3827 return nil, gensupport.WrapError(&googleapi.Error{
3828 Code: res.StatusCode,
3829 Header: res.Header,
3830 })
3831 }
3832 if err != nil {
3833 return nil, err
3834 }
3835 defer googleapi.CloseBody(res)
3836 if err := googleapi.CheckResponse(res); err != nil {
3837 return nil, gensupport.WrapError(err)
3838 }
3839 ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
3840 ServerResponse: googleapi.ServerResponse{
3841 Header: res.Header,
3842 HTTPStatusCode: res.StatusCode,
3843 },
3844 }
3845 target := &ret
3846 if err := gensupport.DecodeResponse(target, res); err != nil {
3847 return nil, err
3848 }
3849 return ret, nil
3850 }
3851
3852
3853
3854
3855 func (c *ProjectsPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
3856 c.ctx_ = ctx
3857 defer c.PageToken(c.urlParams_.Get("pageToken"))
3858 for {
3859 x, err := c.Do()
3860 if err != nil {
3861 return err
3862 }
3863 if err := f(x); err != nil {
3864 return err
3865 }
3866 if x.NextPageToken == "" {
3867 return nil
3868 }
3869 c.PageToken(x.NextPageToken)
3870 }
3871 }
3872
3873 type ProjectsPoliciesPatchCall struct {
3874 s *Service
3875 name string
3876 googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
3877 urlParams_ gensupport.URLParams
3878 ctx_ context.Context
3879 header_ http.Header
3880 }
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898 func (r *ProjectsPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *ProjectsPoliciesPatchCall {
3899 c := &ProjectsPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3900 c.name = name
3901 c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
3902 return c
3903 }
3904
3905
3906
3907
3908
3909 func (c *ProjectsPoliciesPatchCall) UpdateMask(updateMask string) *ProjectsPoliciesPatchCall {
3910 c.urlParams_.Set("updateMask", updateMask)
3911 return c
3912 }
3913
3914
3915
3916
3917 func (c *ProjectsPoliciesPatchCall) Fields(s ...googleapi.Field) *ProjectsPoliciesPatchCall {
3918 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3919 return c
3920 }
3921
3922
3923 func (c *ProjectsPoliciesPatchCall) Context(ctx context.Context) *ProjectsPoliciesPatchCall {
3924 c.ctx_ = ctx
3925 return c
3926 }
3927
3928
3929
3930 func (c *ProjectsPoliciesPatchCall) Header() http.Header {
3931 if c.header_ == nil {
3932 c.header_ = make(http.Header)
3933 }
3934 return c.header_
3935 }
3936
3937 func (c *ProjectsPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
3938 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3939 var body io.Reader = nil
3940 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
3941 if err != nil {
3942 return nil, err
3943 }
3944 c.urlParams_.Set("alt", alt)
3945 c.urlParams_.Set("prettyPrint", "false")
3946 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3947 urls += "?" + c.urlParams_.Encode()
3948 req, err := http.NewRequest("PATCH", urls, body)
3949 if err != nil {
3950 return nil, err
3951 }
3952 req.Header = reqHeaders
3953 googleapi.Expand(req.URL, map[string]string{
3954 "name": c.name,
3955 })
3956 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3957 }
3958
3959
3960
3961
3962
3963
3964
3965 func (c *ProjectsPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3966 gensupport.SetOptions(c.urlParams_, opts...)
3967 res, err := c.doRequest("json")
3968 if res != nil && res.StatusCode == http.StatusNotModified {
3969 if res.Body != nil {
3970 res.Body.Close()
3971 }
3972 return nil, gensupport.WrapError(&googleapi.Error{
3973 Code: res.StatusCode,
3974 Header: res.Header,
3975 })
3976 }
3977 if err != nil {
3978 return nil, err
3979 }
3980 defer googleapi.CloseBody(res)
3981 if err := googleapi.CheckResponse(res); err != nil {
3982 return nil, gensupport.WrapError(err)
3983 }
3984 ret := &GoogleCloudOrgpolicyV2Policy{
3985 ServerResponse: googleapi.ServerResponse{
3986 Header: res.Header,
3987 HTTPStatusCode: res.StatusCode,
3988 },
3989 }
3990 target := &ret
3991 if err := gensupport.DecodeResponse(target, res); err != nil {
3992 return nil, err
3993 }
3994 return ret, nil
3995 }
3996
View as plain text