Discovery Engine V1BETA API - Class Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client (v0.17.0)

Reference documentation and code samples for the Discovery Engine V1BETA API class Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.

Client for the SampleQueryService service.

Service for managing {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s,

Inherits

  • Object

Methods

.configure

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

Configure the SampleQueryService 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 SampleQueryService clients
::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the SampleQueryService 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_sample_query

def create_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
def create_sample_query(parent: nil, sample_query: nil, sample_query_id: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery

Creates a SampleQuery

Overloads
def create_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to create_sample_query via a request object, either of type CreateSampleQueryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest, ::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_sample_query(parent: nil, sample_query: nil, sample_query_id: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to create_sample_query via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent resource name, such as projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}.
  • sample_query (::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery, ::Hash) — Required. The SampleQuery to create.
  • sample_query_id (::String) — Required. The ID to use for the SampleQuery, which will become the final component of the SampleQuery.name.

    If the caller does not have permission to create the SampleQuery, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

    This field must be unique among all SampleQuerys with the same parent. Otherwise, an ALREADY_EXISTS error is returned.

    This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest.new

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

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
p result

#delete_sample_query

def delete_sample_query(request, options = nil) -> ::Google::Protobuf::Empty
def delete_sample_query(name: nil) -> ::Google::Protobuf::Empty

Deletes a SampleQuery.

Overloads
def delete_sample_query(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_sample_query via a request object, either of type DeleteSampleQueryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest, ::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_sample_query(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_sample_query 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. Full resource name of SampleQuery, such as projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}/sampleQueries/{sample_query}.

    If the caller does not have permission to delete the SampleQuery, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

    If the SampleQuery to delete does not exist, a NOT_FOUND error is returned.

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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest.new

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

# The returned object is of type Google::Protobuf::Empty.
p result

#get_sample_query

def get_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
def get_sample_query(name: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery

Gets a SampleQuery.

Overloads
def get_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to get_sample_query via a request object, either of type GetSampleQueryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest, ::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_sample_query(name: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to get_sample_query 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. Full resource name of SampleQuery, such as projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}/sampleQueries/{sample_query}.

    If the caller does not have permission to access the SampleQuery, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

    If the requested SampleQuery does not exist, a NOT_FOUND error is returned.

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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest.new

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

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
p result

#import_sample_queries

def import_sample_queries(request, options = nil) -> ::Gapic::Operation
def import_sample_queries(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil) -> ::Gapic::Operation

Bulk import of multiple SampleQuerys. Sample queries that already exist may be deleted.

Note: It is possible for a subset of the {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s to be successfully imported.

Overloads
def import_sample_queries(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_sample_queries via a request object, either of type ImportSampleQueriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest, ::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 import_sample_queries(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil) -> ::Gapic::Operation
Pass arguments to import_sample_queries 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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest.new

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#initialize

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

Create a new SampleQueryService client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new do |config|
  config.timeout = 10.0
end

#list_sample_queries

def list_sample_queries(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>
def list_sample_queries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>

Gets a list of {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s.

Overloads
def list_sample_queries(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>
Pass arguments to list_sample_queries via a request object, either of type ListSampleQueriesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest, ::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_sample_queries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>
Pass arguments to list_sample_queries via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The parent sample query set resource name, such as projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}.

    If the caller does not have permission to list SampleQuerys under this sample query set, regardless of whether or not this sample query set exists, a PERMISSION_DENIED error is returned.

  • page_size (::Integer) — Maximum number of SampleQuerys to return. If unspecified, defaults to 100. The maximum allowed value is 1000. Values above 1000 will be coerced to 1000.

    If this field is negative, an INVALID_ARGUMENT error is returned.

  • page_token (::String) — A page token ListSampleQueriesResponse.next_page_token, received from a previous SampleQueryService.ListSampleQueries call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to SampleQueryService.ListSampleQueries must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.

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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
  p item
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)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

def operations_client() -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_sample_query

def update_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
def update_sample_query(sample_query: nil, update_mask: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery

Updates a SampleQuery.

Overloads
def update_sample_query(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to update_sample_query via a request object, either of type UpdateSampleQueryRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest, ::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_sample_query(sample_query: nil, update_mask: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery
Pass arguments to update_sample_query 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/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest.new

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

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
p result