Cloud OS Config V1alpha API - Class Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client (v0.3.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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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.

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::GetVulnerabilityReportRequest.new

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

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

#initialize

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

Create a new OsConfigZonalService client object.

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

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

#list_instance_os_policies_compliances

def list_instance_os_policies_compliances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>
def list_instance_os_policies_compliances(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>

List OS policies compliance data for all Compute Engine VM instances in the specified zone.

Overloads
def list_instance_os_policies_compliances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>
Pass arguments to list_instance_os_policies_compliances via a request object, either of type ListInstanceOSPoliciesCompliancesRequest or an equivalent Hash.
Parameters
def list_instance_os_policies_compliances(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>
Pass arguments to list_instance_os_policies_compliances 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.

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

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

  • page_size (::Integer) — The maximum number of results to return.
  • page_token (::String) — A pagination token returned from a previous call to ListInstanceOSPoliciesCompliances that indicates where this listing should continue from.
  • filter (::String) — If provided, this field specifies the criteria that must be met by a InstanceOSPoliciesCompliance API resource to be included in the response.
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::ListInstanceOSPoliciesCompliancesRequest.new

# Call the list_instance_os_policies_compliances method.
result = client.list_instance_os_policies_compliances 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::V1alpha::InstanceOSPoliciesCompliance.
  p response
end

#list_inventories

def list_inventories(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>
def list_inventories(parent: nil, view: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>

List inventory data for all VM instances in the specified zone.

Overloads
def list_inventories(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>
Pass arguments to list_inventories via a request object, either of type ListInventoriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::ListInventoriesRequest, ::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_inventories(parent: nil, view: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>
Pass arguments to list_inventories 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.

    Format: projects/{project}/locations/{location}/instances/-

    For {project}, either project-number or project-id 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.
  • page_size (::Integer) — The maximum number of results to return.
  • page_token (::String) — A pagination token returned from a previous call to ListInventories that indicates where this listing should continue from.
  • filter (::String) — If provided, this field specifies the criteria that must be met by a Inventory API resource to be included in the response.
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/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::ListInventoriesRequest.new

# Call the list_inventories method.
result = client.list_inventories 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::V1alpha::Inventory.
  p response
end

#list_os_policy_assignment_reports

def list_os_policy_assignment_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>
def list_os_policy_assignment_reports(parent: nil, page_size: nil, filter: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>

List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

Overloads
def list_os_policy_assignment_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>
Pass arguments to list_os_policy_assignment_reports via a request object, either of type ListOSPolicyAssignmentReportsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentReportsRequest, ::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_os_policy_assignment_reports(parent: nil, page_size: nil, filter: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignmentReport>
Pass arguments to list_os_policy_assignment_reports 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.

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

    For {project}, either project-number or project-id can be provided. For {instance}, either instance-name, instance-id, or - can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all instances in the project/location. For {assignment}, either assignment-id or - can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all OSPolicyAssignments in the project/location. Either {instance} or {assignment} must be -.

    For example: projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports returns all reports for the instance projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports returns all the reports for the given assignment across all instances. projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports returns all the reports for all assignments across all instances.

  • page_size (::Integer) — The maximum number of results to return.
  • filter (::String) — If provided, this field specifies the criteria that must be met by the OSPolicyAssignmentReport API resource that is included in the response.
  • page_token (::String) — A pagination token returned from a previous call to the ListOSPolicyAssignmentReports method that indicates where this listing should continue from.
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::ListOSPolicyAssignmentReportsRequest.new

# Call the list_os_policy_assignment_reports method.
result = client.list_os_policy_assignment_reports 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::V1alpha::OSPolicyAssignmentReport.
  p response
end

#list_os_policy_assignment_revisions

def list_os_policy_assignment_revisions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
def list_os_policy_assignment_revisions(name: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>

List the OS policy assignment revisions for a given OS policy assignment.

Overloads
def list_os_policy_assignment_revisions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
Pass arguments to list_os_policy_assignment_revisions via a request object, either of type ListOSPolicyAssignmentRevisionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentRevisionsRequest, ::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_os_policy_assignment_revisions(name: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
Pass arguments to list_os_policy_assignment_revisions 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. The name of the OS policy assignment to list revisions for.
  • page_size (::Integer) — The maximum number of revisions to return.
  • page_token (::String) — A pagination token returned from a previous call to ListOSPolicyAssignmentRevisions 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/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::ListOSPolicyAssignmentRevisionsRequest.new

# Call the list_os_policy_assignment_revisions method.
result = client.list_os_policy_assignment_revisions 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::V1alpha::OSPolicyAssignment.
  p response
end

#list_os_policy_assignments

def list_os_policy_assignments(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
def list_os_policy_assignments(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>

List the OS policy assignments under the parent resource.

For each OS policy assignment, the latest revision is returned.

Overloads
def list_os_policy_assignments(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
Pass arguments to list_os_policy_assignments via a request object, either of type ListOSPolicyAssignmentsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentsRequest, ::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_os_policy_assignments(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>
Pass arguments to list_os_policy_assignments 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.
  • page_size (::Integer) — The maximum number of assignments to return.
  • page_token (::String) — A pagination token returned from a previous call to ListOSPolicyAssignments 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/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::ListOSPolicyAssignmentsRequest.new

# Call the list_os_policy_assignments method.
result = client.list_os_policy_assignments 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::V1alpha::OSPolicyAssignment.
  p response
end

#list_vulnerability_reports

def list_vulnerability_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>
def list_vulnerability_reports(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>

List vulnerability reports for all VM instances in the specified zone.

Overloads
def list_vulnerability_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>
Pass arguments to list_vulnerability_reports via a request object, either of type ListVulnerabilityReportsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::ListVulnerabilityReportsRequest, ::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_vulnerability_reports(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>
Pass arguments to list_vulnerability_reports 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.

    Format: projects/{project}/locations/{location}/instances/-

    For {project}, either project-number or project-id can be provided.

  • page_size (::Integer) — The maximum number of results to return.
  • page_token (::String) — A pagination token returned from a previous call to ListVulnerabilityReports that indicates where this listing should continue from.
  • filter (::String) — If provided, this field specifies the criteria that must be met by a vulnerabilityReport API resource to be included in the response.
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/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::ListVulnerabilityReportsRequest.new

# Call the list_vulnerability_reports method.
result = client.list_vulnerability_reports 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::V1alpha::VulnerabilityReport.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Operations

Get the associated client for long-running operations.

#update_os_policy_assignment

def update_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
def update_os_policy_assignment(os_policy_assignment: nil, update_mask: nil) -> ::Gapic::Operation

Update an existing 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.

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

Overloads
def update_os_policy_assignment(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_os_policy_assignment via a request object, either of type UpdateOSPolicyAssignmentRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1alpha::UpdateOSPolicyAssignmentRequest, ::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_os_policy_assignment(os_policy_assignment: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_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
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::UpdateOSPolicyAssignmentRequest.new

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

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