Resource Settings V1 API - Class Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client (v0.2.0)

Reference documentation and code samples for the Resource Settings V1 API class Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.

Client for the ResourceSettingsService service.

An interface to interact with resource settings and setting values throughout the resource hierarchy.

Services may surface a number of settings for users to control how their resources behave. Values of settings applied on a given Cloud resource are evaluated hierarchically and inherited by all descendants of that resource.

For all requests, returns a google.rpc.Status with google.rpc.Code.PERMISSION_DENIED if the IAM check fails or the parent resource is not in a Cloud Organization. For all requests, returns a google.rpc.Status with google.rpc.Code.INVALID_ARGUMENT if the request is malformed.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the ResourceSettingsService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ResourceSettingsService clients
::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the ResourceSettingsService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#get_setting

def get_setting(request, options = nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
def get_setting(name: nil, view: nil) -> ::Google::Cloud::ResourceSettings::V1::Setting

Gets a setting.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the setting does not exist.

Overloads
def get_setting(request, options = nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
Pass arguments to get_setting via a request object, either of type GetSettingRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceSettings::V1::GetSettingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_setting(name: nil, view: nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
Pass arguments to get_setting via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_settings/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceSettings::V1::GetSettingRequest.new

# Call the get_setting method.
result = client.get_setting request

# The returned object is of type Google::Cloud::ResourceSettings::V1::Setting.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new ResourceSettingsService client object.

Yields
  • (config) — Configure the ResourceSettingsService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new do |config|
  config.timeout = 10.0
end

#list_settings

def list_settings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>
def list_settings(parent: nil, page_size: nil, page_token: nil, view: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>

Lists all the settings that are available on the Cloud resource parent.

Overloads
def list_settings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>
Pass arguments to list_settings via a request object, either of type ListSettingsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceSettings::V1::ListSettingsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_settings(parent: nil, page_size: nil, page_token: nil, view: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::ResourceSettings::V1::Setting>
Pass arguments to list_settings via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) —

    Required. The Cloud resource that parents the setting. Must be in one of the following forms:

    • projects/{project_number}
    • projects/{project_id}
    • folders/{folder_id}
    • organizations/{organization_id}
  • page_size (::Integer) — Unused. The size of the page to be returned.
  • page_token (::String) — Unused. A page token used to retrieve the next page.
  • view (::Google::Cloud::ResourceSettings::V1::SettingView) — The SettingView for this request.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_settings/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceSettings::V1::ListSettingsRequest.new

# Call the list_settings method.
result = client.list_settings request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::ResourceSettings::V1::Setting.
  p response
end

#update_setting

def update_setting(request, options = nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
def update_setting(setting: nil) -> ::Google::Cloud::ResourceSettings::V1::Setting

Updates a setting.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the setting does not exist. Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if the setting is flagged as read only. 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 setting value.

On success, the response will contain only name, local_value and etag. The metadata and effective_value cannot be updated through this API.

Note: the supplied setting will perform a full overwrite of the local_value field.

Overloads
def update_setting(request, options = nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
Pass arguments to update_setting via a request object, either of type UpdateSettingRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceSettings::V1::UpdateSettingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_setting(setting: nil) -> ::Google::Cloud::ResourceSettings::V1::Setting
Pass arguments to update_setting via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/resource_settings/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ResourceSettings::V1::ResourceSettingsService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ResourceSettings::V1::UpdateSettingRequest.new

# Call the update_setting method.
result = client.update_setting request

# The returned object is of type Google::Cloud::ResourceSettings::V1::Setting.
p result