Ruby Client for the Google Cloud Compute V1 API

API Client library for the Google Cloud Compute V1 API

google-cloud-compute-v1 is the official client library for the Google Cloud Compute V1 API.

https://github.com/googleapis/google-cloud-ruby

Installation

$ gem install google-cloud-compute-v1

Before You Begin

In order to use this library, you first need to go through the following steps:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the API.
  4. Set up authentication.

Quick Start

require"google/cloud/compute/v1"client=::Google::Cloud::Compute::V1::AcceleratorTypes::Rest::Client.newrequest=::Google::Cloud::Compute::V1::AggregatedListAcceleratorTypesRequest.new# (request fields as keyword arguments...)response=client.aggregated_listrequest

View theClient Library Documentationfor class and method documentation.

See also theProduct Documentationfor general usage information.

Debug Logging

This library comes with opt-in Debug Logging that can help you troubleshootyour application's integration with the API. When logging is activated, keyevents such as requests and responses, along with data payloads and metadatasuch as headers and client configuration, are logged to the standard errorstream.

WARNING: Client Library Debug Logging includes your data payloads inplaintext, which could include sensitive data such as PII for yourself or yourcustomers, private keys, or other security data that could be compromising ifleaked. Always practice good data hygiene with your application logs, and followthe principle of least access. Google also recommends that Client Library DebugLogging be enabled only temporarily during active debugging, and not usedpermanently in production.

To enable logging, set the environment variableGOOGLE_SDK_RUBY_LOGGING_GEMSto the valueall. Alternatively, you can set the value to a comma-delimitedlist of client library gem names. This will select the default logging behavior,which writes logs to the standard error stream. On a local workstation, this mayresult in logs appearing on the console. When running on a Google Cloud hostingservice such asGoogle Cloud Run, this generallyresults in logs appearing alongside your application logs in theGoogle Cloud Logging service.

You can customize logging by modifying thelogger configuration whenconstructing a client object. For example:

require"google/cloud/compute/v1"require"logger"client=::Google::Cloud::Compute::V1::AcceleratorTypes::Rest::Client.newdo|config|config.logger=Logger.new"my-app.log"end

Google Cloud Samples

To browse ready to use code samples checkGoogle Cloud Samples.

Supported Ruby Versions

This library is supported on Ruby 3.0+.

Google provides official support for Ruby versions that are actively supportedby Ruby Core—that is, Ruby versions that are either in normal maintenance orin security maintenance, and not end of life. Older versions of Rubymaystill work, but are unsupported and not recommended. Seehttps://www.ruby-lang.org/en/downloads/branches/ for details about the Rubysupport schedule.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.