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