Cloud OS Config V1alpha API - Class Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client (v0.7.0)

Reference documentation and code samples for the Cloud OS Config V1alpha API class Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.

Client for the OsConfigZonalService service.

Zonal OS Config API

The OS Config service is the server-side component that allows users to manage package installations and patch jobs for Compute Engine VM instances.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the OsConfigZonalService 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_os_policy_assignment

def create_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
def create_os_policy_assignment(parent: nil, os_policy_assignment: nil, os_policy_assignment_id: nil) -> ::Gapic::Operation

Create an OS policy assignment.

This method also creates the first revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.

Overloads
def create_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_os_policy_assignment via a request object, either of type CreateOSPolicyAssignmentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::CreateOSPolicyAssignmentRequest, ::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_os_policy_assignment(parent: nil, os_policy_assignment: nil, os_policy_assignment_id: nil) -> ::Gapic::Operation
Pass arguments to create_os_policy_assignment 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 resource name in the form: projects/{project}/locations/{location}
  • os_policy_assignment (::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment, ::Hash) — Required. The OS policy assignment to be created.
  • os_policy_assignment_id (::String) —

    Required. The logical name of the OS policy assignment in the project with the following restrictions:

    • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_config/v1alpha"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_os_policy_assignment

def delete_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
def delete_os_policy_assignment(name: nil) -> ::Gapic::Operation

Delete the OS policy assignment.

This method creates a new revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.

Overloads
def delete_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_os_policy_assignment via a request object, either of type DeleteOSPolicyAssignmentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::DeleteOSPolicyAssignmentRequest, ::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_os_policy_assignment(name: nil) -> ::Gapic::Operation
Pass arguments to delete_os_policy_assignment 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 name of the OS policy assignment to be deleted
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/os_config/v1alpha"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_instance_os_policies_compliance

def get_instance_os_policies_compliance(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance
def get_instance_os_policies_compliance(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance

Get OS policies compliance data for the specified Compute Engine VM instance.

Overloads
def get_instance_os_policies_compliance(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance
Pass arguments to get_instance_os_policies_compliance via a request object, either of type GetInstanceOSPoliciesComplianceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest, ::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_instance_os_policies_compliance(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance
Pass arguments to get_instance_os_policies_compliance 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. API resource name for instance OS policies compliance resource.

    Format: projects/{project}/locations/{location}/instanceOSPoliciesCompliances/{instance}

    For {project}, either Compute Engine project-number or project-id can be provided. For {instance}, either Compute Engine VM instance-id or instance-name can be provided.

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/v1alpha"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance.
p result

#get_inventory

def get_inventory(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::Inventory
def get_inventory(name: nil, view: nil) -> ::Google::Cloud::OsConfig::V1alpha::Inventory

Get inventory data for the specified VM instance. If the VM has no associated inventory, the message NOT_FOUND is returned.

Overloads
def get_inventory(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::Inventory
Pass arguments to get_inventory via a request object, either of type GetInventoryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::GetInventoryRequest, ::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_inventory(name: nil, view: nil) -> ::Google::Cloud::OsConfig::V1alpha::Inventory
Pass arguments to get_inventory 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
  • name (::String) — Required. API resource name for inventory resource.

    Format: projects/{project}/locations/{location}/instances/{instance}/inventory

    For {project}, either project-number or project-id can be provided. For {instance}, either Compute Engine instance-id or instance-name can be provided.

  • view (::Google::Cloud::OsConfig::V1alpha::InventoryView) — Inventory view indicating what information should be included in the inventory resource. If unspecified, the default view is BASIC.
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/v1alpha"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1alpha::Inventory.
p result

#get_os_policy_assignment

def get_os_policy_assignment(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment
def get_os_policy_assignment(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment

Retrieve an existing OS policy assignment.

This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the name parameter.

Overloads
def get_os_policy_assignment(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment
Pass arguments to get_os_policy_assignment via a request object, either of type GetOSPolicyAssignmentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentRequest, ::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_os_policy_assignment(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment
Pass arguments to get_os_policy_assignment 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 OS policy assignment.

    Format: projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}

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/v1alpha"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment.
p result

#get_os_policy_assignment_report

def get_os_policy_assignment_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport
def get_os_policy_assignment_report(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport

Get the OS policy asssignment report for the specified Compute Engine VM instance.

Overloads
def get_os_policy_assignment_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport
Pass arguments to get_os_policy_assignment_report via a request object, either of type GetOSPolicyAssignmentReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentReportRequest, ::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_os_policy_assignment_report(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport
Pass arguments to get_os_policy_assignment_report 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. API resource name for OS policy assignment report.

    Format: /projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report

    For {project}, either project-number or project-id can be provided. For {instance_id}, either Compute Engine instance-id or instance-name can be provided. For {assignment_id}, the OSPolicyAssignment id must be provided.

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/v1alpha"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport.
p result

#get_vulnerability_report

def get_vulnerability_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport
def get_vulnerability_report(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport

Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

Overloads
def get_vulnerability_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport
Pass arguments to get_vulnerability_report via a request object, either of type GetVulnerabilityReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::GetVulnerabilityReportRequest, ::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_vulnerability_report(name: nil) -> ::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport
Pass arguments to get_vulnerability_report 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. API resource name for vulnerability resource.

    Format: projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport

    For {project}, either project-number or project-id can be provided. For {instance}, either Compute Engine instance-id or instance-name can be provided.