AI Platform Notebooks V1 API - Class Google::Cloud::Notebooks::V1::ManagedNotebookService::Client (v0.1.0)

Reference documentation and code samples for the AI Platform Notebooks V1 API class Google::Cloud::Notebooks::V1::ManagedNotebookService::Client.

Client for the ManagedNotebookService service.

API v1 service for Managed Notebooks.

Inherits

  • Object

Methods

.configure

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

Configure the ManagedNotebookService 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 ManagedNotebookService clients
::Google::Cloud::Notebooks::V1::ManagedNotebookService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the ManagedNotebookService 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_runtime

def create_runtime(request, options = nil) -> ::Gapic::Operation
def create_runtime(parent: nil, runtime_id: nil, runtime: nil) -> ::Gapic::Operation

Creates a new Runtime in a given project and location.

Overloads
def create_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_runtime via a request object, either of type CreateRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::CreateRuntimeRequest, ::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_runtime(parent: nil, runtime_id: nil, runtime: nil) -> ::Gapic::Operation
Pass arguments to create_runtime 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. Format: parent=projects/{project_id}/locations/{location}
  • runtime_id (::String) — Required. User-defined unique ID of this Runtime.
  • runtime (::Google::Cloud::Notebooks::V1::Runtime, ::Hash) — Required. The Runtime to be created.
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/notebooks/v1"

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

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

# Call the create_runtime method.
result = client.create_runtime 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_runtime

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

Deletes a single Runtime.

Overloads
def delete_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_runtime via a request object, either of type DeleteRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::DeleteRuntimeRequest, ::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_runtime(name: nil) -> ::Gapic::Operation
Pass arguments to delete_runtime 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
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/notebooks/v1"

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

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

# Call the delete_runtime method.
result = client.delete_runtime 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_runtime

def get_runtime(request, options = nil) -> ::Google::Cloud::Notebooks::V1::Runtime
def get_runtime(name: nil) -> ::Google::Cloud::Notebooks::V1::Runtime

Gets details of a single Runtime. The location must be a regional endpoint rather than zonal.

Overloads
def get_runtime(request, options = nil) -> ::Google::Cloud::Notebooks::V1::Runtime
Pass arguments to get_runtime via a request object, either of type GetRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::GetRuntimeRequest, ::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_runtime(name: nil) -> ::Google::Cloud::Notebooks::V1::Runtime
Pass arguments to get_runtime 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
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/notebooks/v1"

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

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

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

# The returned object is of type Google::Cloud::Notebooks::V1::Runtime.
p result

#initialize

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

Create a new ManagedNotebookService client object.

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

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

#list_runtimes

def list_runtimes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Notebooks::V1::Runtime>
def list_runtimes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Notebooks::V1::Runtime>

Lists Runtimes in a given project and location.

Overloads
def list_runtimes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Notebooks::V1::Runtime>
Pass arguments to list_runtimes via a request object, either of type ListRuntimesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::ListRuntimesRequest, ::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_runtimes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Notebooks::V1::Runtime>
Pass arguments to list_runtimes 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. Format: parent=projects/{project_id}/locations/{location}
  • page_size (::Integer) — Maximum return size of the list call.
  • page_token (::String) — A previous returned page token that can be used to continue listing from the last result.
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/notebooks/v1"

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

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

# Call the list_runtimes method.
result = client.list_runtimes 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::Notebooks::V1::Runtime.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::Notebooks::V1::ManagedNotebookService::Operations

Get the associated client for long-running operations.

#report_runtime_event

def report_runtime_event(request, options = nil) -> ::Gapic::Operation
def report_runtime_event(name: nil, vm_id: nil, event: nil) -> ::Gapic::Operation

Report and process a runtime event.

Overloads
def report_runtime_event(request, options = nil) -> ::Gapic::Operation
Pass arguments to report_runtime_event via a request object, either of type ReportRuntimeEventRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::ReportRuntimeEventRequest, ::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 report_runtime_event(name: nil, vm_id: nil, event: nil) -> ::Gapic::Operation
Pass arguments to report_runtime_event 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
  • vm_id (::String) — Required. The VM hardware token for authenticating the VM. https://cloud.google.com/compute/docs/instances/verifying-instance-identity
  • event (::Google::Cloud::Notebooks::V1::Event, ::Hash) — Required. The Event to be reported.
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/notebooks/v1"

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

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

# Call the report_runtime_event method.
result = client.report_runtime_event 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

#reset_runtime

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

Resets a Managed Notebook Runtime.

Overloads
def reset_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to reset_runtime via a request object, either of type ResetRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::ResetRuntimeRequest, ::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 reset_runtime(name: nil) -> ::Gapic::Operation
Pass arguments to reset_runtime 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
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/notebooks/v1"

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

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

# Call the reset_runtime method.
result = client.reset_runtime 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

#start_runtime

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

Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Overloads
def start_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to start_runtime via a request object, either of type StartRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::StartRuntimeRequest, ::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 start_runtime(name: nil) -> ::Gapic::Operation
Pass arguments to start_runtime 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
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/notebooks/v1"

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

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

# Call the start_runtime method.
result = client.start_runtime 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

#stop_runtime

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

Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend" on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-start-instance https://cloud.google.com/compute/docs/instances/suspend-resume-instance

Overloads
def stop_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to stop_runtime via a request object, either of type StopRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::StopRuntimeRequest, ::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 stop_runtime(name: nil) -> ::Gapic::Operation
Pass arguments to stop_runtime 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. Format: projects/{project_id}/locations/{location}/runtimes/{runtime_id}
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/notebooks/v1"

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

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

# Call the stop_runtime method.
result = client.stop_runtime 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

#switch_runtime

def switch_runtime(request, options = nil) -> ::Gapic::Operation
def switch_runtime(name: nil, machine_type: nil, accelerator_config: nil) -> ::Gapic::Operation

Switch a Managed Notebook Runtime.

Overloads
def switch_runtime(request, options = nil) -> ::Gapic::Operation
Pass arguments to switch_runtime via a request object, either of type SwitchRuntimeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Notebooks::V1::SwitchRuntimeRequest, ::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 switch_runtime(name: nil, machine_type: nil, accelerator_config: nil) -> ::Gapic::Operation
Pass arguments to switch_runtime 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/notebooks/v1"

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

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

# Call the switch_runtime method.
result = client.switch_runtime 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