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.

Attributes

operations_client[R]

Get the associated client for long-running operations.

@return [::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Operations]

os_config_zonal_service_stub[R]

@private

Public Class Methods

configure() { |configure| ... } click to toggle source

Configure the OsConfigZonalService Client class.

See {::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client::Configuration} for a description of the configuration fields.

@example

# Modify the configuration for all OsConfigZonalService clients
::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client.configure do |config|
  config.timeout = 10.0
end

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 59
def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "OsConfig", "V1alpha"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.timeout = 60.0
    default_config.retry_policy = {
      initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end
new() { |config| ... } click to toggle source

Create a new OsConfigZonalService client object.

@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

@yield [config] Configure the OsConfigZonalService client. @yieldparam config [Client::Configuration]

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 117
def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/osconfig/v1alpha/osconfig_zonal_service_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.endpoint = @config.endpoint
  end

  @os_config_zonal_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Public Instance Methods

configure() { |config| ... } click to toggle source

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 {::Google::Cloud::OsConfig::V1alpha::OsConfigZonalService::Client::Configuration} for a description of the configuration fields.

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 96
def configure
  yield @config if block_given?
  @config
end
create_os_policy_assignment(request, options = nil) { |response, operation| ... } click to toggle source

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](cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

@overload create_os_policy_assignment(request, options = nil)

Pass arguments to `create_os_policy_assignment` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::CreateOSPolicyAssignmentRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_os_policy_assignment(parent: nil, os_policy_assignment: nil, os_policy_assignment_id: nil)

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).

@param parent [::String]
  Required. The parent resource name in the form:
  projects/\\{project}/locations/\\{location}
@param os_policy_assignment [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment, ::Hash]
  Required. The OS policy assignment to be created.
@param 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.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 216
def create_os_policy_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::CreateOSPolicyAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.create_os_policy_assignment.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_os_policy_assignment.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.create_os_policy_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :create_os_policy_assignment, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
delete_os_policy_assignment(request, options = nil) { |response, operation| ... } click to toggle source

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](cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

@overload delete_os_policy_assignment(request, options = nil)

Pass arguments to `delete_os_policy_assignment` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::DeleteOSPolicyAssignmentRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload delete_os_policy_assignment(name: nil)

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).

@param name [::String]
  Required. The name of the OS policy assignment to be deleted

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 602
def delete_os_policy_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::DeleteOSPolicyAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.delete_os_policy_assignment.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_os_policy_assignment.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.delete_os_policy_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :delete_os_policy_assignment, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_instance_os_policies_compliance(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload get_instance_os_policies_compliance(request, options = nil)

Pass arguments to `get_instance_os_policies_compliance` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_instance_os_policies_compliance(name: nil)

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).

@param 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.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 680
def get_instance_os_policies_compliance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::GetInstanceOSPoliciesComplianceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_instance_os_policies_compliance.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_instance_os_policies_compliance.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_instance_os_policies_compliance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :get_instance_os_policies_compliance, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_inventory(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload get_inventory(request, options = nil)

Pass arguments to `get_inventory` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::GetInventoryRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_inventory(name: nil, view: nil)

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).

@param 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.
@param 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.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::OsConfig::V1alpha::Inventory] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::OsConfig::V1alpha::Inventory]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 843
def get_inventory request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::GetInventoryRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_inventory.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_inventory.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_inventory.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :get_inventory, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_os_policy_assignment(request, options = nil) { |response, operation| ... } click to toggle source

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.

@overload get_os_policy_assignment(request, options = nil)

Pass arguments to `get_os_policy_assignment` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_os_policy_assignment(name: nil)

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).

@param name [::String]
  Required. The resource name of OS policy assignment.

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

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 371
def get_os_policy_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::GetOSPolicyAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_os_policy_assignment.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_os_policy_assignment.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_os_policy_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :get_os_policy_assignment, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
get_vulnerability_report(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload get_vulnerability_report(request, options = nil)

Pass arguments to `get_vulnerability_report` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::GetVulnerabilityReportRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_vulnerability_report(name: nil)

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).

@param 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.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 1006
def get_vulnerability_report request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::GetVulnerabilityReportRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.get_vulnerability_report.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_vulnerability_report.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_vulnerability_report.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :get_vulnerability_report, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_instance_os_policies_compliances(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload list_instance_os_policies_compliances(request, options = nil)

Pass arguments to `list_instance_os_policies_compliances` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest} or an equivalent Hash.

@param request [::Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest, ::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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_instance_os_policies_compliances(parent: nil, page_size: nil, page_token: nil, filter: nil)

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).

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

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::InstanceOSPoliciesCompliance>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 763
def list_instance_os_policies_compliances request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListInstanceOSPoliciesCompliancesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_instance_os_policies_compliances.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_instance_os_policies_compliances.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_instance_os_policies_compliances.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :list_instance_os_policies_compliances, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_instance_os_policies_compliances, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_inventories(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload list_inventories(request, options = nil)

Pass arguments to `list_inventories` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::ListInventoriesRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_inventories(parent: nil, view: nil, page_size: nil, page_token: nil, filter: nil)

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).

