Vertex AI V1 API - Class Google::Cloud::AIPlatform::V1::EndpointService::Client (v0.9.1)

Stay organized with collections Save and categorize content based on your preferences.

Reference documentation and code samples for the Vertex AI V1 API class Google::Cloud::AIPlatform::V1::EndpointService::Client.

Client for the EndpointService service.

A service for managing Vertex AI's Endpoints.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the EndpointService 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_endpoint

def create_endpoint(request, options = nil) -> ::Gapic::Operation
def create_endpoint(parent: nil, endpoint: nil, endpoint_id: nil) -> ::Gapic::Operation

Creates an Endpoint.

Overloads
def create_endpoint(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_endpoint via a request object, either of type CreateEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::CreateEndpointRequest, ::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_endpoint(parent: nil, endpoint: nil, endpoint_id: nil) -> ::Gapic::Operation
Pass arguments to create_endpoint 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 resource name of the Location to create the Endpoint in. Format: projects/{project}/locations/{location}
  • endpoint (::Google::Cloud::AIPlatform::V1::Endpoint, ::Hash) — Required. The Endpoint to create.
  • endpoint_id (::String) — Immutable. The ID to use for endpoint, which will become the final component of the endpoint resource name. If not provided, Vertex AI will generate a value for this ID.

    This value should be 1-10 characters, and valid characters are /[0-9]/. When using HTTP/JSON, this field is populated based on a query string argument, such as ?endpoint_id=12345. This is the fallback for fields that are not included in either the URI or the body.

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/ai_platform/v1"

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

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

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

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

Deletes an Endpoint.

Overloads
def delete_endpoint(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_endpoint via a request object, either of type DeleteEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::DeleteEndpointRequest, ::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_endpoint(name: nil) -> ::Gapic::Operation
Pass arguments to delete_endpoint 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 Endpoint resource to be deleted. Format: projects/{project}/locations/{location}/endpoints/{endpoint}
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/ai_platform/v1"

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

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

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

#deploy_model

def deploy_model(request, options = nil) -> ::Gapic::Operation
def deploy_model(endpoint: nil, deployed_model: nil, traffic_split: nil) -> ::Gapic::Operation

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Overloads
def deploy_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to deploy_model via a request object, either of type DeployModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::DeployModelRequest, ::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 deploy_model(endpoint: nil, deployed_model: nil, traffic_split: nil) -> ::Gapic::Operation
Pass arguments to deploy_model 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
  • endpoint (::String) — Required. The name of the Endpoint resource into which to deploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}
  • deployed_model (::Google::Cloud::AIPlatform::V1::DeployedModel, ::Hash) — Required. The DeployedModel to be created within the Endpoint. Note that Endpoint.traffic_split must be updated for the DeployedModel to start receiving traffic, either as part of this call, or via EndpointService.UpdateEndpoint.
  • traffic_split (::Hash{::String => ::Integer}) — A map from a DeployedModel's ID to the percentage of this Endpoint's traffic that should be forwarded to that DeployedModel.

    If this field is non-empty, then the Endpoint's traffic_split will be overwritten with it. To refer to the ID of the just being deployed Model, a "0" should be used, and the actual ID of the new DeployedModel will be filled in its place by this method. The traffic percentage values must add up to 100.

    If this field is empty, then the Endpoint's traffic_split is not updated.

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/ai_platform/v1"

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

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

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

def get_endpoint(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
def get_endpoint(name: nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint

Gets an Endpoint.

Overloads
def get_endpoint(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
Pass arguments to get_endpoint via a request object, either of type GetEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::GetEndpointRequest, ::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_endpoint(name: nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
Pass arguments to get_endpoint 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 Endpoint resource. Format: projects/{project}/locations/{location}/endpoints/{endpoint}
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/ai_platform/v1"

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

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

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

# The returned object is of type Google::Cloud::AIPlatform::V1::Endpoint.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Client)

#initialize

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

Create a new EndpointService client object.

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

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

#list_endpoints

def list_endpoints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Endpoint>
def list_endpoints(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Endpoint>

Lists Endpoints in a Location.

Overloads
def list_endpoints(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Endpoint>
Pass arguments to list_endpoints via a request object, either of type ListEndpointsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListEndpointsRequest, ::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_endpoints(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Endpoint>
Pass arguments to list_endpoints 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 resource name of the Location from which to list the Endpoints. Format: projects/{project}/locations/{location}
  • filter (::String) —

    Optional. An expression for filtering the results of the request. For field names both snake_case and camelCase are supported.

    • endpoint supports = and !=. endpoint represents the Endpoint ID, i.e. the last segment of the Endpoint's resource name.
    • display_name supports = and, !=
    • labels supports general map functions that is:
      • labels.key=value - key:value equality
      • `labels.key:* or labels:key - key existence
      • A key including a space must be quoted. labels."a key".

    Some examples:

    • endpoint=1
    • displayName="myDisplayName"
    • labels.myKey="myValue"
  • page_size (::Integer) — Optional. The standard list page size.
  • page_token (::String) — Optional. The standard list page token. Typically obtained via ListEndpointsResponse.next_page_token of the previous EndpointService.ListEndpoints call.
  • read_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. Mask specifying which fields to read.
  • order_by (::String) — A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • display_name
    • create_time
    • update_time

    Example: display_name, create_time desc.

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/ai_platform/v1"

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

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

# Call the list_endpoints method.
result = client.list_endpoints 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::AIPlatform::V1::Endpoint.
  p response
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#operations_client

def operations_client() -> ::Google::Cloud::AIPlatform::V1::EndpointService::Operations

Get the associated client for long-running operations.

#undeploy_model

def undeploy_model(request, options = nil) -> ::Gapic::Operation
def undeploy_model(endpoint: nil, deployed_model_id: nil, traffic_split: nil) -> ::Gapic::Operation

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Overloads
def undeploy_model(request, options = nil) -> ::Gapic::Operation
Pass arguments to undeploy_model via a request object, either of type UndeployModelRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::UndeployModelRequest, ::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 undeploy_model(endpoint: nil, deployed_model_id: nil, traffic_split: nil) -> ::Gapic::Operation
Pass arguments to undeploy_model 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
  • endpoint (::String) — Required. The name of the Endpoint resource from which to undeploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}
  • deployed_model_id (::String) — Required. The ID of the DeployedModel to be undeployed from the Endpoint.
  • traffic_split (::Hash{::String => ::Integer}) — If this field is provided, then the Endpoint's traffic_split will be overwritten with it. If last DeployedModel is being undeployed from the Endpoint, the [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel will be successfully undeployed only if it doesn't have any traffic assigned to it when this method executes, or if this field unassigns any traffic to it.
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/ai_platform/v1"

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

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

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

#update_endpoint

def update_endpoint(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
def update_endpoint(endpoint: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint

Updates an Endpoint.

Overloads
def update_endpoint(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
Pass arguments to update_endpoint via a request object, either of type UpdateEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::UpdateEndpointRequest, ::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_endpoint(endpoint: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Endpoint
Pass arguments to update_endpoint 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
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

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

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

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

# The returned object is of type Google::Cloud::AIPlatform::V1::Endpoint.
p result