class Google::Apis::OrgpolicyV2::OrgPolicyAPIService

Organization Policy API

The Org Policy API allows users to configure governance ruleson their GCP

resources across the Cloud Resource Hierarchy.

@example

require 'google/apis/orgpolicy_v2'

Orgpolicy = Google::Apis::OrgpolicyV2 # Alias the module
service = Orgpolicy::OrgPolicyAPIService.new

@see cloud.google.com/orgpolicy/docs/reference/rest/index.html

Attributes

key[RW]

@return [String]

API key. Your API key identifies your project and provides you with API access,
quota, and reports. Required unless you provide an OAuth 2.0 token.
quota_user[RW]

@return [String]

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/google/apis/orgpolicy_v2/service.rb, line 46
def initialize
  super('https://orgpolicy.googleapis.com/', '',
        client_name: 'google-apis-orgpolicy_v2',
        client_version: Google::Apis::OrgpolicyV2::GEM_VERSION)
  @batch_path = 'batch'
end

Public Instance Methods

create_folder_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the given Cloud resource. @param [String] parent

Required. The Cloud resource that will parent the new Policy. Must be in one
of the following forms: * `projects/`project_number`` * `projects/`project_id``
* `folders/`folder_id`` * `organizations/`organization_id``

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 119
def create_folder_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v2/{+parent}/policies', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
create_organization_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the given Cloud resource. @param [String] parent

Required. The Cloud resource that will parent the new Policy. Must be in one
of the following forms: * `projects/`project_number`` * `projects/`project_id``
* `folders/`folder_id`` * `organizations/`organization_id``

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 379
def create_organization_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v2/{+parent}/policies', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
create_project_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the given Cloud resource. @param [String] parent

Required. The Cloud resource that will parent the new Policy. Must be in one
of the following forms: * `projects/`project_number`` * `projects/`project_id``
* `folders/`folder_id`` * `organizations/`organization_id``

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 639
def create_project_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v2/{+parent}/policies', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
delete_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or Org Policy does not exist. @param [String] name

Required. Name of the policy to delete. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 152
def delete_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
delete_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or Org Policy does not exist. @param [String] name

Required. Name of the policy to delete. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 412
def delete_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
delete_project_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or Org Policy does not exist. @param [String] name

Required. Name of the policy to delete. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 672
def delete_project_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets a `Policy` on a resource. If no `Policy` is set on the resource, NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to update a `Policy` during read-modify-write. @param [String] name

Required. Resource name of the policy. See `Policy` for naming requirements.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 184
def get_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_folder_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets the effective `Policy` on a resource. This is the result of merging ` Policies` in the resource hierarchy and evaluating conditions. The returned ` Policy` will not have an `etag` or `condition` set because it is a computed ` Policy` across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded. @param [String] name

Required. The effective policy to compute. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 218
def get_folder_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets a `Policy` on a resource. If no `Policy` is set on the resource, NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to update a `Policy` during read-modify-write. @param [String] name

Required. Resource name of the policy. See `Policy` for naming requirements.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 444
def get_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_organization_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets the effective `Policy` on a resource. This is the result of merging ` Policies` in the resource hierarchy and evaluating conditions. The returned ` Policy` will not have an `etag` or `condition` set because it is a computed ` Policy` across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded. @param [String] name

Required. The effective policy to compute. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 478
def get_organization_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_project_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets a `Policy` on a resource. If no `Policy` is set on the resource, NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to update a `Policy` during read-modify-write. @param [String] name

Required. Resource name of the policy. See `Policy` for naming requirements.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 704
def get_project_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
get_project_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Gets the effective `Policy` on a resource. This is the result of merging ` Policies` in the resource hierarchy and evaluating conditions. The returned ` Policy` will not have an `etag` or `condition` set because it is a computed ` Policy` across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix will not be expanded. @param [String] name

Required. The effective policy to compute. See `Policy` for naming rules.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 738
def get_project_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_folder_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Lists `Constraints` that could be applied on the specified resource. @param [String] parent

Required. The Cloud resource that parents the constraint. Must be in one of
the following forms: * `projects/`project_number`` * `projects/`project_id`` *
`folders/`folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 81
def list_folder_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_folder_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Retrieves all of the `Policies` that exist on a particular resource. @param [String] parent