@param parent [::String]
  Required. The parent resource name.

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

  For `{project}`, either `project-number` or `project-id` can be
  provided. For `{instance}`, only hyphen or dash character is supported to
  list inventories across VMs.
@param 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.
@param page_size [::Integer]
  The maximum number of results to return.
@param page_token [::String]
  A pagination token returned from a previous call to
  `ListInventories` that indicates where this listing
  should continue from.
@param filter [::String]
  If provided, this field specifies the criteria that must be met by a
  `Inventory` API resource to be included in the response.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::Inventory>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 929
def list_inventories request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListInventoriesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_inventories.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_inventories.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_inventories.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :list_inventories, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_inventories, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_os_policy_assignment_revisions(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload list_os_policy_assignment_revisions(request, options = nil)

Pass arguments to `list_os_policy_assignment_revisions` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentRevisionsRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_os_policy_assignment_revisions(name: nil, page_size: nil, page_token: nil)

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).

@param name [::String]
  Required. The name of the OS policy assignment to list revisions for.
@param page_size [::Integer]
  The maximum number of revisions to return.
@param page_token [::String]
  A pagination token returned from a previous call to
  `ListOSPolicyAssignmentRevisions` that indicates where this listing should
  continue from.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 522
def list_os_policy_assignment_revisions request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentRevisionsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_os_policy_assignment_revisions.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "name" => request.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_os_policy_assignment_revisions.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_os_policy_assignment_revisions.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :list_os_policy_assignment_revisions, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignment_revisions, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_os_policy_assignments(request, options = nil) { |response, operation| ... } click to toggle source

List the OS policy assignments under the parent resource.

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

@overload list_os_policy_assignments(request, options = nil)

Pass arguments to `list_os_policy_assignments` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentsRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_os_policy_assignments(parent: nil, page_size: nil, page_token: nil)

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).

@param parent [::String]
  Required. The parent resource name.
@param page_size [::Integer]
  The maximum number of assignments to return.
@param page_token [::String]
  A pagination token returned from a previous call to
  `ListOSPolicyAssignments` that indicates where this listing should continue
  from.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 447
def list_os_policy_assignments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListOSPolicyAssignmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_os_policy_assignments.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_os_policy_assignments.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_os_policy_assignments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :list_os_policy_assignments, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_os_policy_assignments, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
list_vulnerability_reports(request, options = nil) { |response, operation| ... } click to toggle source

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

@overload list_vulnerability_reports(request, options = nil)

Pass arguments to `list_vulnerability_reports` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::ListVulnerabilityReportsRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_vulnerability_reports(parent: nil, page_size: nil, page_token: nil, filter: nil)

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).

@param parent [::String]
  Required. The parent resource name.

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

  For `{project}`, either `project-number` or `project-id` can be provided.
  For `{instance}`, only `-` character is supported to list vulnerability
  reports across VMs.
@param page_size [::Integer]
  The maximum number of results to return.
@param page_token [::String]
  A pagination token returned from a previous call to
  `ListVulnerabilityReports` that indicates where this listing
  should continue from.
@param filter [::String]
  If provided, this field specifies the criteria that must be met by a
  `vulnerabilityReport` API resource to be included in the response.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::OsConfig::V1alpha::VulnerabilityReport>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 1089
def list_vulnerability_reports request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::ListVulnerabilityReportsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.list_vulnerability_reports.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "parent" => request.parent
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_vulnerability_reports.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_vulnerability_reports.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :list_vulnerability_reports, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @os_config_zonal_service_stub, :list_vulnerability_reports, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end
update_os_policy_assignment(request, options = nil) { |response, operation| ... } click to toggle source

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](cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

@overload update_os_policy_assignment(request, options = nil)

Pass arguments to `update_os_policy_assignment` via a request object, either of type
{::Google::Cloud::OsConfig::V1alpha::UpdateOSPolicyAssignmentRequest} or an equivalent Hash.

@param 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.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_os_policy_assignment(os_policy_assignment: nil, update_mask: nil)

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).

@param os_policy_assignment [::Google::Cloud::OsConfig::V1alpha::OSPolicyAssignment, ::Hash]
  Required. The updated OS policy assignment.
@param update_mask [::Google::Protobuf::FieldMask, ::Hash]
  Optional. Field mask that controls which fields of the assignment should be updated.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::Operation] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::Operation]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/os_config/v1alpha/os_config_zonal_service/client.rb, line 295
def update_os_policy_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsConfig::V1alpha::UpdateOSPolicyAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
  metadata = @config.rpcs.update_os_policy_assignment.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::OsConfig::V1alpha::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "os_policy_assignment.name" => request.os_policy_assignment.name
  }
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  metadata[:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_os_policy_assignment.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.update_os_policy_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.metadata,
                         retry_policy: @config.retry_policy

  @os_config_zonal_service_stub.call_rpc :update_os_policy_assignment, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end