Cloud OS Config V1 API - Class Google::Cloud::OsConfig::V1::OsConfigZonalService::Client (v1.0.0)

Reference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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_inventory

def get_inventory(request, options = nil) -> ::Google::Cloud::OsConfig::V1::Inventory
def get_inventory(name: nil, view: nil) -> ::Google::Cloud::OsConfig::V1::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::V1::Inventory
Pass arguments to get_inventory via a request object, either of type GetInventoryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::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::V1::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::V1::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/v1"

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

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

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

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

#get_os_policy_assignment

def get_os_policy_assignment(request, options = nil) -> ::Google::Cloud::OsConfig::V1::OSPolicyAssignment
def get_os_policy_assignment(name: nil) -> ::Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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::V1::OSPolicyAssignment.
p result

#get_os_policy_assignment_report

def get_os_policy_assignment_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport
def get_os_policy_assignment_report(name: nil) -> ::Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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::V1::OSPolicyAssignmentReport.
p result

#get_vulnerability_report

def get_vulnerability_report(request, options = nil) -> ::Google::Cloud::OsConfig::V1::VulnerabilityReport
def get_vulnerability_report(name: nil) -> ::Google::Cloud::OsConfig::V1::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::V1::VulnerabilityReport
Pass arguments to get_vulnerability_report via a request object, either of type GetVulnerabilityReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::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::V1::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/v1"

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

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

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

# The returned object is of type Google::Cloud::OsConfig::V1::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::V1::OsConfigZonalService::Client.new

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

#list_inventories

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

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

Overloads
def list_inventories(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::Inventory>
Pass arguments to list_inventories via a request object, either of type ListInventoriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::OsConfig::V1::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::V1::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::V1::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/v1"

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

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

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::OsConfig::V1::Inventory.
  p item
end

#list_os_policy_assignment_reports

def list_os_policy_assignment_reports(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport>
def list_os_policy_assignment_reports(parent: nil, page_size: nil, filter: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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
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::OsConfigZonalService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignmentReport.
  p item
end

#list_os_policy_assignment_revisions

def list_os_policy_assignment_revisions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>
def list_os_policy_assignment_revisions(name: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignment.
  p item
end

#list_os_policy_assignments

def list_os_policy_assignments(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::OSPolicyAssignment>
def list_os_policy_assignments(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1::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::V1::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::V1::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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::OsConfig::V1::OSPolicyAssignment.
  p item
end

#list_vulnerability_reports

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

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::OsConfig::V1::VulnerabilityReport.
  p item
end

#operations_client

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

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#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::V1::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/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::OsConfig::V1::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 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