Required. The target Cloud resource that parents the set of constraints and
policies that will be returned from this call. Must be in one of the following
forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 257
def list_folder_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/policies', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_organization_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Lists `Constraints` that could be applied on the specified resource. @param [String] parent

Required. The Cloud resource that parents the constraint. Must be in one of
the following forms: * `projects/`project_number`` * `projects/`project_id`` *
`folders/`folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 341
def list_organization_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_organization_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Retrieves all of the `Policies` that exist on a particular resource. @param [String] parent

Required. The target Cloud resource that parents the set of constraints and
policies that will be returned from this call. Must be in one of the following
forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 517
def list_organization_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/policies', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_project_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Lists `Constraints` that could be applied on the specified resource. @param [String] parent

Required. The Cloud resource that parents the constraint. Must be in one of
the following forms: * `projects/`project_number`` * `projects/`project_id`` *
`folders/`folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 601
def list_project_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
list_project_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Retrieves all of the `Policies` that exist on a particular resource. @param [String] parent

Required. The target Cloud resource that parents the set of constraints and
policies that will be returned from this call. Must be in one of the following
forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
folder_id`` * `organizations/`organization_id``

@param [Fixnum] page_size

Size of the pages to be returned. This is currently unsupported and will be
ignored. The server may at any point start using this field to limit page size.

@param [String] page_token

Page token used to retrieve the next page. This is currently unsupported and
will be ignored. The server may at any point start using this field.

@param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 777
def list_project_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/policies', options)
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
patch_folder_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc. Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the policy Note: the supplied policy will perform a full overwrite of all fields. @param [String] name

Immutable. The resource name of the Policy. Must be one of the following forms,
where constraint_name is the name of the constraint which this Policy
configures: * `projects/`project_number`/policies/`constraint_name`` * `
folders/`folder_id`/policies/`constraint_name`` * `organizations/`
organization_id`/policies/`constraint_name`` For example, "projects/123/
policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
policies/`constraint_name`` is also an acceptable name for API requests, but
responses will return the name using the equivalent project number.

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 301
def patch_folder_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v2/{+name}', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
patch_organization_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc. Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the policy Note: the supplied policy will perform a full overwrite of all fields. @param [String] name

Immutable. The resource name of the Policy. Must be one of the following forms,
where constraint_name is the name of the constraint which this Policy
configures: * `projects/`project_number`/policies/`constraint_name`` * `
folders/`folder_id`/policies/`constraint_name`` * `organizations/`
organization_id`/policies/`constraint_name`` For example, "projects/123/
policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
policies/`constraint_name`` is also an acceptable name for API requests, but
responses will return the name using the equivalent project number.

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 561
def patch_organization_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v2/{+name}', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end
patch_project_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block) click to toggle source

Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code. NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc. Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the policy Note: the supplied policy will perform a full overwrite of all fields. @param [String] name

Immutable. The resource name of the Policy. Must be one of the following forms,
where constraint_name is the name of the constraint which this Policy
configures: * `projects/`project_number`/policies/`constraint_name`` * `
folders/`folder_id`/policies/`constraint_name`` * `organizations/`
organization_id`/policies/`constraint_name`` For example, "projects/123/
policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
policies/`constraint_name`` is also an acceptable name for API requests, but
responses will return the name using the equivalent project number.

@param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object @param [String] fields

Selector specifying which fields to include in a partial response.

@param [String] quota_user

Available to use for quota purposes for server-side applications. Can be any
arbitrary string assigned to a user, but should not exceed 40 characters.

@param [Google::Apis::RequestOptions] options

Request-specific options

@yield [result, err] Result & error if block supplied @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object @yieldparam err [StandardError] error object if request failed

@return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]

@raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification @raise [Google::Apis::AuthorizationError] Authorization is required

# File lib/google/apis/orgpolicy_v2/service.rb, line 821
def patch_project_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v2/{+name}', options)
  command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.request_object = google_cloud_orgpolicy_v2_policy_object
  command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
  command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

Protected Instance Methods

apply_command_defaults(command) click to toggle source
# File lib/google/apis/orgpolicy_v2/service.rb, line 835
def apply_command_defaults(command)
  command.query['key'] = key unless key.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
end