Class Google::Cloud::OsConfig::V1::OsConfigService::Client (v0.9.1)

Client for the OsConfigService service.

OS Config API

The OS Config service is a server-side component that you can use to manage package installations and patch jobs for virtual machine instances.

Inherits

  • Object

Methods

.configure

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

Configure the OsConfigService 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 OsConfigService clients
::Google::Cloud::OsConfig::V1::OsConfigService::Client.configure do |config|
  config.timeout = 10.0
end

#cancel_patch_job

def cancel_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
def cancel_patch_job(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob

Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted.

Overloads
def cancel_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to cancel_patch_job via a request object, either of type CancelPatchJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::CancelPatchJobRequest, ::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 cancel_patch_job(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to cancel_patch_job 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
  • name (::String) — Required. Name of the patch in the form projects/*/patchJobs/*
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/os_config/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::PatchJob.
p result

#configure

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

Configure the OsConfigService 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

#create_patch_deployment

def create_patch_deployment(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
def create_patch_deployment(parent: nil, patch_deployment_id: nil, patch_deployment: nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment

Create an OS Config patch deployment.

Overloads
def create_patch_deployment(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
Pass arguments to create_patch_deployment via a request object, either of type CreatePatchDeploymentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::CreatePatchDeploymentRequest, ::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 create_patch_deployment(parent: nil, patch_deployment_id: nil, patch_deployment: nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
Pass arguments to create_patch_deployment 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 project to apply this patch deployment to in the form projects/*.
  • patch_deployment_id (::String) —

    Required. A name for the patch deployment in the project. When creating a name the following rules apply:

    • Must contain only lowercase letters, numbers, and hyphens.
    • Must start with a letter.
    • Must be between 1-63 characters.
    • Must end with a number or a letter.
    • Must be unique within the project.
  • patch_deployment (::Google::Cloud::OsConfig::V1::PatchDeployment, ::Hash) — Required. The patch deployment to create.
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/os_config/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::PatchDeployment.
p result

#delete_patch_deployment

def delete_patch_deployment(request, options = nil) -> ::Google::Protobuf::Empty
def delete_patch_deployment(name: nil) -> ::Google::Protobuf::Empty

Delete an OS Config patch deployment.

Overloads
def delete_patch_deployment(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_patch_deployment via a request object, either of type DeletePatchDeploymentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::DeletePatchDeploymentRequest, ::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 delete_patch_deployment(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_patch_deployment 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
  • name (::String) — Required. The resource name of the patch deployment in the form projects/*/patchDeployments/*.
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/os_config/v1"

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

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

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

# The returned object is of type Google::Protobuf::Empty.
p result

#execute_patch_job

def execute_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
def execute_patch_job(parent: nil, description: nil, instance_filter: nil, patch_config: nil, duration: nil, dry_run: nil, display_name: nil, rollout: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob

Patch VM instances by creating and running a patch job.

Overloads
def execute_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to execute_patch_job via a request object, either of type ExecutePatchJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::ExecutePatchJobRequest, ::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 execute_patch_job(parent: nil, description: nil, instance_filter: nil, patch_config: nil, duration: nil, dry_run: nil, display_name: nil, rollout: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to execute_patch_job 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 project in which to run this patch in the form projects/*
  • description (::String) — Description of the patch job. Length of the description is limited to 1024 characters.
  • instance_filter (::Google::Cloud::OsConfig::V1::PatchInstanceFilter, ::Hash) — Required. Instances to patch, either explicitly or filtered by some criteria such as zone or labels.
  • patch_config (::Google::Cloud::OsConfig::V1::PatchConfig, ::Hash) — Patch configuration being applied. If omitted, instances are patched using the default configurations.
  • duration (::Google::Protobuf::Duration, ::Hash) — Duration of the patch job. After the duration ends, the patch job times out.
  • dry_run (::Boolean) — If this patch is a dry-run only, instances are contacted but will do nothing.
  • display_name (::String) — Display name for this patch job. This does not have to be unique.
  • rollout (::Google::Cloud::OsConfig::V1::PatchRollout, ::Hash) — Rollout strategy of the patch job.
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/os_config/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::PatchJob.
p result

#get_patch_deployment

def get_patch_deployment(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
def get_patch_deployment(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment

Get an OS Config patch deployment.

Overloads
def get_patch_deployment(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
Pass arguments to get_patch_deployment via a request object, either of type GetPatchDeploymentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::GetPatchDeploymentRequest, ::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_patch_deployment(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchDeployment
Pass arguments to get_patch_deployment 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
  • name (::String) — Required. The resource name of the patch deployment in the form projects/*/patchDeployments/*.
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/os_config/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::PatchDeployment.
p result

#get_patch_job

def get_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
def get_patch_job(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob

Get the patch job. This can be used to track the progress of an ongoing patch job or review the details of completed jobs.

Overloads
def get_patch_job(request, options = nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to get_patch_job via a request object, either of type GetPatchJobRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::GetPatchJobRequest, ::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_patch_job(name: nil) -> ::Google::Cloud::OsConfig::V1::PatchJob
Pass arguments to get_patch_job 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
  • name (::String) — Required. Name of the patch in the form projects/*/patchJobs/*
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/os_config/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::PatchJob.
p result

#initialize

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

Create a new OsConfigService client object.

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

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

#list_patch_deployments

def list_patch_deployments(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>
def list_patch_deployments(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>

Get a page of OS Config patch deployments.

Overloads
def list_patch_deployments(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>
Pass arguments to list_patch_deployments via a request object, either of type ListPatchDeploymentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::ListPatchDeploymentsRequest, ::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_patch_deployments(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchDeployment>
Pass arguments to list_patch_deployments 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 resource name of the parent in the form projects/*.
  • page_size (::Integer) — Optional. The maximum number of patch deployments to return. Default is 100.
  • page_token (::String) — Optional. A pagination token returned from a previous call to ListPatchDeployments that indicates where this listing should continue from.
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/os_config/v1"

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

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

# Call the list_patch_deployments method.
result = client.list_patch_deployments 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::OsConfig::V1::PatchDeployment.
  p response
end

#list_patch_job_instance_details

def list_patch_job_instance_details(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>
def list_patch_job_instance_details(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>

Get a list of instance details for a given patch job.

Overloads
def list_patch_job_instance_details(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>
Pass arguments to list_patch_job_instance_details via a request object, either of type ListPatchJobInstanceDetailsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::ListPatchJobInstanceDetailsRequest, ::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_patch_job_instance_details(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJobInstanceDetails>
Pass arguments to list_patch_job_instance_details 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 parent for the instances are in the form of projects/*/patchJobs/*.
  • page_size (::Integer) — The maximum number of instance details records to return. Default is 100.
  • page_token (::String) — A pagination token returned from a previous call that indicates where this listing should continue from.
  • filter (::String) — A filter expression that filters results listed in the response. This field supports filtering results by instance zone, name, state, or failure_reason.
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/os_config/v1"

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

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

# Call the list_patch_job_instance_details method.
result = client.list_patch_job_instance_details 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::OsConfig::V1::PatchJobInstanceDetails.
  p response
end

#list_patch_jobs

def list_patch_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>
def list_patch_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>

Get a list of patch jobs.

Overloads
def list_patch_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>
Pass arguments to list_patch_jobs via a request object, either of type ListPatchJobsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::ListPatchJobsRequest, ::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_patch_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::PatchJob>
Pass arguments to list_patch_jobs 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. In the form of projects/*
  • page_size (::Integer) — The maximum number of instance status to return.
  • page_token (::String) — A pagination token returned from a previous call that indicates where this listing should continue from.
  • filter (::String) — If provided, this field specifies the criteria that must be met by patch jobs to be included in the response. Currently, filtering is only available on the patch_deployment field.
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/os_config/v1"

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

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

# Call the list_patch_jobs method.
result = client.list_patch_jobs 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::OsConfig::V1::PatchJob.
  p response
end