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.
736//
737// - parent: The Cloud resource that parents the constraint. Must be in
738//   one of the following forms: * `projects/{project_number}` *
739//   `projects/{project_id}` * `folders/{folder_id}` *
740//   `organizations/{organization_id}`.
741func (r *FoldersConstraintsService) List(parent string) *FoldersConstraintsListCall {
742	c := &FoldersConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
743	c.parent = parent
744	return c
745}
746
747// PageSize sets the optional parameter "pageSize": Size of the pages to
748// be returned. This is currently unsupported and will be ignored. The
749// server may at any point start using this field to limit page size.
750func (c *FoldersConstraintsListCall) PageSize(pageSize int64) *FoldersConstraintsListCall {
751	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
752	return c
753}
754
755// PageToken sets the optional parameter "pageToken": Page token used to
756// retrieve the next page. This is currently unsupported and will be
757// ignored. The server may at any point start using this field.
758func (c *FoldersConstraintsListCall) PageToken(pageToken string) *FoldersConstraintsListCall {
759	c.urlParams_.Set("pageToken", pageToken)
760	return c
761}
762
763// Fields allows partial responses to be retrieved. See
764// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
765// for more information.
766func (c *FoldersConstraintsListCall) Fields(s ...googleapi.Field) *FoldersConstraintsListCall {
767	c.urlParams_.Set("fields", googleapi.CombineFields(s))
768	return c
769}
770
771// IfNoneMatch sets the optional parameter which makes the operation
772// fail if the object's ETag matches the given value. This is useful for
773// getting updates only after the object has changed since the last
774// request. Use googleapi.IsNotModified to check whether the response
775// error from Do is the result of In-None-Match.
776func (c *FoldersConstraintsListCall) IfNoneMatch(entityTag string) *FoldersConstraintsListCall {
777	c.ifNoneMatch_ = entityTag
778	return c
779}
780
781// Context sets the context to be used in this call's Do method. Any
782// pending HTTP request will be aborted if the provided context is
783// canceled.
784func (c *FoldersConstraintsListCall) Context(ctx context.Context) *FoldersConstraintsListCall {
785	c.ctx_ = ctx
786	return c
787}
788
789// Header returns an http.Header that can be modified by the caller to
790// add HTTP headers to the request.
791func (c *FoldersConstraintsListCall) Header() http.Header {
792	if c.header_ == nil {
793		c.header_ = make(http.Header)
794	}
795	return c.header_
796}
797
798func (c *FoldersConstraintsListCall) doRequest(alt string) (*http.Response, error) {
799	reqHeaders := make(http.Header)
800	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
801	for k, v := range c.header_ {
802		reqHeaders[k] = v
803	}
804	reqHeaders.Set("User-Agent", c.s.userAgent())
805	if c.ifNoneMatch_ != "" {
806		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
807	}
808	var body io.Reader = nil
809	c.urlParams_.Set("alt", alt)
810	c.urlParams_.Set("prettyPrint", "false")
811	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
812	urls += "?" + c.urlParams_.Encode()
813	req, err := http.NewRequest("GET", urls, body)
814	if err != nil {
815		return nil, err
816	}
817	req.Header = reqHeaders
818	googleapi.Expand(req.URL, map[string]string{
819		"parent": c.parent,
820	})
821	return gensupport.SendRequest(c.ctx_, c.s.client, req)
822}
823
824// Do executes the "orgpolicy.folders.constraints.list" call.
825// Exactly one of *GoogleCloudOrgpolicyV2ListConstraintsResponse or
826// error will be non-nil. Any non-2xx status code is an error. Response
827// headers are in either
828// *GoogleCloudOrgpolicyV2ListConstraintsResponse.ServerResponse.Header
829// or (if a response was returned at all) in
830// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
831// whether the returned error was because http.StatusNotModified was
832// returned.
833func (c *FoldersConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
834	gensupport.SetOptions(c.urlParams_, opts...)
835	res, err := c.doRequest("json")
836	if res != nil && res.StatusCode == http.StatusNotModified {
837		if res.Body != nil {
838			res.Body.Close()
839		}
840		return nil, &googleapi.Error{
841			Code:   res.StatusCode,
842			Header: res.Header,
843		}
844	}
845	if err != nil {
846		return nil, err
847	}
848	defer googleapi.CloseBody(res)
849	if err := googleapi.CheckResponse(res); err != nil {
850		return nil, err
851	}
852	ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
853		ServerResponse: googleapi.ServerResponse{
854			Header:         res.Header,
855			HTTPStatusCode: res.StatusCode,
856		},
857	}
858	target := &ret
859	if err := gensupport.DecodeResponse(target, res); err != nil {
860		return nil, err
861	}
862	return ret, nil
863	// {
864	//   "description": "Lists `Constraints` that could be applied on the specified resource.",
865	//   "flatPath": "v2/folders/{foldersId}/constraints",
866	//   "httpMethod": "GET",
867	//   "id": "orgpolicy.folders.constraints.list",
868	//   "parameterOrder": [
869	//     "parent"
870	//   ],
871	//   "parameters": {
872	//     "pageSize": {
873	//       "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.",
874	//       "format": "int32",
875	//       "location": "query",
876	//       "type": "integer"
877	//     },
878	//     "pageToken": {
879	//       "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.",
880	//       "location": "query",
881	//       "type": "string"
882	//     },
883	//     "parent": {
884	//       "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}`",
885	//       "location": "path",
886	//       "pattern": "^folders/[^/]+$",
887	//       "required": true,
888	//       "type": "string"
889	//     }
890	//   },
891	//   "path": "v2/{+parent}/constraints",
892	//   "response": {
893	//     "$ref": "GoogleCloudOrgpolicyV2ListConstraintsResponse"
894	//   },
895	//   "scopes": [
896	//     "https://www.googleapis.com/auth/cloud-platform"
897	//   ]
898	// }
899
900}
901
902// Pages invokes f for each page of results.
903// A non-nil error returned from f will halt the iteration.
904// The provided context supersedes any context provided to the Context method.
905func (c *FoldersConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
906	c.ctx_ = ctx
907	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
908	for {
909		x, err := c.Do()
910		if err != nil {
911			return err
912		}
913		if err := f(x); err != nil {
914			return err
915		}
916		if x.NextPageToken == "" {
917			return nil
918		}
919		c.PageToken(x.NextPageToken)
920	}
921}
922
923// method id "orgpolicy.folders.policies.create":
924
925type FoldersPoliciesCreateCall struct {
926	s                            *Service
927	parent                       string
928	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
929	urlParams_                   gensupport.URLParams
930	ctx_                         context.Context
931	header_                      http.Header
932}
933
934// Create: Creates a Policy. Returns a `google.rpc.Status` with
935// `google.rpc.Code.NOT_FOUND` if the constraint does not exist. Returns
936// a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the
937// policy already exists on the given Cloud resource.
938//
939// - parent: The Cloud resource that will parent the new Policy. Must be
940//   in one of the following forms: * `projects/{project_number}` *
941//   `projects/{project_id}` * `folders/{folder_id}` *
942//   `organizations/{organization_id}`.
943func (r *FoldersPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *FoldersPoliciesCreateCall {
944	c := &FoldersPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
945	c.parent = parent
946	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
947	return c
948}
949
950// Fields allows partial responses to be retrieved. See
951// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
952// for more information.
953func (c *FoldersPoliciesCreateCall) Fields(s ...googleapi.Field) *FoldersPoliciesCreateCall {
954	c.urlParams_.Set("fields", googleapi.CombineFields(s))
955	return c
956}
957
958// Context sets the context to be used in this call's Do method. Any
959// pending HTTP request will be aborted if the provided context is
960// canceled.
961func (c *FoldersPoliciesCreateCall) Context(ctx context.Context) *FoldersPoliciesCreateCall {
962	c.ctx_ = ctx
963	return c
964}
965
966// Header returns an http.Header that can be modified by the caller to
967// add HTTP headers to the request.
968func (c *FoldersPoliciesCreateCall) Header() http.Header {
969	if c.header_ == nil {
970		c.header_ = make(http.Header)
971	}
972	return c.header_
973}
974
975func (c *FoldersPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
976	reqHeaders := make(http.Header)
977	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
978	for k, v := range c.header_ {
979		reqHeaders[k] = v
980	}
981	reqHeaders.Set("User-Agent", c.s.userAgent())
982	var body io.Reader = nil
983	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
984	if err != nil {
985		return nil, err
986	}
987	reqHeaders.Set("Content-Type", "application/json")
988	c.urlParams_.Set("alt", alt)
989	c.urlParams_.Set("prettyPrint", "false")
990	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
991	urls += "?" + c.urlParams_.Encode()
992	req, err := http.NewRequest("POST", urls, body)
993	if err != nil {
994		return nil, err
995	}
996	req.Header = reqHeaders
997	googleapi.Expand(req.URL, map[string]string{
998		"parent": c.parent,
999	})
1000	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1001}
1002
1003// Do executes the "orgpolicy.folders.policies.create" call.
1004// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
1005// non-nil. Any non-2xx status code is an error. Response headers are in
1006// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
1007// response was returned at all) in error.(*googleapi.Error).Header. Use
1008// googleapi.IsNotModified to check whether the returned error was
1009// because http.StatusNotModified was returned.
1010func (c *FoldersPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1011	gensupport.SetOptions(c.urlParams_, opts...)
1012	res, err := c.doRequest("json")
1013	if res != nil && res.StatusCode == http.StatusNotModified {
1014		if res.Body != nil {
1015			res.Body.Close()
1016		}
1017		return nil, &googleapi.Error{
1018			Code:   res.StatusCode,
1019			Header: res.Header,
1020		}
1021	}
1022	if err != nil {
1023		return nil, err
1024	}
1025	defer googleapi.CloseBody(res)
1026	if err := googleapi.CheckResponse(res); err != nil {
1027		return nil, err
1028	}
1029	ret := &GoogleCloudOrgpolicyV2Policy{
1030		ServerResponse: googleapi.ServerResponse{
1031			Header:         res.Header,
1032			HTTPStatusCode: res.StatusCode,
1033		},
1034	}
1035	target := &ret
1036	if err := gensupport.DecodeResponse(target, res); err != nil {
1037		return nil, err
1038	}
1039	return ret, nil
1040	// {
1041	//   "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.",
1042	//   "flatPath": "v2/folders/{foldersId}/policies",
1043	//   "httpMethod": "POST",
1044	//   "id": "orgpolicy.folders.policies.create",
1045	//   "parameterOrder": [
1046	//     "parent"
1047	//   ],
1048	//   "parameters": {
1049	//     "parent": {
1050	//       "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}`",
1051	//       "location": "path",
1052	//       "pattern": "^folders/[^/]+$",
1053	//       "required": true,
1054	//       "type": "string"
1055	//     }
1056	//   },
1057	//   "path": "v2/{+parent}/policies",
1058	//   "request": {
1059	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1060	//   },
1061	//   "response": {
1062	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1063	//   },
1064	//   "scopes": [
1065	//     "https://www.googleapis.com/auth/cloud-platform"
1066	//   ]
1067	// }
1068
1069}
1070
1071// method id "orgpolicy.folders.policies.delete":
1072
1073type FoldersPoliciesDeleteCall struct {
1074	s          *Service
1075	name       string
1076	urlParams_ gensupport.URLParams
1077	ctx_       context.Context
1078	header_    http.Header
1079}
1080
1081// Delete: Deletes a Policy. Returns a `google.rpc.Status` with
1082// `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not
1083// exist.
1084//
1085// - name: Name of the policy to delete. See `Policy` for naming rules.
1086func (r *FoldersPoliciesService) Delete(name string) *FoldersPoliciesDeleteCall {
1087	c := &FoldersPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1088	c.name = name
1089	return c
1090}
1091
1092// Fields allows partial responses to be retrieved. See
1093// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1094// for more information.
1095func (c *FoldersPoliciesDeleteCall) Fields(s ...googleapi.Field) *FoldersPoliciesDeleteCall {
1096	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1097	return c
1098}
1099
1100// Context sets the context to be used in this call's Do method. Any
1101// pending HTTP request will be aborted if the provided context is
1102// canceled.
1103func (c *FoldersPoliciesDeleteCall) Context(ctx context.Context) *FoldersPoliciesDeleteCall {
1104	c.ctx_ = ctx
1105	return c
1106}
1107
1108// Header returns an http.Header that can be modified by the caller to
1109// add HTTP headers to the request.
1110func (c *FoldersPoliciesDeleteCall) Header() http.Header {
1111	if c.header_ == nil {
1112		c.header_ = make(http.Header)
1113	}
1114	return c.header_
1115}
1116
1117func (c *FoldersPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
1118	reqHeaders := make(http.Header)
1119	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1120	for k, v := range c.header_ {
1121		reqHeaders[k] = v
1122	}
1123	reqHeaders.Set("User-Agent", c.s.userAgent())
1124	var body io.Reader = nil
1125	c.urlParams_.Set("alt", alt)
1126	c.urlParams_.Set("prettyPrint", "false")
1127	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1128	urls += "?" + c.urlParams_.Encode()
1129	req, err := http.NewRequest("DELETE", urls, body)
1130	if err != nil {
1131		return nil, err
1132	}
1133	req.Header = reqHeaders
1134	googleapi.Expand(req.URL, map[string]string{
1135		"name": c.name,
1136	})
1137	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1138}
1139
1140// Do executes the "orgpolicy.folders.policies.delete" call.
1141// Exactly one of *GoogleProtobufEmpty or error will be non-nil. Any
1142// non-2xx status code is an error. Response headers are in either
1143// *GoogleProtobufEmpty.ServerResponse.Header or (if a response was
1144// returned at all) in error.(*googleapi.Error).Header. Use
1145// googleapi.IsNotModified to check whether the returned error was
1146// because http.StatusNotModified was returned.
1147func (c *FoldersPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
1148	gensupport.SetOptions(c.urlParams_, opts...)
1149	res, err := c.doRequest("json")
1150	if res != nil && res.StatusCode == http.StatusNotModified {
1151		if res.Body != nil {
1152			res.Body.Close()
1153		}
1154		return nil, &googleapi.Error{
1155			Code:   res.StatusCode,
1156			Header: res.Header,
1157		}
1158	}
1159	if err != nil {
1160		return nil, err
1161	}
1162	defer googleapi.CloseBody(res)
1163	if err := googleapi.CheckResponse(res); err != nil {
1164		return nil, err
1165	}
1166	ret := &GoogleProtobufEmpty{
1167		ServerResponse: googleapi.ServerResponse{
1168			Header:         res.Header,
1169			HTTPStatusCode: res.StatusCode,
1170		},
1171	}
1172	target := &ret
1173	if err := gensupport.DecodeResponse(target, res); err != nil {
1174		return nil, err
1175	}
1176	return ret, nil
1177	// {
1178	//   "description": "Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not exist.",
1179	//   "flatPath": "v2/folders/{foldersId}/policies/{policiesId}",
1180	//   "httpMethod": "DELETE",
1181	//   "id": "orgpolicy.folders.policies.delete",
1182	//   "parameterOrder": [
1183	//     "name"
1184	//   ],
1185	//   "parameters": {
1186	//     "name": {
1187	//       "description": "Required. Name of the policy to delete. See `Policy` for naming rules.",
1188	//       "location": "path",
1189	//       "pattern": "^folders/[^/]+/policies/[^/]+$",
1190	//       "required": true,
1191	//       "type": "string"
1192	//     }
1193	//   },
1194	//   "path": "v2/{+name}",
1195	//   "response": {
1196	//     "$ref": "GoogleProtobufEmpty"
1197	//   },
1198	//   "scopes": [
1199	//     "https://www.googleapis.com/auth/cloud-platform"
1200	//   ]
1201	// }
1202
1203}
1204
1205// method id "orgpolicy.folders.policies.get":
1206
1207type FoldersPoliciesGetCall struct {
1208	s            *Service
1209	name         string
1210	urlParams_   gensupport.URLParams
1211	ifNoneMatch_ string
1212	ctx_         context.Context
1213	header_      http.Header
1214}
1215
1216// Get: Gets a `Policy` on a resource. If no `Policy` is set on the
1217// resource, NOT_FOUND is returned. The `etag` value can be used with
1218// `UpdatePolicy()` to update a `Policy` during read-modify-write.
1219//
1220// - name: Resource name of the policy. See `Policy` for naming
1221//   requirements.
1222func (r *FoldersPoliciesService) Get(name string) *FoldersPoliciesGetCall {
1223	c := &FoldersPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1224	c.name = name
1225	return c
1226}
1227
1228// Fields allows partial responses to be retrieved. See
1229// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1230// for more information.
1231func (c *FoldersPoliciesGetCall) Fields(s ...googleapi.Field) *FoldersPoliciesGetCall {
1232	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1233	return c
1234}
1235
1236// IfNoneMatch sets the optional parameter which makes the operation
1237// fail if the object's ETag matches the given value. This is useful for
1238// getting updates only after the object has changed since the last
1239// request. Use googleapi.IsNotModified to check whether the response
1240// error from Do is the result of In-None-Match.
1241func (c *FoldersPoliciesGetCall) IfNoneMatch(entityTag string) *FoldersPoliciesGetCall {
1242	c.ifNoneMatch_ = entityTag
1243	return c
1244}
1245
1246// Context sets the context to be used in this call's Do method. Any
1247// pending HTTP request will be aborted if the provided context is
1248// canceled.
1249func (c *FoldersPoliciesGetCall) Context(ctx context.Context) *FoldersPoliciesGetCall {
1250	c.ctx_ = ctx
1251	return c
1252}
1253
1254// Header returns an http.Header that can be modified by the caller to
1255// add HTTP headers to the request.
1256func (c *FoldersPoliciesGetCall) Header() http.Header {
1257	if c.header_ == nil {
1258		c.header_ = make(http.Header)
1259	}
1260	return c.header_
1261}
1262
1263func (c *FoldersPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
1264	reqHeaders := make(http.Header)
1265	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1266	for k, v := range c.header_ {
1267		reqHeaders[k] = v
1268	}
1269	reqHeaders.Set("User-Agent", c.s.userAgent())
1270	if c.ifNoneMatch_ != "" {
1271		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1272	}
1273	var body io.Reader = nil
1274	c.urlParams_.Set("alt", alt)
1275	c.urlParams_.Set("prettyPrint", "false")
1276	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1277	urls += "?" + c.urlParams_.Encode()
1278	req, err := http.NewRequest("GET", urls, body)
1279	if err != nil {
1280		return nil, err
1281	}
1282	req.Header = reqHeaders
1283	googleapi.Expand(req.URL, map[string]string{
1284		"name": c.name,
1285	})
1286	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1287}
1288
1289// Do executes the "orgpolicy.folders.policies.get" call.
1290// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
1291// non-nil. Any non-2xx status code is an error. Response headers are in
1292// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
1293// response was returned at all) in error.(*googleapi.Error).Header. Use
1294// googleapi.IsNotModified to check whether the returned error was
1295// because http.StatusNotModified was returned.
1296func (c *FoldersPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1297	gensupport.SetOptions(c.urlParams_, opts...)
1298	res, err := c.doRequest("json")
1299	if res != nil && res.StatusCode == http.StatusNotModified {
1300		if res.Body != nil {
1301			res.Body.Close()
1302		}
1303		return nil, &googleapi.Error{
1304			Code:   res.StatusCode,
1305			Header: res.Header,
1306		}
1307	}
1308	if err != nil {
1309		return nil, err
1310	}
1311	defer googleapi.CloseBody(res)
1312	if err := googleapi.CheckResponse(res); err != nil {
1313		return nil, err
1314	}
1315	ret := &GoogleCloudOrgpolicyV2Policy{
1316		ServerResponse: googleapi.ServerResponse{
1317			Header:         res.Header,
1318			HTTPStatusCode: res.StatusCode,
1319		},
1320	}
1321	target := &ret
1322	if err := gensupport.DecodeResponse(target, res); err != nil {
1323		return nil, err
1324	}
1325	return ret, nil
1326	// {
1327	//   "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.",
1328	//   "flatPath": "v2/folders/{foldersId}/policies/{policiesId}",
1329	//   "httpMethod": "GET",
1330	//   "id": "orgpolicy.folders.policies.get",
1331	//   "parameterOrder": [
1332	//     "name"
1333	//   ],
1334	//   "parameters": {
1335	//     "name": {
1336	//       "description": "Required. Resource name of the policy. See `Policy` for naming requirements.",
1337	//       "location": "path",
1338	//       "pattern": "^folders/[^/]+/policies/[^/]+$",
1339	//       "required": true,
1340	//       "type": "string"
1341	//     }
1342	//   },
1343	//   "path": "v2/{+name}",
1344	//   "response": {
1345	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1346	//   },
1347	//   "scopes": [
1348	//     "https://www.googleapis.com/auth/cloud-platform"
1349	//   ]
1350	// }
1351
1352}
1353
1354// method id "orgpolicy.folders.policies.getEffectivePolicy":
1355
1356type FoldersPoliciesGetEffectivePolicyCall struct {
1357	s            *Service
1358	name         string
1359	urlParams_   gensupport.URLParams
1360	ifNoneMatch_ string
1361	ctx_         context.Context
1362	header_      http.Header
1363}
1364
1365// GetEffectivePolicy: Gets the effective `Policy` on a resource. This
1366// is the result of merging `Policies` in the resource hierarchy and
1367// evaluating conditions. The returned `Policy` will not have an `etag`
1368// or `condition` set because it is a computed `Policy` across multiple
1369// resources. Subtrees of Resource Manager resource hierarchy with
1370// 'under:' prefix will not be expanded.
1371//
1372// - name: The effective policy to compute. See `Policy` for naming
1373//   rules.
1374func (r *FoldersPoliciesService) GetEffectivePolicy(name string) *FoldersPoliciesGetEffectivePolicyCall {
1375	c := &FoldersPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1376	c.name = name
1377	return c
1378}
1379
1380// Fields allows partial responses to be retrieved. See
1381// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1382// for more information.
1383func (c *FoldersPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *FoldersPoliciesGetEffectivePolicyCall {
1384	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1385	return c
1386}
1387
1388// IfNoneMatch sets the optional parameter which makes the operation
1389// fail if the object's ETag matches the given value. This is useful for
1390// getting updates only after the object has changed since the last
1391// request. Use googleapi.IsNotModified to check whether the response
1392// error from Do is the result of In-None-Match.
1393func (c *FoldersPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *FoldersPoliciesGetEffectivePolicyCall {
1394	c.ifNoneMatch_ = entityTag
1395	return c
1396}
1397
1398// Context sets the context to be used in this call's Do method. Any
1399// pending HTTP request will be aborted if the provided context is
1400// canceled.
1401func (c *FoldersPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *FoldersPoliciesGetEffectivePolicyCall {
1402	c.ctx_ = ctx
1403	return c
1404}
1405
1406// Header returns an http.Header that can be modified by the caller to
1407// add HTTP headers to the request.
1408func (c *FoldersPoliciesGetEffectivePolicyCall) Header() http.Header {
1409	if c.header_ == nil {
1410		c.header_ = make(http.Header)
1411	}
1412	return c.header_
1413}
1414
1415func (c *FoldersPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
1416	reqHeaders := make(http.Header)
1417	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1418	for k, v := range c.header_ {
1419		reqHeaders[k] = v
1420	}
1421	reqHeaders.Set("User-Agent", c.s.userAgent())
1422	if c.ifNoneMatch_ != "" {
1423		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1424	}
1425	var body io.Reader = nil
1426	c.urlParams_.Set("alt", alt)
1427	c.urlParams_.Set("prettyPrint", "false")
1428	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
1429	urls += "?" + c.urlParams_.Encode()
1430	req, err := http.NewRequest("GET", urls, body)
1431	if err != nil {
1432		return nil, err
1433	}
1434	req.Header = reqHeaders
1435	googleapi.Expand(req.URL, map[string]string{
1436		"name": c.name,
1437	})
1438	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1439}
1440
1441// Do executes the "orgpolicy.folders.policies.getEffectivePolicy" call.
1442// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
1443// non-nil. Any non-2xx status code is an error. Response headers are in
1444// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
1445// response was returned at all) in error.(*googleapi.Error).Header. Use
1446// googleapi.IsNotModified to check whether the returned error was
1447// because http.StatusNotModified was returned.
1448func (c *FoldersPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1449	gensupport.SetOptions(c.urlParams_, opts...)
1450	res, err := c.doRequest("json")
1451	if res != nil && res.StatusCode == http.StatusNotModified {
1452		if res.Body != nil {
1453			res.Body.Close()
1454		}
1455		return nil, &googleapi.Error{
1456			Code:   res.StatusCode,
1457			Header: res.Header,
1458		}
1459	}
1460	if err != nil {
1461		return nil, err
1462	}
1463	defer googleapi.CloseBody(res)
1464	if err := googleapi.CheckResponse(res); err != nil {
1465		return nil, err
1466	}
1467	ret := &GoogleCloudOrgpolicyV2Policy{
1468		ServerResponse: googleapi.ServerResponse{
1469			Header:         res.Header,
1470			HTTPStatusCode: res.StatusCode,
1471		},
1472	}
1473	target := &ret
1474	if err := gensupport.DecodeResponse(target, res); err != nil {
1475		return nil, err
1476	}
1477	return ret, nil
1478	// {
1479	//   "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.",
1480	//   "flatPath": "v2/folders/{foldersId}/policies/{policiesId}:getEffectivePolicy",
1481	//   "httpMethod": "GET",
1482	//   "id": "orgpolicy.folders.policies.getEffectivePolicy",
1483	//   "parameterOrder": [
1484	//     "name"
1485	//   ],
1486	//   "parameters": {
1487	//     "name": {
1488	//       "description": "Required. The effective policy to compute. See `Policy` for naming rules.",
1489	//       "location": "path",
1490	//       "pattern": "^folders/[^/]+/policies/[^/]+$",
1491	//       "required": true,
1492	//       "type": "string"
1493	//     }
1494	//   },
1495	//   "path": "v2/{+name}:getEffectivePolicy",
1496	//   "response": {
1497	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1498	//   },
1499	//   "scopes": [
1500	//     "https://www.googleapis.com/auth/cloud-platform"
1501	//   ]
1502	// }
1503
1504}
1505
1506// method id "orgpolicy.folders.policies.list":
1507
1508type FoldersPoliciesListCall struct {
1509	s            *Service
1510	parent       string
1511	urlParams_   gensupport.URLParams
1512	ifNoneMatch_ string
1513	ctx_         context.Context
1514	header_      http.Header
1515}
1516
1517// List: Retrieves all of the `Policies` that exist on a particular
1518// resource.
1519//
1520// - parent: The target Cloud resource that parents the set of
1521//   constraints and policies that will be returned from this call. Must
1522//   be in one of the following forms: * `projects/{project_number}` *
1523//   `projects/{project_id}` * `folders/{folder_id}` *
1524//   `organizations/{organization_id}`.
1525func (r *FoldersPoliciesService) List(parent string) *FoldersPoliciesListCall {
1526	c := &FoldersPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1527	c.parent = parent
1528	return c
1529}
1530
1531// PageSize sets the optional parameter "pageSize": Size of the pages to
1532// be returned. This is currently unsupported and will be ignored. The
1533// server may at any point start using this field to limit page size.
1534func (c *FoldersPoliciesListCall) PageSize(pageSize int64) *FoldersPoliciesListCall {
1535	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1536	return c
1537}
1538
1539// PageToken sets the optional parameter "pageToken": Page token used to
1540// retrieve the next page. This is currently unsupported and will be
1541// ignored. The server may at any point start using this field.
1542func (c *FoldersPoliciesListCall) PageToken(pageToken string) *FoldersPoliciesListCall {
1543	c.urlParams_.Set("pageToken", pageToken)
1544	return c
1545}
1546
1547// Fields allows partial responses to be retrieved. See
1548// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1549// for more information.
1550func (c *FoldersPoliciesListCall) Fields(s ...googleapi.Field) *FoldersPoliciesListCall {
1551	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1552	return c
1553}
1554
1555// IfNoneMatch sets the optional parameter which makes the operation
1556// fail if the object's ETag matches the given value. This is useful for
1557// getting updates only after the object has changed since the last
1558// request. Use googleapi.IsNotModified to check whether the response
1559// error from Do is the result of In-None-Match.
1560func (c *FoldersPoliciesListCall) IfNoneMatch(entityTag string) *FoldersPoliciesListCall {
1561	c.ifNoneMatch_ = entityTag
1562	return c
1563}
1564
1565// Context sets the context to be used in this call's Do method. Any
1566// pending HTTP request will be aborted if the provided context is
1567// canceled.
1568func (c *FoldersPoliciesListCall) Context(ctx context.Context) *FoldersPoliciesListCall {
1569	c.ctx_ = ctx
1570	return c
1571}
1572
1573// Header returns an http.Header that can be modified by the caller to
1574// add HTTP headers to the request.
1575func (c *FoldersPoliciesListCall) Header() http.Header {
1576	if c.header_ == nil {
1577		c.header_ = make(http.Header)
1578	}
1579	return c.header_
1580}
1581
1582func (c *FoldersPoliciesListCall) doRequest(alt string) (*http.Response, error) {
1583	reqHeaders := make(http.Header)
1584	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1585	for k, v := range c.header_ {
1586		reqHeaders[k] = v
1587	}
1588	reqHeaders.Set("User-Agent", c.s.userAgent())
1589	if c.ifNoneMatch_ != "" {
1590		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1591	}
1592	var body io.Reader = nil
1593	c.urlParams_.Set("alt", alt)
1594	c.urlParams_.Set("prettyPrint", "false")
1595	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
1596	urls += "?" + c.urlParams_.Encode()
1597	req, err := http.NewRequest("GET", urls, body)
1598	if err != nil {
1599		return nil, err
1600	}
1601	req.Header = reqHeaders
1602	googleapi.Expand(req.URL, map[string]string{
1603		"parent": c.parent,
1604	})
1605	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1606}
1607
1608// Do executes the "orgpolicy.folders.policies.list" call.
1609// Exactly one of *GoogleCloudOrgpolicyV2ListPoliciesResponse or error
1610// will be non-nil. Any non-2xx status code is an error. Response
1611// headers are in either
1612// *GoogleCloudOrgpolicyV2ListPoliciesResponse.ServerResponse.Header or
1613// (if a response was returned at all) in
1614// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1615// whether the returned error was because http.StatusNotModified was
1616// returned.
1617func (c *FoldersPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
1618	gensupport.SetOptions(c.urlParams_, opts...)
1619	res, err := c.doRequest("json")
1620	if res != nil && res.StatusCode == http.StatusNotModified {
1621		if res.Body != nil {
1622			res.Body.Close()
1623		}
1624		return nil, &googleapi.Error{
1625			Code:   res.StatusCode,
1626			Header: res.Header,
1627		}
1628	}
1629	if err != nil {
1630		return nil, err
1631	}
1632	defer googleapi.CloseBody(res)
1633	if err := googleapi.CheckResponse(res); err != nil {
1634		return nil, err
1635	}
1636	ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
1637		ServerResponse: googleapi.ServerResponse{
1638			Header:         res.Header,
1639			HTTPStatusCode: res.StatusCode,
1640		},
1641	}
1642	target := &ret
1643	if err := gensupport.DecodeResponse(target, res); err != nil {
1644		return nil, err
1645	}
1646	return ret, nil
1647	// {
1648	//   "description": "Retrieves all of the `Policies` that exist on a particular resource.",
1649	//   "flatPath": "v2/folders/{foldersId}/policies",
1650	//   "httpMethod": "GET",
1651	//   "id": "orgpolicy.folders.policies.list",
1652	//   "parameterOrder": [
1653	//     "parent"
1654	//   ],
1655	//   "parameters": {
1656	//     "pageSize": {
1657	//       "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.",
1658	//       "format": "int32",
1659	//       "location": "query",
1660	//       "type": "integer"
1661	//     },
1662	//     "pageToken": {
1663	//       "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.",
1664	//       "location": "query",
1665	//       "type": "string"
1666	//     },
1667	//     "parent": {
1668	//       "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}`",
1669	//       "location": "path",
1670	//       "pattern": "^folders/[^/]+$",
1671	//       "required": true,
1672	//       "type": "string"
1673	//     }
1674	//   },
1675	//   "path": "v2/{+parent}/policies",
1676	//   "response": {
1677	//     "$ref": "GoogleCloudOrgpolicyV2ListPoliciesResponse"
1678	//   },
1679	//   "scopes": [
1680	//     "https://www.googleapis.com/auth/cloud-platform"
1681	//   ]
1682	// }
1683
1684}
1685
1686// Pages invokes f for each page of results.
1687// A non-nil error returned from f will halt the iteration.
1688// The provided context supersedes any context provided to the Context method.
1689func (c *FoldersPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
1690	c.ctx_ = ctx
1691	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1692	for {
1693		x, err := c.Do()
1694		if err != nil {
1695			return err
1696		}
1697		if err := f(x); err != nil {
1698			return err
1699		}
1700		if x.NextPageToken == "" {
1701			return nil
1702		}
1703		c.PageToken(x.NextPageToken)
1704	}
1705}
1706
1707// method id "orgpolicy.folders.policies.patch":
1708
1709type FoldersPoliciesPatchCall struct {
1710	s                            *Service
1711	name                         string
1712	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
1713	urlParams_                   gensupport.URLParams
1714	ctx_                         context.Context
1715	header_                      http.Header
1716}
1717
1718// Patch: Updates a Policy. Returns a `google.rpc.Status` with
1719// `google.rpc.Code.NOT_FOUND` if the constraint or the policy do not
1720// exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED`
1721// if the etag supplied in the request does not match the persisted etag
1722// of the policy Note: the supplied policy will perform a full overwrite
1723// of all fields.
1724//
1725// - name: Immutable. The resource name of the Policy. Must be one of
1726//   the following forms, where constraint_name is the name of the
1727//   constraint which this Policy configures: *
1728//   `projects/{project_number}/policies/{constraint_name}` *
1729//   `folders/{folder_id}/policies/{constraint_name}` *
1730//   `organizations/{organization_id}/policies/{constraint_name}` For
1731//   example, "projects/123/policies/compute.disableSerialPortAccess".
1732//   Note: `projects/{project_id}/policies/{constraint_name}` is also an
1733//   acceptable name for API requests, but responses will return the
1734//   name using the equivalent project number.
1735func (r *FoldersPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *FoldersPoliciesPatchCall {
1736	c := &FoldersPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1737	c.name = name
1738	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
1739	return c
1740}
1741
1742// Fields allows partial responses to be retrieved. See
1743// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1744// for more information.
1745func (c *FoldersPoliciesPatchCall) Fields(s ...googleapi.Field) *FoldersPoliciesPatchCall {
1746	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1747	return c
1748}
1749
1750// Context sets the context to be used in this call's Do method. Any
1751// pending HTTP request will be aborted if the provided context is
1752// canceled.
1753func (c *FoldersPoliciesPatchCall) Context(ctx context.Context) *FoldersPoliciesPatchCall {
1754	c.ctx_ = ctx
1755	return c
1756}
1757
1758// Header returns an http.Header that can be modified by the caller to
1759// add HTTP headers to the request.
1760func (c *FoldersPoliciesPatchCall) Header() http.Header {
1761	if c.header_ == nil {
1762		c.header_ = make(http.Header)
1763	}
1764	return c.header_
1765}
1766
1767func (c *FoldersPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
1768	reqHeaders := make(http.Header)
1769	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1770	for k, v := range c.header_ {
1771		reqHeaders[k] = v
1772	}
1773	reqHeaders.Set("User-Agent", c.s.userAgent())
1774	var body io.Reader = nil
1775	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
1776	if err != nil {
1777		return nil, err
1778	}
1779	reqHeaders.Set("Content-Type", "application/json")
1780	c.urlParams_.Set("alt", alt)
1781	c.urlParams_.Set("prettyPrint", "false")
1782	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1783	urls += "?" + c.urlParams_.Encode()
1784	req, err := http.NewRequest("PATCH", urls, body)
1785	if err != nil {
1786		return nil, err
1787	}
1788	req.Header = reqHeaders
1789	googleapi.Expand(req.URL, map[string]string{
1790		"name": c.name,
1791	})
1792	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1793}
1794
1795// Do executes the "orgpolicy.folders.policies.patch" call.
1796// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
1797// non-nil. Any non-2xx status code is an error. Response headers are in
1798// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
1799// response was returned at all) in error.(*googleapi.Error).Header. Use
1800// googleapi.IsNotModified to check whether the returned error was
1801// because http.StatusNotModified was returned.
1802func (c *FoldersPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
1803	gensupport.SetOptions(c.urlParams_, opts...)
1804	res, err := c.doRequest("json")
1805	if res != nil && res.StatusCode == http.StatusNotModified {
1806		if res.Body != nil {
1807			res.Body.Close()
1808		}
1809		return nil, &googleapi.Error{
1810			Code:   res.StatusCode,
1811			Header: res.Header,
1812		}
1813	}
1814	if err != nil {
1815		return nil, err
1816	}
1817	defer googleapi.CloseBody(res)
1818	if err := googleapi.CheckResponse(res); err != nil {
1819		return nil, err
1820	}
1821	ret := &GoogleCloudOrgpolicyV2Policy{
1822		ServerResponse: googleapi.ServerResponse{
1823			Header:         res.Header,
1824			HTTPStatusCode: res.StatusCode,
1825		},
1826	}
1827	target := &ret
1828	if err := gensupport.DecodeResponse(target, res); err != nil {
1829		return nil, err
1830	}
1831	return ret, nil
1832	// {
1833	//   "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.",
1834	//   "flatPath": "v2/folders/{foldersId}/policies/{policiesId}",
1835	//   "httpMethod": "PATCH",
1836	//   "id": "orgpolicy.folders.policies.patch",
1837	//   "parameterOrder": [
1838	//     "name"
1839	//   ],
1840	//   "parameters": {
1841	//     "name": {
1842	//       "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.",
1843	//       "location": "path",
1844	//       "pattern": "^folders/[^/]+/policies/[^/]+$",
1845	//       "required": true,
1846	//       "type": "string"
1847	//     }
1848	//   },
1849	//   "path": "v2/{+name}",
1850	//   "request": {
1851	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1852	//   },
1853	//   "response": {
1854	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
1855	//   },
1856	//   "scopes": [
1857	//     "https://www.googleapis.com/auth/cloud-platform"
1858	//   ]
1859	// }
1860
1861}
1862
1863// method id "orgpolicy.organizations.constraints.list":
1864
1865type OrganizationsConstraintsListCall struct {
1866	s            *Service
1867	parent       string
1868	urlParams_   gensupport.URLParams
1869	ifNoneMatch_ string
1870	ctx_         context.Context
1871	header_      http.Header
1872}
1873
1874// List: Lists `Constraints` that could be applied on the specified
1875// resource.
1876//
1877// - parent: The Cloud resource that parents the constraint. Must be in
1878//   one of the following forms: * `projects/{project_number}` *
1879//   `projects/{project_id}` * `folders/{folder_id}` *
1880//   `organizations/{organization_id}`.
1881func (r *OrganizationsConstraintsService) List(parent string) *OrganizationsConstraintsListCall {
1882	c := &OrganizationsConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1883	c.parent = parent
1884	return c
1885}
1886
1887// PageSize sets the optional parameter "pageSize": Size of the pages to
1888// be returned. This is currently unsupported and will be ignored. The
1889// server may at any point start using this field to limit page size.
1890func (c *OrganizationsConstraintsListCall) PageSize(pageSize int64) *OrganizationsConstraintsListCall {
1891	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1892	return c
1893}
1894
1895// PageToken sets the optional parameter "pageToken": Page token used to
1896// retrieve the next page. This is currently unsupported and will be
1897// ignored. The server may at any point start using this field.
1898func (c *OrganizationsConstraintsListCall) PageToken(pageToken string) *OrganizationsConstraintsListCall {
1899	c.urlParams_.Set("pageToken", pageToken)
1900	return c
1901}
1902
1903// Fields allows partial responses to be retrieved. See
1904// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1905// for more information.
1906func (c *OrganizationsConstraintsListCall) Fields(s ...googleapi.Field) *OrganizationsConstraintsListCall {
1907	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1908	return c
1909}
1910
1911// IfNoneMatch sets the optional parameter which makes the operation
1912// fail if the object's ETag matches the given value. This is useful for
1913// getting updates only after the object has changed since the last
1914// request. Use googleapi.IsNotModified to check whether the response
1915// error from Do is the result of In-None-Match.
1916func (c *OrganizationsConstraintsListCall) IfNoneMatch(entityTag string) *OrganizationsConstraintsListCall {
1917	c.ifNoneMatch_ = entityTag
1918	return c
1919}
1920
1921// Context sets the context to be used in this call's Do method. Any
1922// pending HTTP request will be aborted if the provided context is
1923// canceled.
1924func (c *OrganizationsConstraintsListCall) Context(ctx context.Context) *OrganizationsConstraintsListCall {
1925	c.ctx_ = ctx
1926	return c
1927}
1928
1929// Header returns an http.Header that can be modified by the caller to
1930// add HTTP headers to the request.
1931func (c *OrganizationsConstraintsListCall) Header() http.Header {
1932	if c.header_ == nil {
1933		c.header_ = make(http.Header)
1934	}
1935	return c.header_
1936}
1937
1938func (c *OrganizationsConstraintsListCall) doRequest(alt string) (*http.Response, error) {
1939	reqHeaders := make(http.Header)
1940	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
1941	for k, v := range c.header_ {
1942		reqHeaders[k] = v
1943	}
1944	reqHeaders.Set("User-Agent", c.s.userAgent())
1945	if c.ifNoneMatch_ != "" {
1946		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1947	}
1948	var body io.Reader = nil
1949	c.urlParams_.Set("alt", alt)
1950	c.urlParams_.Set("prettyPrint", "false")
1951	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
1952	urls += "?" + c.urlParams_.Encode()
1953	req, err := http.NewRequest("GET", urls, body)
1954	if err != nil {
1955		return nil, err
1956	}
1957	req.Header = reqHeaders
1958	googleapi.Expand(req.URL, map[string]string{
1959		"parent": c.parent,
1960	})
1961	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1962}
1963
1964// Do executes the "orgpolicy.organizations.constraints.list" call.
1965// Exactly one of *GoogleCloudOrgpolicyV2ListConstraintsResponse or
1966// error will be non-nil. Any non-2xx status code is an error. Response
1967// headers are in either
1968// *GoogleCloudOrgpolicyV2ListConstraintsResponse.ServerResponse.Header
1969// or (if a response was returned at all) in
1970// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1971// whether the returned error was because http.StatusNotModified was
1972// returned.
1973func (c *OrganizationsConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
1974	gensupport.SetOptions(c.urlParams_, opts...)
1975	res, err := c.doRequest("json")
1976	if res != nil && res.StatusCode == http.StatusNotModified {
1977		if res.Body != nil {
1978			res.Body.Close()
1979		}
1980		return nil, &googleapi.Error{
1981			Code:   res.StatusCode,
1982			Header: res.Header,
1983		}
1984	}
1985	if err != nil {
1986		return nil, err
1987	}
1988	defer googleapi.CloseBody(res)
1989	if err := googleapi.CheckResponse(res); err != nil {
1990		return nil, err
1991	}
1992	ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
1993		ServerResponse: googleapi.ServerResponse{
1994			Header:         res.Header,
1995			HTTPStatusCode: res.StatusCode,
1996		},
1997	}
1998	target := &ret
1999	if err := gensupport.DecodeResponse(target, res); err != nil {
2000		return nil, err
2001	}
2002	return ret, nil
2003	// {
2004	//   "description": "Lists `Constraints` that could be applied on the specified resource.",
2005	//   "flatPath": "v2/organizations/{organizationsId}/constraints",
2006	//   "httpMethod": "GET",
2007	//   "id": "orgpolicy.organizations.constraints.list",
2008	//   "parameterOrder": [
2009	//     "parent"
2010	//   ],
2011	//   "parameters": {
2012	//     "pageSize": {
2013	//       "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.",
2014	//       "format": "int32",
2015	//       "location": "query",
2016	//       "type": "integer"
2017	//     },
2018	//     "pageToken": {
2019	//       "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.",
2020	//       "location": "query",
2021	//       "type": "string"
2022	//     },
2023	//     "parent": {
2024	//       "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}`",
2025	//       "location": "path",
2026	//       "pattern": "^organizations/[^/]+$",
2027	//       "required": true,
2028	//       "type": "string"
2029	//     }
2030	//   },
2031	//   "path": "v2/{+parent}/constraints",
2032	//   "response": {
2033	//     "$ref": "GoogleCloudOrgpolicyV2ListConstraintsResponse"
2034	//   },
2035	//   "scopes": [
2036	//     "https://www.googleapis.com/auth/cloud-platform"
2037	//   ]
2038	// }
2039
2040}
2041
2042// Pages invokes f for each page of results.
2043// A non-nil error returned from f will halt the iteration.
2044// The provided context supersedes any context provided to the Context method.
2045func (c *OrganizationsConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
2046	c.ctx_ = ctx
2047	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
2048	for {
2049		x, err := c.Do()
2050		if err != nil {
2051			return err
2052		}
2053		if err := f(x); err != nil {
2054			return err
2055		}
2056		if x.NextPageToken == "" {
2057			return nil
2058		}
2059		c.PageToken(x.NextPageToken)
2060	}
2061}
2062
2063// method id "orgpolicy.organizations.policies.create":
2064
2065type OrganizationsPoliciesCreateCall struct {
2066	s                            *Service
2067	parent                       string
2068	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
2069	urlParams_                   gensupport.URLParams
2070	ctx_                         context.Context
2071	header_                      http.Header
2072}
2073
2074// Create: Creates a Policy. Returns a `google.rpc.Status` with
2075// `google.rpc.Code.NOT_FOUND` if the constraint does not exist. Returns
2076// a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the
2077// policy already exists on the given Cloud resource.
2078//
2079// - parent: The Cloud resource that will parent the new Policy. Must be
2080//   in one of the following forms: * `projects/{project_number}` *
2081//   `projects/{project_id}` * `folders/{folder_id}` *
2082//   `organizations/{organization_id}`.
2083func (r *OrganizationsPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *OrganizationsPoliciesCreateCall {
2084	c := &OrganizationsPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2085	c.parent = parent
2086	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
2087	return c
2088}
2089
2090// Fields allows partial responses to be retrieved. See
2091// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2092// for more information.
2093func (c *OrganizationsPoliciesCreateCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesCreateCall {
2094	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2095	return c
2096}
2097
2098// Context sets the context to be used in this call's Do method. Any
2099// pending HTTP request will be aborted if the provided context is
2100// canceled.
2101func (c *OrganizationsPoliciesCreateCall) Context(ctx context.Context) *OrganizationsPoliciesCreateCall {
2102	c.ctx_ = ctx
2103	return c
2104}
2105
2106// Header returns an http.Header that can be modified by the caller to
2107// add HTTP headers to the request.
2108func (c *OrganizationsPoliciesCreateCall) Header() http.Header {
2109	if c.header_ == nil {
2110		c.header_ = make(http.Header)
2111	}
2112	return c.header_
2113}
2114
2115func (c *OrganizationsPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
2116	reqHeaders := make(http.Header)
2117	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2118	for k, v := range c.header_ {
2119		reqHeaders[k] = v
2120	}
2121	reqHeaders.Set("User-Agent", c.s.userAgent())
2122	var body io.Reader = nil
2123	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
2124	if err != nil {
2125		return nil, err
2126	}
2127	reqHeaders.Set("Content-Type", "application/json")
2128	c.urlParams_.Set("alt", alt)
2129	c.urlParams_.Set("prettyPrint", "false")
2130	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
2131	urls += "?" + c.urlParams_.Encode()
2132	req, err := http.NewRequest("POST", urls, body)
2133	if err != nil {
2134		return nil, err
2135	}
2136	req.Header = reqHeaders
2137	googleapi.Expand(req.URL, map[string]string{
2138		"parent": c.parent,
2139	})
2140	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2141}
2142
2143// Do executes the "orgpolicy.organizations.policies.create" call.
2144// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
2145// non-nil. Any non-2xx status code is an error. Response headers are in
2146// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
2147// response was returned at all) in error.(*googleapi.Error).Header. Use
2148// googleapi.IsNotModified to check whether the returned error was
2149// because http.StatusNotModified was returned.
2150func (c *OrganizationsPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2151	gensupport.SetOptions(c.urlParams_, opts...)
2152	res, err := c.doRequest("json")
2153	if res != nil && res.StatusCode == http.StatusNotModified {
2154		if res.Body != nil {
2155			res.Body.Close()
2156		}
2157		return nil, &googleapi.Error{
2158			Code:   res.StatusCode,
2159			Header: res.Header,
2160		}
2161	}
2162	if err != nil {
2163		return nil, err
2164	}
2165	defer googleapi.CloseBody(res)
2166	if err := googleapi.CheckResponse(res); err != nil {
2167		return nil, err
2168	}
2169	ret := &GoogleCloudOrgpolicyV2Policy{
2170		ServerResponse: googleapi.ServerResponse{
2171			Header:         res.Header,
2172			HTTPStatusCode: res.StatusCode,
2173		},
2174	}
2175	target := &ret
2176	if err := gensupport.DecodeResponse(target, res); err != nil {
2177		return nil, err
2178	}
2179	return ret, nil
2180	// {
2181	//   "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.",
2182	//   "flatPath": "v2/organizations/{organizationsId}/policies",
2183	//   "httpMethod": "POST",
2184	//   "id": "orgpolicy.organizations.policies.create",
2185	//   "parameterOrder": [
2186	//     "parent"
2187	//   ],
2188	//   "parameters": {
2189	//     "parent": {
2190	//       "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}`",
2191	//       "location": "path",
2192	//       "pattern": "^organizations/[^/]+$",
2193	//       "required": true,
2194	//       "type": "string"
2195	//     }
2196	//   },
2197	//   "path": "v2/{+parent}/policies",
2198	//   "request": {
2199	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2200	//   },
2201	//   "response": {
2202	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2203	//   },
2204	//   "scopes": [
2205	//     "https://www.googleapis.com/auth/cloud-platform"
2206	//   ]
2207	// }
2208
2209}
2210
2211// method id "orgpolicy.organizations.policies.delete":
2212
2213type OrganizationsPoliciesDeleteCall struct {
2214	s          *Service
2215	name       string
2216	urlParams_ gensupport.URLParams
2217	ctx_       context.Context
2218	header_    http.Header
2219}
2220
2221// Delete: Deletes a Policy. Returns a `google.rpc.Status` with
2222// `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not
2223// exist.
2224//
2225// - name: Name of the policy to delete. See `Policy` for naming rules.
2226func (r *OrganizationsPoliciesService) Delete(name string) *OrganizationsPoliciesDeleteCall {
2227	c := &OrganizationsPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2228	c.name = name
2229	return c
2230}
2231
2232// Fields allows partial responses to be retrieved. See
2233// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2234// for more information.
2235func (c *OrganizationsPoliciesDeleteCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesDeleteCall {
2236	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2237	return c
2238}
2239
2240// Context sets the context to be used in this call's Do method. Any
2241// pending HTTP request will be aborted if the provided context is
2242// canceled.
2243func (c *OrganizationsPoliciesDeleteCall) Context(ctx context.Context) *OrganizationsPoliciesDeleteCall {
2244	c.ctx_ = ctx
2245	return c
2246}
2247
2248// Header returns an http.Header that can be modified by the caller to
2249// add HTTP headers to the request.
2250func (c *OrganizationsPoliciesDeleteCall) Header() http.Header {
2251	if c.header_ == nil {
2252		c.header_ = make(http.Header)
2253	}
2254	return c.header_
2255}
2256
2257func (c *OrganizationsPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
2258	reqHeaders := make(http.Header)
2259	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2260	for k, v := range c.header_ {
2261		reqHeaders[k] = v
2262	}
2263	reqHeaders.Set("User-Agent", c.s.userAgent())
2264	var body io.Reader = nil
2265	c.urlParams_.Set("alt", alt)
2266	c.urlParams_.Set("prettyPrint", "false")
2267	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2268	urls += "?" + c.urlParams_.Encode()
2269	req, err := http.NewRequest("DELETE", urls, body)
2270	if err != nil {
2271		return nil, err
2272	}
2273	req.Header = reqHeaders
2274	googleapi.Expand(req.URL, map[string]string{
2275		"name": c.name,
2276	})
2277	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2278}
2279
2280// Do executes the "orgpolicy.organizations.policies.delete" call.
2281// Exactly one of *GoogleProtobufEmpty or error will be non-nil. Any
2282// non-2xx status code is an error. Response headers are in either
2283// *GoogleProtobufEmpty.ServerResponse.Header or (if a response was
2284// returned at all) in error.(*googleapi.Error).Header. Use
2285// googleapi.IsNotModified to check whether the returned error was
2286// because http.StatusNotModified was returned.
2287func (c *OrganizationsPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
2288	gensupport.SetOptions(c.urlParams_, opts...)
2289	res, err := c.doRequest("json")
2290	if res != nil && res.StatusCode == http.StatusNotModified {
2291		if res.Body != nil {
2292			res.Body.Close()
2293		}
2294		return nil, &googleapi.Error{
2295			Code:   res.StatusCode,
2296			Header: res.Header,
2297		}
2298	}
2299	if err != nil {
2300		return nil, err
2301	}
2302	defer googleapi.CloseBody(res)
2303	if err := googleapi.CheckResponse(res); err != nil {
2304		return nil, err
2305	}
2306	ret := &GoogleProtobufEmpty{
2307		ServerResponse: googleapi.ServerResponse{
2308			Header:         res.Header,
2309			HTTPStatusCode: res.StatusCode,
2310		},
2311	}
2312	target := &ret
2313	if err := gensupport.DecodeResponse(target, res); err != nil {
2314		return nil, err
2315	}
2316	return ret, nil
2317	// {
2318	//   "description": "Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not exist.",
2319	//   "flatPath": "v2/organizations/{organizationsId}/policies/{policiesId}",
2320	//   "httpMethod": "DELETE",
2321	//   "id": "orgpolicy.organizations.policies.delete",
2322	//   "parameterOrder": [
2323	//     "name"
2324	//   ],
2325	//   "parameters": {
2326	//     "name": {
2327	//       "description": "Required. Name of the policy to delete. See `Policy` for naming rules.",
2328	//       "location": "path",
2329	//       "pattern": "^organizations/[^/]+/policies/[^/]+$",
2330	//       "required": true,
2331	//       "type": "string"
2332	//     }
2333	//   },
2334	//   "path": "v2/{+name}",
2335	//   "response": {
2336	//     "$ref": "GoogleProtobufEmpty"
2337	//   },
2338	//   "scopes": [
2339	//     "https://www.googleapis.com/auth/cloud-platform"
2340	//   ]
2341	// }
2342
2343}
2344
2345// method id "orgpolicy.organizations.policies.get":
2346
2347type OrganizationsPoliciesGetCall struct {
2348	s            *Service
2349	name         string
2350	urlParams_   gensupport.URLParams
2351	ifNoneMatch_ string
2352	ctx_         context.Context
2353	header_      http.Header
2354}
2355
2356// Get: Gets a `Policy` on a resource. If no `Policy` is set on the
2357// resource, NOT_FOUND is returned. The `etag` value can be used with
2358// `UpdatePolicy()` to update a `Policy` during read-modify-write.
2359//
2360// - name: Resource name of the policy. See `Policy` for naming
2361//   requirements.
2362func (r *OrganizationsPoliciesService) Get(name string) *OrganizationsPoliciesGetCall {
2363	c := &OrganizationsPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2364	c.name = name
2365	return c
2366}
2367
2368// Fields allows partial responses to be retrieved. See
2369// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2370// for more information.
2371func (c *OrganizationsPoliciesGetCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesGetCall {
2372	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2373	return c
2374}
2375
2376// IfNoneMatch sets the optional parameter which makes the operation
2377// fail if the object's ETag matches the given value. This is useful for
2378// getting updates only after the object has changed since the last
2379// request. Use googleapi.IsNotModified to check whether the response
2380// error from Do is the result of In-None-Match.
2381func (c *OrganizationsPoliciesGetCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesGetCall {
2382	c.ifNoneMatch_ = entityTag
2383	return c
2384}
2385
2386// Context sets the context to be used in this call's Do method. Any
2387// pending HTTP request will be aborted if the provided context is
2388// canceled.
2389func (c *OrganizationsPoliciesGetCall) Context(ctx context.Context) *OrganizationsPoliciesGetCall {
2390	c.ctx_ = ctx
2391	return c
2392}
2393
2394// Header returns an http.Header that can be modified by the caller to
2395// add HTTP headers to the request.
2396func (c *OrganizationsPoliciesGetCall) Header() http.Header {
2397	if c.header_ == nil {
2398		c.header_ = make(http.Header)
2399	}
2400	return c.header_
2401}
2402
2403func (c *OrganizationsPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
2404	reqHeaders := make(http.Header)
2405	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2406	for k, v := range c.header_ {
2407		reqHeaders[k] = v
2408	}
2409	reqHeaders.Set("User-Agent", c.s.userAgent())
2410	if c.ifNoneMatch_ != "" {
2411		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2412	}
2413	var body io.Reader = nil
2414	c.urlParams_.Set("alt", alt)
2415	c.urlParams_.Set("prettyPrint", "false")
2416	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2417	urls += "?" + c.urlParams_.Encode()
2418	req, err := http.NewRequest("GET", urls, body)
2419	if err != nil {
2420		return nil, err
2421	}
2422	req.Header = reqHeaders
2423	googleapi.Expand(req.URL, map[string]string{
2424		"name": c.name,
2425	})
2426	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2427}
2428
2429// Do executes the "orgpolicy.organizations.policies.get" call.
2430// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
2431// non-nil. Any non-2xx status code is an error. Response headers are in
2432// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
2433// response was returned at all) in error.(*googleapi.Error).Header. Use
2434// googleapi.IsNotModified to check whether the returned error was
2435// because http.StatusNotModified was returned.
2436func (c *OrganizationsPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2437	gensupport.SetOptions(c.urlParams_, opts...)
2438	res, err := c.doRequest("json")
2439	if res != nil && res.StatusCode == http.StatusNotModified {
2440		if res.Body != nil {
2441			res.Body.Close()
2442		}
2443		return nil, &googleapi.Error{
2444			Code:   res.StatusCode,
2445			Header: res.Header,
2446		}
2447	}
2448	if err != nil {
2449		return nil, err
2450	}
2451	defer googleapi.CloseBody(res)
2452	if err := googleapi.CheckResponse(res); err != nil {
2453		return nil, err
2454	}
2455	ret := &GoogleCloudOrgpolicyV2Policy{
2456		ServerResponse: googleapi.ServerResponse{
2457			Header:         res.Header,
2458			HTTPStatusCode: res.StatusCode,
2459		},
2460	}
2461	target := &ret
2462	if err := gensupport.DecodeResponse(target, res); err != nil {
2463		return nil, err
2464	}
2465	return ret, nil
2466	// {
2467	//   "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.",
2468	//   "flatPath": "v2/organizations/{organizationsId}/policies/{policiesId}",
2469	//   "httpMethod": "GET",
2470	//   "id": "orgpolicy.organizations.policies.get",
2471	//   "parameterOrder": [
2472	//     "name"
2473	//   ],
2474	//   "parameters": {
2475	//     "name": {
2476	//       "description": "Required. Resource name of the policy. See `Policy` for naming requirements.",
2477	//       "location": "path",
2478	//       "pattern": "^organizations/[^/]+/policies/[^/]+$",
2479	//       "required": true,
2480	//       "type": "string"
2481	//     }
2482	//   },
2483	//   "path": "v2/{+name}",
2484	//   "response": {
2485	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2486	//   },
2487	//   "scopes": [
2488	//     "https://www.googleapis.com/auth/cloud-platform"
2489	//   ]
2490	// }
2491
2492}
2493
2494// method id "orgpolicy.organizations.policies.getEffectivePolicy":
2495
2496type OrganizationsPoliciesGetEffectivePolicyCall struct {
2497	s            *Service
2498	name         string
2499	urlParams_   gensupport.URLParams
2500	ifNoneMatch_ string
2501	ctx_         context.Context
2502	header_      http.Header
2503}
2504
2505// GetEffectivePolicy: Gets the effective `Policy` on a resource. This
2506// is the result of merging `Policies` in the resource hierarchy and
2507// evaluating conditions. The returned `Policy` will not have an `etag`
2508// or `condition` set because it is a computed `Policy` across multiple
2509// resources. Subtrees of Resource Manager resource hierarchy with
2510// 'under:' prefix will not be expanded.
2511//
2512// - name: The effective policy to compute. See `Policy` for naming
2513//   rules.
2514func (r *OrganizationsPoliciesService) GetEffectivePolicy(name string) *OrganizationsPoliciesGetEffectivePolicyCall {
2515	c := &OrganizationsPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2516	c.name = name
2517	return c
2518}
2519
2520// Fields allows partial responses to be retrieved. See
2521// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2522// for more information.
2523func (c *OrganizationsPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesGetEffectivePolicyCall {
2524	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2525	return c
2526}
2527
2528// IfNoneMatch sets the optional parameter which makes the operation
2529// fail if the object's ETag matches the given value. This is useful for
2530// getting updates only after the object has changed since the last
2531// request. Use googleapi.IsNotModified to check whether the response
2532// error from Do is the result of In-None-Match.
2533func (c *OrganizationsPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesGetEffectivePolicyCall {
2534	c.ifNoneMatch_ = entityTag
2535	return c
2536}
2537
2538// Context sets the context to be used in this call's Do method. Any
2539// pending HTTP request will be aborted if the provided context is
2540// canceled.
2541func (c *OrganizationsPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *OrganizationsPoliciesGetEffectivePolicyCall {
2542	c.ctx_ = ctx
2543	return c
2544}
2545
2546// Header returns an http.Header that can be modified by the caller to
2547// add HTTP headers to the request.
2548func (c *OrganizationsPoliciesGetEffectivePolicyCall) Header() http.Header {
2549	if c.header_ == nil {
2550		c.header_ = make(http.Header)
2551	}
2552	return c.header_
2553}
2554
2555func (c *OrganizationsPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
2556	reqHeaders := make(http.Header)
2557	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2558	for k, v := range c.header_ {
2559		reqHeaders[k] = v
2560	}
2561	reqHeaders.Set("User-Agent", c.s.userAgent())
2562	if c.ifNoneMatch_ != "" {
2563		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2564	}
2565	var body io.Reader = nil
2566	c.urlParams_.Set("alt", alt)
2567	c.urlParams_.Set("prettyPrint", "false")
2568	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
2569	urls += "?" + c.urlParams_.Encode()
2570	req, err := http.NewRequest("GET", urls, body)
2571	if err != nil {
2572		return nil, err
2573	}
2574	req.Header = reqHeaders
2575	googleapi.Expand(req.URL, map[string]string{
2576		"name": c.name,
2577	})
2578	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2579}
2580
2581// Do executes the "orgpolicy.organizations.policies.getEffectivePolicy" call.
2582// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
2583// non-nil. Any non-2xx status code is an error. Response headers are in
2584// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
2585// response was returned at all) in error.(*googleapi.Error).Header. Use
2586// googleapi.IsNotModified to check whether the returned error was
2587// because http.StatusNotModified was returned.
2588func (c *OrganizationsPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2589	gensupport.SetOptions(c.urlParams_, opts...)
2590	res, err := c.doRequest("json")
2591	if res != nil && res.StatusCode == http.StatusNotModified {
2592		if res.Body != nil {
2593			res.Body.Close()
2594		}
2595		return nil, &googleapi.Error{
2596			Code:   res.StatusCode,
2597			Header: res.Header,
2598		}
2599	}
2600	if err != nil {
2601		return nil, err
2602	}
2603	defer googleapi.CloseBody(res)
2604	if err := googleapi.CheckResponse(res); err != nil {
2605		return nil, err
2606	}
2607	ret := &GoogleCloudOrgpolicyV2Policy{
2608		ServerResponse: googleapi.ServerResponse{
2609			Header:         res.Header,
2610			HTTPStatusCode: res.StatusCode,
2611		},
2612	}
2613	target := &ret
2614	if err := gensupport.DecodeResponse(target, res); err != nil {
2615		return nil, err
2616	}
2617	return ret, nil
2618	// {
2619	//   "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.",
2620	//   "flatPath": "v2/organizations/{organizationsId}/policies/{policiesId}:getEffectivePolicy",
2621	//   "httpMethod": "GET",
2622	//   "id": "orgpolicy.organizations.policies.getEffectivePolicy",
2623	//   "parameterOrder": [
2624	//     "name"
2625	//   ],
2626	//   "parameters": {
2627	//     "name": {
2628	//       "description": "Required. The effective policy to compute. See `Policy` for naming rules.",
2629	//       "location": "path",
2630	//       "pattern": "^organizations/[^/]+/policies/[^/]+$",
2631	//       "required": true,
2632	//       "type": "string"
2633	//     }
2634	//   },
2635	//   "path": "v2/{+name}:getEffectivePolicy",
2636	//   "response": {
2637	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2638	//   },
2639	//   "scopes": [
2640	//     "https://www.googleapis.com/auth/cloud-platform"
2641	//   ]
2642	// }
2643
2644}
2645
2646// method id "orgpolicy.organizations.policies.list":
2647
2648type OrganizationsPoliciesListCall struct {
2649	s            *Service
2650	parent       string
2651	urlParams_   gensupport.URLParams
2652	ifNoneMatch_ string
2653	ctx_         context.Context
2654	header_      http.Header
2655}
2656
2657// List: Retrieves all of the `Policies` that exist on a particular
2658// resource.
2659//
2660// - parent: The target Cloud resource that parents the set of
2661//   constraints and policies that will be returned from this call. Must
2662//   be in one of the following forms: * `projects/{project_number}` *
2663//   `projects/{project_id}` * `folders/{folder_id}` *
2664//   `organizations/{organization_id}`.
2665func (r *OrganizationsPoliciesService) List(parent string) *OrganizationsPoliciesListCall {
2666	c := &OrganizationsPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2667	c.parent = parent
2668	return c
2669}
2670
2671// PageSize sets the optional parameter "pageSize": Size of the pages to
2672// be returned. This is currently unsupported and will be ignored. The
2673// server may at any point start using this field to limit page size.
2674func (c *OrganizationsPoliciesListCall) PageSize(pageSize int64) *OrganizationsPoliciesListCall {
2675	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2676	return c
2677}
2678
2679// PageToken sets the optional parameter "pageToken": Page token used to
2680// retrieve the next page. This is currently unsupported and will be
2681// ignored. The server may at any point start using this field.
2682func (c *OrganizationsPoliciesListCall) PageToken(pageToken string) *OrganizationsPoliciesListCall {
2683	c.urlParams_.Set("pageToken", pageToken)
2684	return c
2685}
2686
2687// Fields allows partial responses to be retrieved. See
2688// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2689// for more information.
2690func (c *OrganizationsPoliciesListCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesListCall {
2691	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2692	return c
2693}
2694
2695// IfNoneMatch sets the optional parameter which makes the operation
2696// fail if the object's ETag matches the given value. This is useful for
2697// getting updates only after the object has changed since the last
2698// request. Use googleapi.IsNotModified to check whether the response
2699// error from Do is the result of In-None-Match.
2700func (c *OrganizationsPoliciesListCall) IfNoneMatch(entityTag string) *OrganizationsPoliciesListCall {
2701	c.ifNoneMatch_ = entityTag
2702	return c
2703}
2704
2705// Context sets the context to be used in this call's Do method. Any
2706// pending HTTP request will be aborted if the provided context is
2707// canceled.
2708func (c *OrganizationsPoliciesListCall) Context(ctx context.Context) *OrganizationsPoliciesListCall {
2709	c.ctx_ = ctx
2710	return c
2711}
2712
2713// Header returns an http.Header that can be modified by the caller to
2714// add HTTP headers to the request.
2715func (c *OrganizationsPoliciesListCall) Header() http.Header {
2716	if c.header_ == nil {
2717		c.header_ = make(http.Header)
2718	}
2719	return c.header_
2720}
2721
2722func (c *OrganizationsPoliciesListCall) doRequest(alt string) (*http.Response, error) {
2723	reqHeaders := make(http.Header)
2724	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2725	for k, v := range c.header_ {
2726		reqHeaders[k] = v
2727	}
2728	reqHeaders.Set("User-Agent", c.s.userAgent())
2729	if c.ifNoneMatch_ != "" {
2730		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2731	}
2732	var body io.Reader = nil
2733	c.urlParams_.Set("alt", alt)
2734	c.urlParams_.Set("prettyPrint", "false")
2735	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
2736	urls += "?" + c.urlParams_.Encode()
2737	req, err := http.NewRequest("GET", urls, body)
2738	if err != nil {
2739		return nil, err
2740	}
2741	req.Header = reqHeaders
2742	googleapi.Expand(req.URL, map[string]string{
2743		"parent": c.parent,
2744	})
2745	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2746}
2747
2748// Do executes the "orgpolicy.organizations.policies.list" call.
2749// Exactly one of *GoogleCloudOrgpolicyV2ListPoliciesResponse or error
2750// will be non-nil. Any non-2xx status code is an error. Response
2751// headers are in either
2752// *GoogleCloudOrgpolicyV2ListPoliciesResponse.ServerResponse.Header or
2753// (if a response was returned at all) in
2754// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
2755// whether the returned error was because http.StatusNotModified was
2756// returned.
2757func (c *OrganizationsPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
2758	gensupport.SetOptions(c.urlParams_, opts...)
2759	res, err := c.doRequest("json")
2760	if res != nil && res.StatusCode == http.StatusNotModified {
2761		if res.Body != nil {
2762			res.Body.Close()
2763		}
2764		return nil, &googleapi.Error{
2765			Code:   res.StatusCode,
2766			Header: res.Header,
2767		}
2768	}
2769	if err != nil {
2770		return nil, err
2771	}
2772	defer googleapi.CloseBody(res)
2773	if err := googleapi.CheckResponse(res); err != nil {
2774		return nil, err
2775	}
2776	ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
2777		ServerResponse: googleapi.ServerResponse{
2778			Header:         res.Header,
2779			HTTPStatusCode: res.StatusCode,
2780		},
2781	}
2782	target := &ret
2783	if err := gensupport.DecodeResponse(target, res); err != nil {
2784		return nil, err
2785	}
2786	return ret, nil
2787	// {
2788	//   "description": "Retrieves all of the `Policies` that exist on a particular resource.",
2789	//   "flatPath": "v2/organizations/{organizationsId}/policies",
2790	//   "httpMethod": "GET",
2791	//   "id": "orgpolicy.organizations.policies.list",
2792	//   "parameterOrder": [
2793	//     "parent"
2794	//   ],
2795	//   "parameters": {
2796	//     "pageSize": {
2797	//       "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.",
2798	//       "format": "int32",
2799	//       "location": "query",
2800	//       "type": "integer"
2801	//     },
2802	//     "pageToken": {
2803	//       "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.",
2804	//       "location": "query",
2805	//       "type": "string"
2806	//     },
2807	//     "parent": {
2808	//       "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}`",
2809	//       "location": "path",
2810	//       "pattern": "^organizations/[^/]+$",
2811	//       "required": true,
2812	//       "type": "string"
2813	//     }
2814	//   },
2815	//   "path": "v2/{+parent}/policies",
2816	//   "response": {
2817	//     "$ref": "GoogleCloudOrgpolicyV2ListPoliciesResponse"
2818	//   },
2819	//   "scopes": [
2820	//     "https://www.googleapis.com/auth/cloud-platform"
2821	//   ]
2822	// }
2823
2824}
2825
2826// Pages invokes f for each page of results.
2827// A non-nil error returned from f will halt the iteration.
2828// The provided context supersedes any context provided to the Context method.
2829func (c *OrganizationsPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
2830	c.ctx_ = ctx
2831	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
2832	for {
2833		x, err := c.Do()
2834		if err != nil {
2835			return err
2836		}
2837		if err := f(x); err != nil {
2838			return err
2839		}
2840		if x.NextPageToken == "" {
2841			return nil
2842		}
2843		c.PageToken(x.NextPageToken)
2844	}
2845}
2846
2847// method id "orgpolicy.organizations.policies.patch":
2848
2849type OrganizationsPoliciesPatchCall struct {
2850	s                            *Service
2851	name                         string
2852	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
2853	urlParams_                   gensupport.URLParams
2854	ctx_                         context.Context
2855	header_                      http.Header
2856}
2857
2858// Patch: Updates a Policy. Returns a `google.rpc.Status` with
2859// `google.rpc.Code.NOT_FOUND` if the constraint or the policy do not
2860// exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED`
2861// if the etag supplied in the request does not match the persisted etag
2862// of the policy Note: the supplied policy will perform a full overwrite
2863// of all fields.
2864//
2865// - name: Immutable. The resource name of the Policy. Must be one of
2866//   the following forms, where constraint_name is the name of the
2867//   constraint which this Policy configures: *
2868//   `projects/{project_number}/policies/{constraint_name}` *
2869//   `folders/{folder_id}/policies/{constraint_name}` *
2870//   `organizations/{organization_id}/policies/{constraint_name}` For
2871//   example, "projects/123/policies/compute.disableSerialPortAccess".
2872//   Note: `projects/{project_id}/policies/{constraint_name}` is also an
2873//   acceptable name for API requests, but responses will return the
2874//   name using the equivalent project number.
2875func (r *OrganizationsPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *OrganizationsPoliciesPatchCall {
2876	c := &OrganizationsPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2877	c.name = name
2878	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
2879	return c
2880}
2881
2882// Fields allows partial responses to be retrieved. See
2883// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2884// for more information.
2885func (c *OrganizationsPoliciesPatchCall) Fields(s ...googleapi.Field) *OrganizationsPoliciesPatchCall {
2886	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2887	return c
2888}
2889
2890// Context sets the context to be used in this call's Do method. Any
2891// pending HTTP request will be aborted if the provided context is
2892// canceled.
2893func (c *OrganizationsPoliciesPatchCall) Context(ctx context.Context) *OrganizationsPoliciesPatchCall {
2894	c.ctx_ = ctx
2895	return c
2896}
2897
2898// Header returns an http.Header that can be modified by the caller to
2899// add HTTP headers to the request.
2900func (c *OrganizationsPoliciesPatchCall) Header() http.Header {
2901	if c.header_ == nil {
2902		c.header_ = make(http.Header)
2903	}
2904	return c.header_
2905}
2906
2907func (c *OrganizationsPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
2908	reqHeaders := make(http.Header)
2909	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
2910	for k, v := range c.header_ {
2911		reqHeaders[k] = v
2912	}
2913	reqHeaders.Set("User-Agent", c.s.userAgent())
2914	var body io.Reader = nil
2915	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
2916	if err != nil {
2917		return nil, err
2918	}
2919	reqHeaders.Set("Content-Type", "application/json")
2920	c.urlParams_.Set("alt", alt)
2921	c.urlParams_.Set("prettyPrint", "false")
2922	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2923	urls += "?" + c.urlParams_.Encode()
2924	req, err := http.NewRequest("PATCH", urls, body)
2925	if err != nil {
2926		return nil, err
2927	}
2928	req.Header = reqHeaders
2929	googleapi.Expand(req.URL, map[string]string{
2930		"name": c.name,
2931	})
2932	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2933}
2934
2935// Do executes the "orgpolicy.organizations.policies.patch" call.
2936// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
2937// non-nil. Any non-2xx status code is an error. Response headers are in
2938// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
2939// response was returned at all) in error.(*googleapi.Error).Header. Use
2940// googleapi.IsNotModified to check whether the returned error was
2941// because http.StatusNotModified was returned.
2942func (c *OrganizationsPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
2943	gensupport.SetOptions(c.urlParams_, opts...)
2944	res, err := c.doRequest("json")
2945	if res != nil && res.StatusCode == http.StatusNotModified {
2946		if res.Body != nil {
2947			res.Body.Close()
2948		}
2949		return nil, &googleapi.Error{
2950			Code:   res.StatusCode,
2951			Header: res.Header,
2952		}
2953	}
2954	if err != nil {
2955		return nil, err
2956	}
2957	defer googleapi.CloseBody(res)
2958	if err := googleapi.CheckResponse(res); err != nil {
2959		return nil, err
2960	}
2961	ret := &GoogleCloudOrgpolicyV2Policy{
2962		ServerResponse: googleapi.ServerResponse{
2963			Header:         res.Header,
2964			HTTPStatusCode: res.StatusCode,
2965		},
2966	}
2967	target := &ret
2968	if err := gensupport.DecodeResponse(target, res); err != nil {
2969		return nil, err
2970	}
2971	return ret, nil
2972	// {
2973	//   "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.",
2974	//   "flatPath": "v2/organizations/{organizationsId}/policies/{policiesId}",
2975	//   "httpMethod": "PATCH",
2976	//   "id": "orgpolicy.organizations.policies.patch",
2977	//   "parameterOrder": [
2978	//     "name"
2979	//   ],
2980	//   "parameters": {
2981	//     "name": {
2982	//       "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.",
2983	//       "location": "path",
2984	//       "pattern": "^organizations/[^/]+/policies/[^/]+$",
2985	//       "required": true,
2986	//       "type": "string"
2987	//     }
2988	//   },
2989	//   "path": "v2/{+name}",
2990	//   "request": {
2991	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2992	//   },
2993	//   "response": {
2994	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
2995	//   },
2996	//   "scopes": [
2997	//     "https://www.googleapis.com/auth/cloud-platform"
2998	//   ]
2999	// }
3000
3001}
3002
3003// method id "orgpolicy.projects.constraints.list":
3004
3005type ProjectsConstraintsListCall struct {
3006	s            *Service
3007	parent       string
3008	urlParams_   gensupport.URLParams
3009	ifNoneMatch_ string
3010	ctx_         context.Context
3011	header_      http.Header
3012}
3013
3014// List: Lists `Constraints` that could be applied on the specified
3015// resource.
3016//
3017// - parent: The Cloud resource that parents the constraint. Must be in
3018//   one of the following forms: * `projects/{project_number}` *
3019//   `projects/{project_id}` * `folders/{folder_id}` *
3020//   `organizations/{organization_id}`.
3021func (r *ProjectsConstraintsService) List(parent string) *ProjectsConstraintsListCall {
3022	c := &ProjectsConstraintsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3023	c.parent = parent
3024	return c
3025}
3026
3027// PageSize sets the optional parameter "pageSize": Size of the pages to
3028// be returned. This is currently unsupported and will be ignored. The
3029// server may at any point start using this field to limit page size.
3030func (c *ProjectsConstraintsListCall) PageSize(pageSize int64) *ProjectsConstraintsListCall {
3031	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3032	return c
3033}
3034
3035// PageToken sets the optional parameter "pageToken": Page token used to
3036// retrieve the next page. This is currently unsupported and will be
3037// ignored. The server may at any point start using this field.
3038func (c *ProjectsConstraintsListCall) PageToken(pageToken string) *ProjectsConstraintsListCall {
3039	c.urlParams_.Set("pageToken", pageToken)
3040	return c
3041}
3042
3043// Fields allows partial responses to be retrieved. See
3044// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3045// for more information.
3046func (c *ProjectsConstraintsListCall) Fields(s ...googleapi.Field) *ProjectsConstraintsListCall {
3047	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3048	return c
3049}
3050
3051// IfNoneMatch sets the optional parameter which makes the operation
3052// fail if the object's ETag matches the given value. This is useful for
3053// getting updates only after the object has changed since the last
3054// request. Use googleapi.IsNotModified to check whether the response
3055// error from Do is the result of In-None-Match.
3056func (c *ProjectsConstraintsListCall) IfNoneMatch(entityTag string) *ProjectsConstraintsListCall {
3057	c.ifNoneMatch_ = entityTag
3058	return c
3059}
3060
3061// Context sets the context to be used in this call's Do method. Any
3062// pending HTTP request will be aborted if the provided context is
3063// canceled.
3064func (c *ProjectsConstraintsListCall) Context(ctx context.Context) *ProjectsConstraintsListCall {
3065	c.ctx_ = ctx
3066	return c
3067}
3068
3069// Header returns an http.Header that can be modified by the caller to
3070// add HTTP headers to the request.
3071func (c *ProjectsConstraintsListCall) Header() http.Header {
3072	if c.header_ == nil {
3073		c.header_ = make(http.Header)
3074	}
3075	return c.header_
3076}
3077
3078func (c *ProjectsConstraintsListCall) doRequest(alt string) (*http.Response, error) {
3079	reqHeaders := make(http.Header)
3080	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3081	for k, v := range c.header_ {
3082		reqHeaders[k] = v
3083	}
3084	reqHeaders.Set("User-Agent", c.s.userAgent())
3085	if c.ifNoneMatch_ != "" {
3086		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3087	}
3088	var body io.Reader = nil
3089	c.urlParams_.Set("alt", alt)
3090	c.urlParams_.Set("prettyPrint", "false")
3091	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/constraints")
3092	urls += "?" + c.urlParams_.Encode()
3093	req, err := http.NewRequest("GET", urls, body)
3094	if err != nil {
3095		return nil, err
3096	}
3097	req.Header = reqHeaders
3098	googleapi.Expand(req.URL, map[string]string{
3099		"parent": c.parent,
3100	})
3101	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3102}
3103
3104// Do executes the "orgpolicy.projects.constraints.list" call.
3105// Exactly one of *GoogleCloudOrgpolicyV2ListConstraintsResponse or
3106// error will be non-nil. Any non-2xx status code is an error. Response
3107// headers are in either
3108// *GoogleCloudOrgpolicyV2ListConstraintsResponse.ServerResponse.Header
3109// or (if a response was returned at all) in
3110// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3111// whether the returned error was because http.StatusNotModified was
3112// returned.
3113func (c *ProjectsConstraintsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListConstraintsResponse, error) {
3114	gensupport.SetOptions(c.urlParams_, opts...)
3115	res, err := c.doRequest("json")
3116	if res != nil && res.StatusCode == http.StatusNotModified {
3117		if res.Body != nil {
3118			res.Body.Close()
3119		}
3120		return nil, &googleapi.Error{
3121			Code:   res.StatusCode,
3122			Header: res.Header,
3123		}
3124	}
3125	if err != nil {
3126		return nil, err
3127	}
3128	defer googleapi.CloseBody(res)
3129	if err := googleapi.CheckResponse(res); err != nil {
3130		return nil, err
3131	}
3132	ret := &GoogleCloudOrgpolicyV2ListConstraintsResponse{
3133		ServerResponse: googleapi.ServerResponse{
3134			Header:         res.Header,
3135			HTTPStatusCode: res.StatusCode,
3136		},
3137	}
3138	target := &ret
3139	if err := gensupport.DecodeResponse(target, res); err != nil {
3140		return nil, err
3141	}
3142	return ret, nil
3143	// {
3144	//   "description": "Lists `Constraints` that could be applied on the specified resource.",
3145	//   "flatPath": "v2/projects/{projectsId}/constraints",
3146	//   "httpMethod": "GET",
3147	//   "id": "orgpolicy.projects.constraints.list",
3148	//   "parameterOrder": [
3149	//     "parent"
3150	//   ],
3151	//   "parameters": {
3152	//     "pageSize": {
3153	//       "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.",
3154	//       "format": "int32",
3155	//       "location": "query",
3156	//       "type": "integer"
3157	//     },
3158	//     "pageToken": {
3159	//       "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.",
3160	//       "location": "query",
3161	//       "type": "string"
3162	//     },
3163	//     "parent": {
3164	//       "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}`",
3165	//       "location": "path",
3166	//       "pattern": "^projects/[^/]+$",
3167	//       "required": true,
3168	//       "type": "string"
3169	//     }
3170	//   },
3171	//   "path": "v2/{+parent}/constraints",
3172	//   "response": {
3173	//     "$ref": "GoogleCloudOrgpolicyV2ListConstraintsResponse"
3174	//   },
3175	//   "scopes": [
3176	//     "https://www.googleapis.com/auth/cloud-platform"
3177	//   ]
3178	// }
3179
3180}
3181
3182// Pages invokes f for each page of results.
3183// A non-nil error returned from f will halt the iteration.
3184// The provided context supersedes any context provided to the Context method.
3185func (c *ProjectsConstraintsListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListConstraintsResponse) error) error {
3186	c.ctx_ = ctx
3187	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
3188	for {
3189		x, err := c.Do()
3190		if err != nil {
3191			return err
3192		}
3193		if err := f(x); err != nil {
3194			return err
3195		}
3196		if x.NextPageToken == "" {
3197			return nil
3198		}
3199		c.PageToken(x.NextPageToken)
3200	}
3201}
3202
3203// method id "orgpolicy.projects.policies.create":
3204
3205type ProjectsPoliciesCreateCall struct {
3206	s                            *Service
3207	parent                       string
3208	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
3209	urlParams_                   gensupport.URLParams
3210	ctx_                         context.Context
3211	header_                      http.Header
3212}
3213
3214// Create: Creates a Policy. Returns a `google.rpc.Status` with
3215// `google.rpc.Code.NOT_FOUND` if the constraint does not exist. Returns
3216// a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the
3217// policy already exists on the given Cloud resource.
3218//
3219// - parent: The Cloud resource that will parent the new Policy. Must be
3220//   in one of the following forms: * `projects/{project_number}` *
3221//   `projects/{project_id}` * `folders/{folder_id}` *
3222//   `organizations/{organization_id}`.
3223func (r *ProjectsPoliciesService) Create(parent string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *ProjectsPoliciesCreateCall {
3224	c := &ProjectsPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3225	c.parent = parent
3226	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
3227	return c
3228}
3229
3230// Fields allows partial responses to be retrieved. See
3231// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3232// for more information.
3233func (c *ProjectsPoliciesCreateCall) Fields(s ...googleapi.Field) *ProjectsPoliciesCreateCall {
3234	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3235	return c
3236}
3237
3238// Context sets the context to be used in this call's Do method. Any
3239// pending HTTP request will be aborted if the provided context is
3240// canceled.
3241func (c *ProjectsPoliciesCreateCall) Context(ctx context.Context) *ProjectsPoliciesCreateCall {
3242	c.ctx_ = ctx
3243	return c
3244}
3245
3246// Header returns an http.Header that can be modified by the caller to
3247// add HTTP headers to the request.
3248func (c *ProjectsPoliciesCreateCall) Header() http.Header {
3249	if c.header_ == nil {
3250		c.header_ = make(http.Header)
3251	}
3252	return c.header_
3253}
3254
3255func (c *ProjectsPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
3256	reqHeaders := make(http.Header)
3257	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3258	for k, v := range c.header_ {
3259		reqHeaders[k] = v
3260	}
3261	reqHeaders.Set("User-Agent", c.s.userAgent())
3262	var body io.Reader = nil
3263	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
3264	if err != nil {
3265		return nil, err
3266	}
3267	reqHeaders.Set("Content-Type", "application/json")
3268	c.urlParams_.Set("alt", alt)
3269	c.urlParams_.Set("prettyPrint", "false")
3270	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
3271	urls += "?" + c.urlParams_.Encode()
3272	req, err := http.NewRequest("POST", urls, body)
3273	if err != nil {
3274		return nil, err
3275	}
3276	req.Header = reqHeaders
3277	googleapi.Expand(req.URL, map[string]string{
3278		"parent": c.parent,
3279	})
3280	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3281}
3282
3283// Do executes the "orgpolicy.projects.policies.create" call.
3284// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
3285// non-nil. Any non-2xx status code is an error. Response headers are in
3286// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
3287// response was returned at all) in error.(*googleapi.Error).Header. Use
3288// googleapi.IsNotModified to check whether the returned error was
3289// because http.StatusNotModified was returned.
3290func (c *ProjectsPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3291	gensupport.SetOptions(c.urlParams_, opts...)
3292	res, err := c.doRequest("json")
3293	if res != nil && res.StatusCode == http.StatusNotModified {
3294		if res.Body != nil {
3295			res.Body.Close()
3296		}
3297		return nil, &googleapi.Error{
3298			Code:   res.StatusCode,
3299			Header: res.Header,
3300		}
3301	}
3302	if err != nil {
3303		return nil, err
3304	}
3305	defer googleapi.CloseBody(res)
3306	if err := googleapi.CheckResponse(res); err != nil {
3307		return nil, err
3308	}
3309	ret := &GoogleCloudOrgpolicyV2Policy{
3310		ServerResponse: googleapi.ServerResponse{
3311			Header:         res.Header,
3312			HTTPStatusCode: res.StatusCode,
3313		},
3314	}
3315	target := &ret
3316	if err := gensupport.DecodeResponse(target, res); err != nil {
3317		return nil, err
3318	}
3319	return ret, nil
3320	// {
3321	//   "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.",
3322	//   "flatPath": "v2/projects/{projectsId}/policies",
3323	//   "httpMethod": "POST",
3324	//   "id": "orgpolicy.projects.policies.create",
3325	//   "parameterOrder": [
3326	//     "parent"
3327	//   ],
3328	//   "parameters": {
3329	//     "parent": {
3330	//       "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}`",
3331	//       "location": "path",
3332	//       "pattern": "^projects/[^/]+$",
3333	//       "required": true,
3334	//       "type": "string"
3335	//     }
3336	//   },
3337	//   "path": "v2/{+parent}/policies",
3338	//   "request": {
3339	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
3340	//   },
3341	//   "response": {
3342	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
3343	//   },
3344	//   "scopes": [
3345	//     "https://www.googleapis.com/auth/cloud-platform"
3346	//   ]
3347	// }
3348
3349}
3350
3351// method id "orgpolicy.projects.policies.delete":
3352
3353type ProjectsPoliciesDeleteCall struct {
3354	s          *Service
3355	name       string
3356	urlParams_ gensupport.URLParams
3357	ctx_       context.Context
3358	header_    http.Header
3359}
3360
3361// Delete: Deletes a Policy. Returns a `google.rpc.Status` with
3362// `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not
3363// exist.
3364//
3365// - name: Name of the policy to delete. See `Policy` for naming rules.
3366func (r *ProjectsPoliciesService) Delete(name string) *ProjectsPoliciesDeleteCall {
3367	c := &ProjectsPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3368	c.name = name
3369	return c
3370}
3371
3372// Fields allows partial responses to be retrieved. See
3373// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3374// for more information.
3375func (c *ProjectsPoliciesDeleteCall) Fields(s ...googleapi.Field) *ProjectsPoliciesDeleteCall {
3376	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3377	return c
3378}
3379
3380// Context sets the context to be used in this call's Do method. Any
3381// pending HTTP request will be aborted if the provided context is
3382// canceled.
3383func (c *ProjectsPoliciesDeleteCall) Context(ctx context.Context) *ProjectsPoliciesDeleteCall {
3384	c.ctx_ = ctx
3385	return c
3386}
3387
3388// Header returns an http.Header that can be modified by the caller to
3389// add HTTP headers to the request.
3390func (c *ProjectsPoliciesDeleteCall) Header() http.Header {
3391	if c.header_ == nil {
3392		c.header_ = make(http.Header)
3393	}
3394	return c.header_
3395}
3396
3397func (c *ProjectsPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
3398	reqHeaders := make(http.Header)
3399	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3400	for k, v := range c.header_ {
3401		reqHeaders[k] = v
3402	}
3403	reqHeaders.Set("User-Agent", c.s.userAgent())
3404	var body io.Reader = nil
3405	c.urlParams_.Set("alt", alt)
3406	c.urlParams_.Set("prettyPrint", "false")
3407	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3408	urls += "?" + c.urlParams_.Encode()
3409	req, err := http.NewRequest("DELETE", urls, body)
3410	if err != nil {
3411		return nil, err
3412	}
3413	req.Header = reqHeaders
3414	googleapi.Expand(req.URL, map[string]string{
3415		"name": c.name,
3416	})
3417	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3418}
3419
3420// Do executes the "orgpolicy.projects.policies.delete" call.
3421// Exactly one of *GoogleProtobufEmpty or error will be non-nil. Any
3422// non-2xx status code is an error. Response headers are in either
3423// *GoogleProtobufEmpty.ServerResponse.Header or (if a response was
3424// returned at all) in error.(*googleapi.Error).Header. Use
3425// googleapi.IsNotModified to check whether the returned error was
3426// because http.StatusNotModified was returned.
3427func (c *ProjectsPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
3428	gensupport.SetOptions(c.urlParams_, opts...)
3429	res, err := c.doRequest("json")
3430	if res != nil && res.StatusCode == http.StatusNotModified {
3431		if res.Body != nil {
3432			res.Body.Close()
3433		}
3434		return nil, &googleapi.Error{
3435			Code:   res.StatusCode,
3436			Header: res.Header,
3437		}
3438	}
3439	if err != nil {
3440		return nil, err
3441	}
3442	defer googleapi.CloseBody(res)
3443	if err := googleapi.CheckResponse(res); err != nil {
3444		return nil, err
3445	}
3446	ret := &GoogleProtobufEmpty{
3447		ServerResponse: googleapi.ServerResponse{
3448			Header:         res.Header,
3449			HTTPStatusCode: res.StatusCode,
3450		},
3451	}
3452	target := &ret
3453	if err := gensupport.DecodeResponse(target, res); err != nil {
3454		return nil, err
3455	}
3456	return ret, nil
3457	// {
3458	//   "description": "Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the constraint or Org Policy does not exist.",
3459	//   "flatPath": "v2/projects/{projectsId}/policies/{policiesId}",
3460	//   "httpMethod": "DELETE",
3461	//   "id": "orgpolicy.projects.policies.delete",
3462	//   "parameterOrder": [
3463	//     "name"
3464	//   ],
3465	//   "parameters": {
3466	//     "name": {
3467	//       "description": "Required. Name of the policy to delete. See `Policy` for naming rules.",
3468	//       "location": "path",
3469	//       "pattern": "^projects/[^/]+/policies/[^/]+$",
3470	//       "required": true,
3471	//       "type": "string"
3472	//     }
3473	//   },
3474	//   "path": "v2/{+name}",
3475	//   "response": {
3476	//     "$ref": "GoogleProtobufEmpty"
3477	//   },
3478	//   "scopes": [
3479	//     "https://www.googleapis.com/auth/cloud-platform"
3480	//   ]
3481	// }
3482
3483}
3484
3485// method id "orgpolicy.projects.policies.get":
3486
3487type ProjectsPoliciesGetCall struct {
3488	s            *Service
3489	name         string
3490	urlParams_   gensupport.URLParams
3491	ifNoneMatch_ string
3492	ctx_         context.Context
3493	header_      http.Header
3494}
3495
3496// Get: Gets a `Policy` on a resource. If no `Policy` is set on the
3497// resource, NOT_FOUND is returned. The `etag` value can be used with
3498// `UpdatePolicy()` to update a `Policy` during read-modify-write.
3499//
3500// - name: Resource name of the policy. See `Policy` for naming
3501//   requirements.
3502func (r *ProjectsPoliciesService) Get(name string) *ProjectsPoliciesGetCall {
3503	c := &ProjectsPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3504	c.name = name
3505	return c
3506}
3507
3508// Fields allows partial responses to be retrieved. See
3509// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3510// for more information.
3511func (c *ProjectsPoliciesGetCall) Fields(s ...googleapi.Field) *ProjectsPoliciesGetCall {
3512	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3513	return c
3514}
3515
3516// IfNoneMatch sets the optional parameter which makes the operation
3517// fail if the object's ETag matches the given value. This is useful for
3518// getting updates only after the object has changed since the last
3519// request. Use googleapi.IsNotModified to check whether the response
3520// error from Do is the result of In-None-Match.
3521func (c *ProjectsPoliciesGetCall) IfNoneMatch(entityTag string) *ProjectsPoliciesGetCall {
3522	c.ifNoneMatch_ = entityTag
3523	return c
3524}
3525
3526// Context sets the context to be used in this call's Do method. Any
3527// pending HTTP request will be aborted if the provided context is
3528// canceled.
3529func (c *ProjectsPoliciesGetCall) Context(ctx context.Context) *ProjectsPoliciesGetCall {
3530	c.ctx_ = ctx
3531	return c
3532}
3533
3534// Header returns an http.Header that can be modified by the caller to
3535// add HTTP headers to the request.
3536func (c *ProjectsPoliciesGetCall) Header() http.Header {
3537	if c.header_ == nil {
3538		c.header_ = make(http.Header)
3539	}
3540	return c.header_
3541}
3542
3543func (c *ProjectsPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
3544	reqHeaders := make(http.Header)
3545	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3546	for k, v := range c.header_ {
3547		reqHeaders[k] = v
3548	}
3549	reqHeaders.Set("User-Agent", c.s.userAgent())
3550	if c.ifNoneMatch_ != "" {
3551		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3552	}
3553	var body io.Reader = nil
3554	c.urlParams_.Set("alt", alt)
3555	c.urlParams_.Set("prettyPrint", "false")
3556	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
3557	urls += "?" + c.urlParams_.Encode()
3558	req, err := http.NewRequest("GET", urls, body)
3559	if err != nil {
3560		return nil, err
3561	}
3562	req.Header = reqHeaders
3563	googleapi.Expand(req.URL, map[string]string{
3564		"name": c.name,
3565	})
3566	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3567}
3568
3569// Do executes the "orgpolicy.projects.policies.get" call.
3570// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
3571// non-nil. Any non-2xx status code is an error. Response headers are in
3572// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
3573// response was returned at all) in error.(*googleapi.Error).Header. Use
3574// googleapi.IsNotModified to check whether the returned error was
3575// because http.StatusNotModified was returned.
3576func (c *ProjectsPoliciesGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3577	gensupport.SetOptions(c.urlParams_, opts...)
3578	res, err := c.doRequest("json")
3579	if res != nil && res.StatusCode == http.StatusNotModified {
3580		if res.Body != nil {
3581			res.Body.Close()
3582		}
3583		return nil, &googleapi.Error{
3584			Code:   res.StatusCode,
3585			Header: res.Header,
3586		}
3587	}
3588	if err != nil {
3589		return nil, err
3590	}
3591	defer googleapi.CloseBody(res)
3592	if err := googleapi.CheckResponse(res); err != nil {
3593		return nil, err
3594	}
3595	ret := &GoogleCloudOrgpolicyV2Policy{
3596		ServerResponse: googleapi.ServerResponse{
3597			Header:         res.Header,
3598			HTTPStatusCode: res.StatusCode,
3599		},
3600	}
3601	target := &ret
3602	if err := gensupport.DecodeResponse(target, res); err != nil {
3603		return nil, err
3604	}
3605	return ret, nil
3606	// {
3607	//   "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.",
3608	//   "flatPath": "v2/projects/{projectsId}/policies/{policiesId}",
3609	//   "httpMethod": "GET",
3610	//   "id": "orgpolicy.projects.policies.get",
3611	//   "parameterOrder": [
3612	//     "name"
3613	//   ],
3614	//   "parameters": {
3615	//     "name": {
3616	//       "description": "Required. Resource name of the policy. See `Policy` for naming requirements.",
3617	//       "location": "path",
3618	//       "pattern": "^projects/[^/]+/policies/[^/]+$",
3619	//       "required": true,
3620	//       "type": "string"
3621	//     }
3622	//   },
3623	//   "path": "v2/{+name}",
3624	//   "response": {
3625	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
3626	//   },
3627	//   "scopes": [
3628	//     "https://www.googleapis.com/auth/cloud-platform"
3629	//   ]
3630	// }
3631
3632}
3633
3634// method id "orgpolicy.projects.policies.getEffectivePolicy":
3635
3636type ProjectsPoliciesGetEffectivePolicyCall struct {
3637	s            *Service
3638	name         string
3639	urlParams_   gensupport.URLParams
3640	ifNoneMatch_ string
3641	ctx_         context.Context
3642	header_      http.Header
3643}
3644
3645// GetEffectivePolicy: Gets the effective `Policy` on a resource. This
3646// is the result of merging `Policies` in the resource hierarchy and
3647// evaluating conditions. The returned `Policy` will not have an `etag`
3648// or `condition` set because it is a computed `Policy` across multiple
3649// resources. Subtrees of Resource Manager resource hierarchy with
3650// 'under:' prefix will not be expanded.
3651//
3652// - name: The effective policy to compute. See `Policy` for naming
3653//   rules.
3654func (r *ProjectsPoliciesService) GetEffectivePolicy(name string) *ProjectsPoliciesGetEffectivePolicyCall {
3655	c := &ProjectsPoliciesGetEffectivePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3656	c.name = name
3657	return c
3658}
3659
3660// Fields allows partial responses to be retrieved. See
3661// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3662// for more information.
3663func (c *ProjectsPoliciesGetEffectivePolicyCall) Fields(s ...googleapi.Field) *ProjectsPoliciesGetEffectivePolicyCall {
3664	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3665	return c
3666}
3667
3668// IfNoneMatch sets the optional parameter which makes the operation
3669// fail if the object's ETag matches the given value. This is useful for
3670// getting updates only after the object has changed since the last
3671// request. Use googleapi.IsNotModified to check whether the response
3672// error from Do is the result of In-None-Match.
3673func (c *ProjectsPoliciesGetEffectivePolicyCall) IfNoneMatch(entityTag string) *ProjectsPoliciesGetEffectivePolicyCall {
3674	c.ifNoneMatch_ = entityTag
3675	return c
3676}
3677
3678// Context sets the context to be used in this call's Do method. Any
3679// pending HTTP request will be aborted if the provided context is
3680// canceled.
3681func (c *ProjectsPoliciesGetEffectivePolicyCall) Context(ctx context.Context) *ProjectsPoliciesGetEffectivePolicyCall {
3682	c.ctx_ = ctx
3683	return c
3684}
3685
3686// Header returns an http.Header that can be modified by the caller to
3687// add HTTP headers to the request.
3688func (c *ProjectsPoliciesGetEffectivePolicyCall) Header() http.Header {
3689	if c.header_ == nil {
3690		c.header_ = make(http.Header)
3691	}
3692	return c.header_
3693}
3694
3695func (c *ProjectsPoliciesGetEffectivePolicyCall) doRequest(alt string) (*http.Response, error) {
3696	reqHeaders := make(http.Header)
3697	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3698	for k, v := range c.header_ {
3699		reqHeaders[k] = v
3700	}
3701	reqHeaders.Set("User-Agent", c.s.userAgent())
3702	if c.ifNoneMatch_ != "" {
3703		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3704	}
3705	var body io.Reader = nil
3706	c.urlParams_.Set("alt", alt)
3707	c.urlParams_.Set("prettyPrint", "false")
3708	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:getEffectivePolicy")
3709	urls += "?" + c.urlParams_.Encode()
3710	req, err := http.NewRequest("GET", urls, body)
3711	if err != nil {
3712		return nil, err
3713	}
3714	req.Header = reqHeaders
3715	googleapi.Expand(req.URL, map[string]string{
3716		"name": c.name,
3717	})
3718	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3719}
3720
3721// Do executes the "orgpolicy.projects.policies.getEffectivePolicy" call.
3722// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
3723// non-nil. Any non-2xx status code is an error. Response headers are in
3724// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
3725// response was returned at all) in error.(*googleapi.Error).Header. Use
3726// googleapi.IsNotModified to check whether the returned error was
3727// because http.StatusNotModified was returned.
3728func (c *ProjectsPoliciesGetEffectivePolicyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
3729	gensupport.SetOptions(c.urlParams_, opts...)
3730	res, err := c.doRequest("json")
3731	if res != nil && res.StatusCode == http.StatusNotModified {
3732		if res.Body != nil {
3733			res.Body.Close()
3734		}
3735		return nil, &googleapi.Error{
3736			Code:   res.StatusCode,
3737			Header: res.Header,
3738		}
3739	}
3740	if err != nil {
3741		return nil, err
3742	}
3743	defer googleapi.CloseBody(res)
3744	if err := googleapi.CheckResponse(res); err != nil {
3745		return nil, err
3746	}
3747	ret := &GoogleCloudOrgpolicyV2Policy{
3748		ServerResponse: googleapi.ServerResponse{
3749			Header:         res.Header,
3750			HTTPStatusCode: res.StatusCode,
3751		},
3752	}
3753	target := &ret
3754	if err := gensupport.DecodeResponse(target, res); err != nil {
3755		return nil, err
3756	}
3757	return ret, nil
3758	// {
3759	//   "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.",
3760	//   "flatPath": "v2/projects/{projectsId}/policies/{policiesId}:getEffectivePolicy",
3761	//   "httpMethod": "GET",
3762	//   "id": "orgpolicy.projects.policies.getEffectivePolicy",
3763	//   "parameterOrder": [
3764	//     "name"
3765	//   ],
3766	//   "parameters": {
3767	//     "name": {
3768	//       "description": "Required. The effective policy to compute. See `Policy` for naming rules.",
3769	//       "location": "path",
3770	//       "pattern": "^projects/[^/]+/policies/[^/]+$",
3771	//       "required": true,
3772	//       "type": "string"
3773	//     }
3774	//   },
3775	//   "path": "v2/{+name}:getEffectivePolicy",
3776	//   "response": {
3777	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
3778	//   },
3779	//   "scopes": [
3780	//     "https://www.googleapis.com/auth/cloud-platform"
3781	//   ]
3782	// }
3783
3784}
3785
3786// method id "orgpolicy.projects.policies.list":
3787
3788type ProjectsPoliciesListCall struct {
3789	s            *Service
3790	parent       string
3791	urlParams_   gensupport.URLParams
3792	ifNoneMatch_ string
3793	ctx_         context.Context
3794	header_      http.Header
3795}
3796
3797// List: Retrieves all of the `Policies` that exist on a particular
3798// resource.
3799//
3800// - parent: The target Cloud resource that parents the set of
3801//   constraints and policies that will be returned from this call. Must
3802//   be in one of the following forms: * `projects/{project_number}` *
3803//   `projects/{project_id}` * `folders/{folder_id}` *
3804//   `organizations/{organization_id}`.
3805func (r *ProjectsPoliciesService) List(parent string) *ProjectsPoliciesListCall {
3806	c := &ProjectsPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3807	c.parent = parent
3808	return c
3809}
3810
3811// PageSize sets the optional parameter "pageSize": Size of the pages to
3812// be returned. This is currently unsupported and will be ignored. The
3813// server may at any point start using this field to limit page size.
3814func (c *ProjectsPoliciesListCall) PageSize(pageSize int64) *ProjectsPoliciesListCall {
3815	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3816	return c
3817}
3818
3819// PageToken sets the optional parameter "pageToken": Page token used to
3820// retrieve the next page. This is currently unsupported and will be
3821// ignored. The server may at any point start using this field.
3822func (c *ProjectsPoliciesListCall) PageToken(pageToken string) *ProjectsPoliciesListCall {
3823	c.urlParams_.Set("pageToken", pageToken)
3824	return c
3825}
3826
3827// Fields allows partial responses to be retrieved. See
3828// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3829// for more information.
3830func (c *ProjectsPoliciesListCall) Fields(s ...googleapi.Field) *ProjectsPoliciesListCall {
3831	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3832	return c
3833}
3834
3835// IfNoneMatch sets the optional parameter which makes the operation
3836// fail if the object's ETag matches the given value. This is useful for
3837// getting updates only after the object has changed since the last
3838// request. Use googleapi.IsNotModified to check whether the response
3839// error from Do is the result of In-None-Match.
3840func (c *ProjectsPoliciesListCall) IfNoneMatch(entityTag string) *ProjectsPoliciesListCall {
3841	c.ifNoneMatch_ = entityTag
3842	return c
3843}
3844
3845// Context sets the context to be used in this call's Do method. Any
3846// pending HTTP request will be aborted if the provided context is
3847// canceled.
3848func (c *ProjectsPoliciesListCall) Context(ctx context.Context) *ProjectsPoliciesListCall {
3849	c.ctx_ = ctx
3850	return c
3851}
3852
3853// Header returns an http.Header that can be modified by the caller to
3854// add HTTP headers to the request.
3855func (c *ProjectsPoliciesListCall) Header() http.Header {
3856	if c.header_ == nil {
3857		c.header_ = make(http.Header)
3858	}
3859	return c.header_
3860}
3861
3862func (c *ProjectsPoliciesListCall) doRequest(alt string) (*http.Response, error) {
3863	reqHeaders := make(http.Header)
3864	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
3865	for k, v := range c.header_ {
3866		reqHeaders[k] = v
3867	}
3868	reqHeaders.Set("User-Agent", c.s.userAgent())
3869	if c.ifNoneMatch_ != "" {
3870		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3871	}
3872	var body io.Reader = nil
3873	c.urlParams_.Set("alt", alt)
3874	c.urlParams_.Set("prettyPrint", "false")
3875	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/policies")
3876	urls += "?" + c.urlParams_.Encode()
3877	req, err := http.NewRequest("GET", urls, body)
3878	if err != nil {
3879		return nil, err
3880	}
3881	req.Header = reqHeaders
3882	googleapi.Expand(req.URL, map[string]string{
3883		"parent": c.parent,
3884	})
3885	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3886}
3887
3888// Do executes the "orgpolicy.projects.policies.list" call.
3889// Exactly one of *GoogleCloudOrgpolicyV2ListPoliciesResponse or error
3890// will be non-nil. Any non-2xx status code is an error. Response
3891// headers are in either
3892// *GoogleCloudOrgpolicyV2ListPoliciesResponse.ServerResponse.Header or
3893// (if a response was returned at all) in
3894// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3895// whether the returned error was because http.StatusNotModified was
3896// returned.
3897func (c *ProjectsPoliciesListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2ListPoliciesResponse, error) {
3898	gensupport.SetOptions(c.urlParams_, opts...)
3899	res, err := c.doRequest("json")
3900	if res != nil && res.StatusCode == http.StatusNotModified {
3901		if res.Body != nil {
3902			res.Body.Close()
3903		}
3904		return nil, &googleapi.Error{
3905			Code:   res.StatusCode,
3906			Header: res.Header,
3907		}
3908	}
3909	if err != nil {
3910		return nil, err
3911	}
3912	defer googleapi.CloseBody(res)
3913	if err := googleapi.CheckResponse(res); err != nil {
3914		return nil, err
3915	}
3916	ret := &GoogleCloudOrgpolicyV2ListPoliciesResponse{
3917		ServerResponse: googleapi.ServerResponse{
3918			Header:         res.Header,
3919			HTTPStatusCode: res.StatusCode,
3920		},
3921	}
3922	target := &ret
3923	if err := gensupport.DecodeResponse(target, res); err != nil {
3924		return nil, err
3925	}
3926	return ret, nil
3927	// {
3928	//   "description": "Retrieves all of the `Policies` that exist on a particular resource.",
3929	//   "flatPath": "v2/projects/{projectsId}/policies",
3930	//   "httpMethod": "GET",
3931	//   "id": "orgpolicy.projects.policies.list",
3932	//   "parameterOrder": [
3933	//     "parent"
3934	//   ],
3935	//   "parameters": {
3936	//     "pageSize": {
3937	//       "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.",
3938	//       "format": "int32",
3939	//       "location": "query",
3940	//       "type": "integer"
3941	//     },
3942	//     "pageToken": {
3943	//       "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.",
3944	//       "location": "query",
3945	//       "type": "string"
3946	//     },
3947	//     "parent": {
3948	//       "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}`",
3949	//       "location": "path",
3950	//       "pattern": "^projects/[^/]+$",
3951	//       "required": true,
3952	//       "type": "string"
3953	//     }
3954	//   },
3955	//   "path": "v2/{+parent}/policies",
3956	//   "response": {
3957	//     "$ref": "GoogleCloudOrgpolicyV2ListPoliciesResponse"
3958	//   },
3959	//   "scopes": [
3960	//     "https://www.googleapis.com/auth/cloud-platform"
3961	//   ]
3962	// }
3963
3964}
3965
3966// Pages invokes f for each page of results.
3967// A non-nil error returned from f will halt the iteration.
3968// The provided context supersedes any context provided to the Context method.
3969func (c *ProjectsPoliciesListCall) Pages(ctx context.Context, f func(*GoogleCloudOrgpolicyV2ListPoliciesResponse) error) error {
3970	c.ctx_ = ctx
3971	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
3972	for {
3973		x, err := c.Do()
3974		if err != nil {
3975			return err
3976		}
3977		if err := f(x); err != nil {
3978			return err
3979		}
3980		if x.NextPageToken == "" {
3981			return nil
3982		}
3983		c.PageToken(x.NextPageToken)
3984	}
3985}
3986
3987// method id "orgpolicy.projects.policies.patch":
3988
3989type ProjectsPoliciesPatchCall struct {
3990	s                            *Service
3991	name                         string
3992	googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy
3993	urlParams_                   gensupport.URLParams
3994	ctx_                         context.Context
3995	header_                      http.Header
3996}
3997
3998// Patch: Updates a Policy. Returns a `google.rpc.Status` with
3999// `google.rpc.Code.NOT_FOUND` if the constraint or the policy do not
4000// exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED`
4001// if the etag supplied in the request does not match the persisted etag
4002// of the policy Note: the supplied policy will perform a full overwrite
4003// of all fields.
4004//
4005// - name: Immutable. The resource name of the Policy. Must be one of
4006//   the following forms, where constraint_name is the name of the
4007//   constraint which this Policy configures: *
4008//   `projects/{project_number}/policies/{constraint_name}` *
4009//   `folders/{folder_id}/policies/{constraint_name}` *
4010//   `organizations/{organization_id}/policies/{constraint_name}` For
4011//   example, "projects/123/policies/compute.disableSerialPortAccess".
4012//   Note: `projects/{project_id}/policies/{constraint_name}` is also an
4013//   acceptable name for API requests, but responses will return the
4014//   name using the equivalent project number.
4015func (r *ProjectsPoliciesService) Patch(name string, googlecloudorgpolicyv2policy *GoogleCloudOrgpolicyV2Policy) *ProjectsPoliciesPatchCall {
4016	c := &ProjectsPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4017	c.name = name
4018	c.googlecloudorgpolicyv2policy = googlecloudorgpolicyv2policy
4019	return c
4020}
4021
4022// Fields allows partial responses to be retrieved. See
4023// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4024// for more information.
4025func (c *ProjectsPoliciesPatchCall) Fields(s ...googleapi.Field) *ProjectsPoliciesPatchCall {
4026	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4027	return c
4028}
4029
4030// Context sets the context to be used in this call's Do method. Any
4031// pending HTTP request will be aborted if the provided context is
4032// canceled.
4033func (c *ProjectsPoliciesPatchCall) Context(ctx context.Context) *ProjectsPoliciesPatchCall {
4034	c.ctx_ = ctx
4035	return c
4036}
4037
4038// Header returns an http.Header that can be modified by the caller to
4039// add HTTP headers to the request.
4040func (c *ProjectsPoliciesPatchCall) Header() http.Header {
4041	if c.header_ == nil {
4042		c.header_ = make(http.Header)
4043	}
4044	return c.header_
4045}
4046
4047func (c *ProjectsPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
4048	reqHeaders := make(http.Header)
4049	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410")
4050	for k, v := range c.header_ {
4051		reqHeaders[k] = v
4052	}
4053	reqHeaders.Set("User-Agent", c.s.userAgent())
4054	var body io.Reader = nil
4055	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudorgpolicyv2policy)
4056	if err != nil {
4057		return nil, err
4058	}
4059	reqHeaders.Set("Content-Type", "application/json")
4060	c.urlParams_.Set("alt", alt)
4061	c.urlParams_.Set("prettyPrint", "false")
4062	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
4063	urls += "?" + c.urlParams_.Encode()
4064	req, err := http.NewRequest("PATCH", urls, body)
4065	if err != nil {
4066		return nil, err
4067	}
4068	req.Header = reqHeaders
4069	googleapi.Expand(req.URL, map[string]string{
4070		"name": c.name,
4071	})
4072	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4073}
4074
4075// Do executes the "orgpolicy.projects.policies.patch" call.
4076// Exactly one of *GoogleCloudOrgpolicyV2Policy or error will be
4077// non-nil. Any non-2xx status code is an error. Response headers are in
4078// either *GoogleCloudOrgpolicyV2Policy.ServerResponse.Header or (if a
4079// response was returned at all) in error.(*googleapi.Error).Header. Use
4080// googleapi.IsNotModified to check whether the returned error was
4081// because http.StatusNotModified was returned.
4082func (c *ProjectsPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOrgpolicyV2Policy, error) {
4083	gensupport.SetOptions(c.urlParams_, opts...)
4084	res, err := c.doRequest("json")
4085	if res != nil && res.StatusCode == http.StatusNotModified {
4086		if res.Body != nil {
4087			res.Body.Close()
4088		}
4089		return nil, &googleapi.Error{
4090			Code:   res.StatusCode,
4091			Header: res.Header,
4092		}
4093	}
4094	if err != nil {
4095		return nil, err
4096	}
4097	defer googleapi.CloseBody(res)
4098	if err := googleapi.CheckResponse(res); err != nil {
4099		return nil, err
4100	}
4101	ret := &GoogleCloudOrgpolicyV2Policy{
4102		ServerResponse: googleapi.ServerResponse{
4103			Header:         res.Header,
4104			HTTPStatusCode: res.StatusCode,
4105		},
4106	}
4107	target := &ret
4108	if err := gensupport.DecodeResponse(target, res); err != nil {
4109		return nil, err
4110	}
4111	return ret, nil
4112	// {
4113	//   "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.",
4114	//   "flatPath": "v2/projects/{projectsId}/policies/{policiesId}",
4115	//   "httpMethod": "PATCH",
4116	//   "id": "orgpolicy.projects.policies.patch",
4117	//   "parameterOrder": [
4118	//     "name"
4119	//   ],
4120	//   "parameters": {
4121	//     "name": {
4122	//       "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.",
4123	//       "location": "path",
4124	//       "pattern": "^projects/[^/]+/policies/[^/]+$",
4125	//       "required": true,
4126	//       "type": "string"
4127	//     }
4128	//   },
4129	//   "path": "v2/{+name}",
4130	//   "request": {
4131	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
4132	//   },
4133	//   "response": {
4134	//     "$ref": "GoogleCloudOrgpolicyV2Policy"
4135	//   },
4136	//   "scopes": [
4137	//     "https://www.googleapis.com/auth/cloud-platform"
4138	//   ]
4139	// }
4140
4141}
4142