...

Source file src/google.golang.org/api/orgpolicy/v2/orgpolicy-gen.go

Documentation: google.golang.org/api/orgpolicy/v2

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

View as plain text