Class: Google::Cloud::VisionAI::V1::Warehouse::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/vision_ai/v1/warehouse/client.rb

Overview

Client for the Warehouse service.

Service that manages media content + metadata for streaming.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#annotation_path, #asset_path, #collection_path, #corpus_path, #data_schema_path, #index_endpoint_path, #index_path, #location_path, #search_config_path, #search_hypernym_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new Warehouse client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::VisionAI::V1::Warehouse::Client.new

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

Yields:

  • (config)

    Configure the Warehouse client.

Yield Parameters:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 156

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/visionai/v1/warehouse_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.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_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.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @warehouse_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::VisionAI::V1::Warehouse::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool,
    logger: @config.logger
  )

  @warehouse_stub.stub_logger&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end

  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @warehouse_stub.endpoint
    config.universe_domain = @warehouse_stub.universe_domain
    config.logger = @warehouse_stub.logger if config.respond_to? :logger=
  end

  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @warehouse_stub.endpoint
    config.universe_domain = @warehouse_stub.universe_domain
    config.logger = @warehouse_stub.logger if config.respond_to? :logger=
  end
end

Instance Attribute Details

#iam_policy_clientGoogle::Iam::V1::IAMPolicy::Client (readonly)

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

Returns:

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


249
250
251
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 249

def iam_policy_client
  @iam_policy_client
end

#location_clientGoogle::Cloud::Location::Locations::Client (readonly)

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

Returns:

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


242
243
244
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 242

def location_client
  @location_client
end

#operations_client::Google::Cloud::VisionAI::V1::Warehouse::Operations (readonly)

Get the associated client for long-running operations.



235
236
237
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 235

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the Warehouse Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all Warehouse clients
::Google::Cloud::VisionAI::V1::Warehouse::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 64

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "VisionAI", "V1"]
    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: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.create_asset.timeout = 120.0
    default_config.rpcs.create_asset.retry_policy = {
      initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14]
    }

    default_config.rpcs.create_corpus.timeout = 120.0
    default_config.rpcs.create_corpus.retry_policy = {
      initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14]
    }

    default_config.rpcs.create_data_schema.timeout = 120.0
    default_config.rpcs.create_data_schema.retry_policy = {
      initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14]
    }

    default_config.rpcs.create_annotation.timeout = 120.0
    default_config.rpcs.create_annotation.retry_policy = {
      initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14]
    }

    default_config.rpcs.ingest_asset.timeout = 120.0
    default_config.rpcs.ingest_asset.retry_policy = {
      initial_delay: 1.0, max_delay: 120.0, multiplier: 2.5, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#add_collection_item(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::AddCollectionItemResponse #add_collection_item(item: nil) ⇒ ::Google::Cloud::VisionAI::V1::AddCollectionItemResponse

Adds an item into a Collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::AddCollectionItemResponse.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 6116

def add_collection_item request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::AddCollectionItemRequest

  # 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
   = @config.rpcs.add_collection_item..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.item&.collection
    header_params["item.collection"] = request.item.collection
  end

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

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

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

  @warehouse_stub.call_rpc :add_collection_item, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#analyze_asset(request, options = nil) ⇒ ::Gapic::Operation #analyze_asset(name: nil) ⇒ ::Gapic::Operation

Analyze asset to power search capability.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #analyze_asset(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to analyze_asset via a request object, either of type AnalyzeAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::AnalyzeAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #analyze_asset(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to analyze_asset 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) (defaults to: nil)

      Required. The resource name of the asset to analyze. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_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.



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 991

def analyze_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::AnalyzeAssetRequest

  # 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
   = @config.rpcs.analyze_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#analyze_corpus(request, options = nil) ⇒ ::Gapic::Operation #analyze_corpus(name: nil) ⇒ ::Gapic::Operation

Analyzes a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #analyze_corpus(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to analyze_corpus via a request object, either of type AnalyzeCorpusRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::AnalyzeCorpusRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #analyze_corpus(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to analyze_corpus 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) (defaults to: nil)

      Required. The parent corpus resource where the assets will be analyzed. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_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.



2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2358

def analyze_corpus request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::AnalyzeCorpusRequest

  # 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
   = @config.rpcs.analyze_corpus..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#clip_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::ClipAssetResponse #clip_asset(name: nil, temporal_partition: nil) ⇒ ::Google::Cloud::VisionAI::V1::ClipAssetResponse

Supported by STREAM_VIDEO corpus type. Generates clips for downloading. The api takes in a time range, and generates a clip of the first content available after start_time and before end_time, which may overflow beyond these bounds. Returned clips are truncated if the total size of the clips are larger than 100MB.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::ClipAssetResponse.
p result

Overloads:

  • #clip_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::ClipAssetResponse

    Pass arguments to clip_asset via a request object, either of type ClipAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ClipAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #clip_asset(name: nil, temporal_partition: nil) ⇒ ::Google::Cloud::VisionAI::V1::ClipAssetResponse

    Pass arguments to clip_asset 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) (defaults to: nil)

      Required. The resource name of the asset to request clips for. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • temporal_partition (::Google::Cloud::VisionAI::V1::Partition::TemporalPartition, ::Hash) (defaults to: nil)

      Required. The time range to request clips for.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3470

def clip_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ClipAssetRequest

  # 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
   = @config.rpcs.clip_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :clip_asset, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the Warehouse 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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



126
127
128
129
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 126

def configure
  yield @config if block_given?
  @config
end

#create_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation #create_annotation(parent: nil, annotation: nil, annotation_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

Creates annotation inside asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Annotation.
p result

Overloads:

  • #create_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to create_annotation via a request object, either of type CreateAnnotationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateAnnotationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_annotation(parent: nil, annotation: nil, annotation_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to create_annotation 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) (defaults to: nil)

      Required. The parent resource where this annotation will be created. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • annotation (::Google::Cloud::VisionAI::V1::Annotation, ::Hash) (defaults to: nil)

      Required. The annotation to create.

    • annotation_id (::String) (defaults to: nil)

      Optional. The ID to use for the annotation, which will become the final component of the annotation's resource name if user choose to specify. Otherwise, annotation id will be generated by system.

      This value should be up to 63 characters, and valid characters are /[a-z][0-9]-/. The first character must be a letter, the last could be a letter or a number.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2912

def create_annotation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateAnnotationRequest

  # 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
   = @config.rpcs.create_annotation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :create_annotation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset #create_asset(parent: nil, asset: nil, asset_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

Creates an asset inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Asset.
p result

Overloads:

  • #create_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to create_asset via a request object, either of type CreateAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_asset(parent: nil, asset: nil, asset_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to create_asset 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) (defaults to: nil)

      Required. The parent resource where this asset will be created. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}

    • asset (::Google::Cloud::VisionAI::V1::Asset, ::Hash) (defaults to: nil)

      Required. The asset to create.

    • asset_id (::String) (defaults to: nil)

      Optional. The ID to use for the asset, which will become the final component of the asset's resource name if user choose to specify. Otherwise, asset id will be generated by system.

      This value should be up to 63 characters, and valid characters are /[a-z][0-9]-/. The first character must be a letter, the last could be a letter or a number.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 318

def create_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateAssetRequest

  # 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
   = @config.rpcs.create_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :create_asset, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_collection(request, options = nil) ⇒ ::Gapic::Operation #create_collection(parent: nil, collection: nil, collection_id: nil) ⇒ ::Gapic::Operation

Creates a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #create_collection(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_collection via a request object, either of type CreateCollectionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateCollectionRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_collection(parent: nil, collection: nil, collection_id: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_collection 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) (defaults to: nil)

      Required. The parent resource where this collection will be created. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • collection (::Google::Cloud::VisionAI::V1::Collection, ::Hash) (defaults to: nil)

      Required. The collection resource to be created.

    • collection_id (::String) (defaults to: nil)

      Optional. The ID to use for the collection, which will become the final component of the resource name if user choose to specify. Otherwise, collection id will be generated by system.

      This value should be up to 55 characters, and valid characters are /[a-z][0-9]-/. The first character must be a letter, the last could be a letter or a number.

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.



5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5649

def create_collection request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateCollectionRequest

  # 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
   = @config.rpcs.create_collection..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_corpus(request, options = nil) ⇒ ::Gapic::Operation #create_corpus(parent: nil, corpus: nil) ⇒ ::Gapic::Operation

Creates a corpus inside a project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #create_corpus(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_corpus via a request object, either of type CreateCorpusRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateCorpusRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_corpus(parent: nil, corpus: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_corpus 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) (defaults to: nil)

      Required. Form: projects/{project_number}/locations/{location_id}

    • corpus (::Google::Cloud::VisionAI::V1::Corpus, ::Hash) (defaults to: nil)

      Required. The corpus 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.



1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1895

def create_corpus request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateCorpusRequest

  # 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
   = @config.rpcs.create_corpus..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema #create_data_schema(parent: nil, data_schema: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

Creates data schema inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::DataSchema.
p result

Overloads:

  • #create_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to create_data_schema via a request object, either of type CreateDataSchemaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateDataSchemaRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_data_schema(parent: nil, data_schema: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to create_data_schema 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) (defaults to: nil)

      Required. The parent resource where this data schema will be created. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}

    • data_schema (::Google::Cloud::VisionAI::V1::DataSchema, ::Hash) (defaults to: nil)

      Required. The data schema to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2449

def create_data_schema request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateDataSchemaRequest

  # 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
   = @config.rpcs.create_data_schema..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :create_data_schema, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_index(request, options = nil) ⇒ ::Gapic::Operation #create_index(parent: nil, index_id: nil, index: nil) ⇒ ::Gapic::Operation

Creates an Index under the corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #create_index(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_index via a request object, either of type CreateIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_index(parent: nil, index_id: nil, index: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_index 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) (defaults to: nil)

      Required. Value for the parent. The resource name of the Corpus under which this index is created. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}

    • index_id (::String) (defaults to: nil)

      Optional. The ID for the index. This will become the final resource name for the index. If the user does not specify this value, it will be generated by system.

      This value should be up to 63 characters, and valid characters are /[a-z][0-9]-/. The first character must be a letter, the last could be a letter or a number.

    • index (::Google::Cloud::VisionAI::V1::Index, ::Hash) (defaults to: nil)

      Required. The index being 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.



1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1408

def create_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateIndexRequest

  # 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
   = @config.rpcs.create_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation #create_index_endpoint(parent: nil, index_endpoint_id: nil, index_endpoint: nil) ⇒ ::Gapic::Operation

Creates an IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #create_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_index_endpoint via a request object, either of type CreateIndexEndpointRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateIndexEndpointRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_index_endpoint(parent: nil, index_endpoint_id: nil, index_endpoint: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_index_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) (defaults to: nil)

      Required. Format: projects/{project}/locations/{location}

    • index_endpoint_id (::String) (defaults to: nil)

      Optional. The ID to use for the IndexEndpoint, which will become the final component of the IndexEndpoint's resource name if the user specifies it. Otherwise, IndexEndpoint id will be autogenerated.

      This value should be up to 63 characters, and valid characters are a-z, 0-9 and dash (-). The first character must be a letter, the last must be a letter or a number.

    • index_endpoint (::Google::Cloud::VisionAI::V1::IndexEndpoint, ::Hash) (defaults to: nil)

      Required. The resource being 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.



4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4959

def create_index_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateIndexEndpointRequest

  # 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
   = @config.rpcs.create_index_endpoint..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig #create_search_config(parent: nil, search_config: nil, search_config_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

Creates a search configuration inside a corpus.

Please follow the rules below to create a valid CreateSearchConfigRequest. --- General Rules ---

  1. Request.search_config_id must not be associated with an existing SearchConfig.
  2. Request must contain at least one non-empty search_criteria_property or facet_property.
  3. mapped_fields must not be empty, and must map to existing UGA keys.
  4. All mapped_fields must be of the same type.
  5. All mapped_fields must share the same granularity.
  6. All mapped_fields must share the same semantic SearchConfig match options. For property-specific rules, please reference the comments for FacetProperty and SearchCriteriaProperty.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchConfig.
p result

Overloads:

  • #create_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to create_search_config via a request object, either of type CreateSearchConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateSearchConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_search_config(parent: nil, search_config: nil, search_config_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to create_search_config 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) (defaults to: nil)

      Required. The parent resource where this search configuration will be created. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}

    • search_config (::Google::Cloud::VisionAI::V1::SearchConfig, ::Hash) (defaults to: nil)

      Required. The search config to create.

    • search_config_id (::String) (defaults to: nil)

      Required. ID to use for the new search config. Will become the final component of the SearchConfig's resource name. This value should be up to 63 characters, and valid characters are /[a-z][0-9]-_/. The first character must be a letter, the last could be a letter or a number.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3776

def create_search_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateSearchConfigRequest

  # 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
   = @config.rpcs.create_search_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :create_search_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym #create_search_hypernym(parent: nil, search_hypernym: nil, search_hypernym_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

Creates a SearchHypernym inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchHypernym.
p result

Overloads:

  • #create_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to create_search_hypernym via a request object, either of type CreateSearchHypernymRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::CreateSearchHypernymRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_search_hypernym(parent: nil, search_hypernym: nil, search_hypernym_id: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to create_search_hypernym 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) (defaults to: nil)

      Required. The parent resource where this SearchHypernym will be created. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • search_hypernym (::Google::Cloud::VisionAI::V1::SearchHypernym, ::Hash) (defaults to: nil)

      Required. The SearchHypernym to create.

    • search_hypernym_id (::String) (defaults to: nil)

      Optional. The search hypernym id. If omitted, a random UUID will be generated.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4253

def create_search_hypernym request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::CreateSearchHypernymRequest

  # 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
   = @config.rpcs.create_search_hypernym..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :create_search_hypernym, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_annotation(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_annotation(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes annotation inside asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

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

Overloads:

  • #delete_annotation(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_annotation via a request object, either of type DeleteAnnotationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteAnnotationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_annotation(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_annotation 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) (defaults to: nil)

      Required. The name of the annotation to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3295

def delete_annotation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteAnnotationRequest

  # 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
   = @config.rpcs.delete_annotation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :delete_annotation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_asset(request, options = nil) ⇒ ::Gapic::Operation #delete_asset(name: nil) ⇒ ::Gapic::Operation

Deletes asset inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #delete_asset(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_asset via a request object, either of type DeleteAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_asset(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_asset 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) (defaults to: nil)

      Required. The name of the asset to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}

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.



699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 699

def delete_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteAssetRequest

  # 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
   = @config.rpcs.delete_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_collection(request, options = nil) ⇒ ::Gapic::Operation #delete_collection(name: nil) ⇒ ::Gapic::Operation

Deletes a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #delete_collection(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_collection via a request object, either of type DeleteCollectionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteCollectionRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_collection(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_collection 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) (defaults to: nil)

      Required. The name of the collection to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}

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.



5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5744

def delete_collection request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteCollectionRequest

  # 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
   = @config.rpcs.delete_collection..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_corpus(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_corpus(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a corpus only if its empty. Returns empty response.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

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

Overloads:

  • #delete_corpus(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_corpus via a request object, either of type DeleteCorpusRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteCorpusRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_corpus(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_corpus 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) (defaults to: nil)

      Required. The resource name of the corpus to delete.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2264

def delete_corpus request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteCorpusRequest

  # 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
   = @config.rpcs.delete_corpus..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :delete_corpus, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_data_schema(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_data_schema(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes data schema inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

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

Overloads:

  • #delete_data_schema(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_data_schema via a request object, either of type DeleteDataSchemaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteDataSchemaRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_data_schema(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_data_schema 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) (defaults to: nil)

      Required. The name of the data schema to delete. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2712

def delete_data_schema request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteDataSchemaRequest

  # 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
   = @config.rpcs.delete_data_schema..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :delete_data_schema, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_index(request, options = nil) ⇒ ::Gapic::Operation #delete_index(name: nil) ⇒ ::Gapic::Operation

Delete a single Index. In order to delete an index, the caller must make sure that it is not deployed to any index endpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #delete_index(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_index via a request object, either of type DeleteIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_index(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_index 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) (defaults to: nil)

      Required. The name of the index to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}

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.



1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1799

def delete_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteIndexRequest

  # 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
   = @config.rpcs.delete_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation #delete_index_endpoint(name: nil) ⇒ ::Gapic::Operation

Deletes an IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #delete_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_index_endpoint via a request object, either of type DeleteIndexEndpointRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteIndexEndpointRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_index_endpoint(name: nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_index_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:

    • name (::String) (defaults to: nil)

      Required. Name of the resource.

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.



5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5350

def delete_index_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteIndexEndpointRequest

  # 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
   = @config.rpcs.delete_index_endpoint..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_search_config(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_search_config(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a search configuration inside a corpus.

For a DeleteSearchConfigRequest to be valid, Request.search_configuration.name must already exist.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

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

Overloads:

  • #delete_search_config(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_search_config via a request object, either of type DeleteSearchConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteSearchConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_search_config(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_search_config 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) (defaults to: nil)

      Required. The name of the search configuration to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4058

def delete_search_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteSearchConfigRequest

  # 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
   = @config.rpcs.delete_search_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :delete_search_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_search_hypernym(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_search_hypernym(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a SearchHypernym inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

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

Overloads:

  • #delete_search_hypernym(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_search_hypernym via a request object, either of type DeleteSearchHypernymRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeleteSearchHypernymRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_search_hypernym(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_search_hypernym 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) (defaults to: nil)

      Required. The name of the SearchHypernym to delete. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4518

def delete_search_hypernym request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeleteSearchHypernymRequest

  # 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
   = @config.rpcs.delete_search_hypernym..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :delete_search_hypernym, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#deploy_index(request, options = nil) ⇒ ::Gapic::Operation #deploy_index(index_endpoint: nil, deployed_index: nil) ⇒ ::Gapic::Operation

Deploys an Index to IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #deploy_index(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to deploy_index via a request object, either of type DeployIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::DeployIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #deploy_index(index_endpoint: nil, deployed_index: nil) ⇒ ::Gapic::Operation

    Pass arguments to deploy_index 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:

    • index_endpoint (::String) (defaults to: nil)

      Required. IndexEndpoint the index is deployed to. Format: projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}

    • deployed_index (::Google::Cloud::VisionAI::V1::DeployedIndex, ::Hash) (defaults to: nil)

      Required. Index to deploy.

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.



5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5448

def deploy_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::DeployIndexRequest

  # 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
   = @config.rpcs.deploy_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index_endpoint
    header_params["index_endpoint"] = request.index_endpoint
  end

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

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

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

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

#generate_hls_uri(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateHlsUriResponse #generate_hls_uri(name: nil, temporal_partitions: nil, live_view_enabled: nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateHlsUriResponse

Generates a uri for an HLS manifest. The api takes in a collection of time ranges, and generates a URI for an HLS manifest that covers all the requested time ranges.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::GenerateHlsUriResponse.
p result

Overloads:

  • #generate_hls_uri(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateHlsUriResponse

    Pass arguments to generate_hls_uri via a request object, either of type GenerateHlsUriRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GenerateHlsUriRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #generate_hls_uri(name: nil, temporal_partitions: nil, live_view_enabled: nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateHlsUriResponse

    Pass arguments to generate_hls_uri 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) (defaults to: nil)

      Required. The resource name of the asset to request clips for. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • temporal_partitions (::Array<::Google::Cloud::VisionAI::V1::Partition::TemporalPartition, ::Hash>) (defaults to: nil)

      The time range to request clips for. Will be ignored if get_live_view is set to True. The total time range requested should be smaller than 24h.

    • live_view_enabled (::Boolean) (defaults to: nil)

      Option to exclusively show a livestream of the asset with up to 3 minutes of backlog data.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3565

def generate_hls_uri request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GenerateHlsUriRequest

  # 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
   = @config.rpcs.generate_hls_uri..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :generate_hls_uri, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#generate_retrieval_url(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlResponse #generate_retrieval_url(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlResponse

Generates a signed url for downloading the asset. For video warehouse, please see comment of UploadAsset about how to allow retrieval of cloud storage files in a different project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::GenerateRetrievalUrlResponse.
p result

Overloads:

  • #generate_retrieval_url(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlResponse

    Pass arguments to generate_retrieval_url via a request object, either of type GenerateRetrievalUrlRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #generate_retrieval_url(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlResponse

    Pass arguments to generate_retrieval_url 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) (defaults to: nil)

      Required. The resource name of the asset to request signed url for. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 897

def generate_retrieval_url request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GenerateRetrievalUrlRequest

  # 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
   = @config.rpcs.generate_retrieval_url..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :generate_retrieval_url, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation #get_annotation(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

Reads annotation inside asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Annotation.
p result

Overloads:

  • #get_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to get_annotation via a request object, either of type GetAnnotationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetAnnotationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_annotation(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to get_annotation 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) (defaults to: nil)

      Required. The name of the annotation to retrieve. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2999

def get_annotation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetAnnotationRequest

  # 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
   = @config.rpcs.get_annotation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_annotation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset #get_asset(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

Reads an asset inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Asset.
p result

Overloads:

  • #get_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to get_asset via a request object, either of type GetAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_asset(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to get_asset 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) (defaults to: nil)

      Required. The name of the asset to retrieve. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 496

def get_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetAssetRequest

  # 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
   = @config.rpcs.get_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_asset, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_collection(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection #get_collection(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

Gets a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Collection.
p result

Overloads:

  • #get_collection(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

    Pass arguments to get_collection via a request object, either of type GetCollectionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetCollectionRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_collection(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

    Pass arguments to get_collection 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) (defaults to: nil)

      Required. The name of the collection to retrieve. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5832

def get_collection request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetCollectionRequest

  # 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
   = @config.rpcs.get_collection..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_collection, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_corpus(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus #get_corpus(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

Gets corpus details inside a project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Corpus.
p result

Overloads:

  • #get_corpus(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

    Pass arguments to get_corpus via a request object, either of type GetCorpusRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetCorpusRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_corpus(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

    Pass arguments to get_corpus 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) (defaults to: nil)

      Required. The resource name of the corpus to retrieve.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1982

def get_corpus request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetCorpusRequest

  # 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
   = @config.rpcs.get_corpus..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_corpus, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema #get_data_schema(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

Gets data schema inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::DataSchema.
p result

Overloads:

  • #get_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to get_data_schema via a request object, either of type GetDataSchemaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetDataSchemaRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_data_schema(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to get_data_schema 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) (defaults to: nil)

      Required. The name of the data schema to retrieve. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2625

def get_data_schema request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetDataSchemaRequest

  # 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
   = @config.rpcs.get_data_schema..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_data_schema, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_index(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Index #get_index(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Index

Gets the details of a single Index under a Corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Index.
p result

Overloads:

  • #get_index(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Index

    Pass arguments to get_index via a request object, either of type GetIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_index(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::Index

    Pass arguments to get_index 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) (defaults to: nil)

      Required. Name of the Index resource. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1600

def get_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetIndexRequest

  # 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
   = @config.rpcs.get_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_index, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_index_endpoint(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::IndexEndpoint #get_index_endpoint(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::IndexEndpoint

Gets an IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::IndexEndpoint.
p result

Overloads:

  • #get_index_endpoint(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::IndexEndpoint

    Pass arguments to get_index_endpoint via a request object, either of type GetIndexEndpointRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetIndexEndpointRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_index_endpoint(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::IndexEndpoint

    Pass arguments to get_index_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:

    • name (::String) (defaults to: nil)

      Required. Name of the IndexEndpoint resource.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5046

def get_index_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetIndexEndpointRequest

  # 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
   = @config.rpcs.get_index_endpoint..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_index_endpoint, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig #get_search_config(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

Gets a search configuration inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchConfig.
p result

Overloads:

  • #get_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to get_search_config via a request object, either of type GetSearchConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetSearchConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_search_config(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to get_search_config 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) (defaults to: nil)

      Required. The name of the search configuration to retrieve. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3968

def get_search_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetSearchConfigRequest

  # 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
   = @config.rpcs.get_search_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_search_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym #get_search_hypernym(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

Gets a SearchHypernym inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchHypernym.
p result

Overloads:

  • #get_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to get_search_hypernym via a request object, either of type GetSearchHypernymRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::GetSearchHypernymRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_search_hypernym(name: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to get_search_hypernym 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) (defaults to: nil)

      Required. The name of the SearchHypernym to retrieve. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4431

def get_search_hypernym request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::GetSearchHypernymRequest

  # 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
   = @config.rpcs.get_search_hypernym..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

  @warehouse_stub.call_rpc :get_search_hypernym, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_assets(request, options = nil) ⇒ ::Gapic::Operation #import_assets(assets_gcs_uri: nil, parent: nil) ⇒ ::Gapic::Operation

Imports assets (images plus annotations) from a meta file on cloud storage. Each row in the meta file is corresponding to an image (specified by a cloud storage uri) and its annotations.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #import_assets(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to import_assets via a request object, either of type ImportAssetsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ImportAssetsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #import_assets(assets_gcs_uri: nil, parent: nil) ⇒ ::Gapic::Operation

    Pass arguments to import_assets 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:

    • assets_gcs_uri (::String) (defaults to: nil)

      The file contains all assets information to be imported.

      • The file is in JSONL format.
      • Each line corresponding to one asset.
      • Each line will be converted into InputImageAsset proto.
    • parent (::String) (defaults to: nil)

      Required. The parent corpus resource where the assets will be imported. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_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.



3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3666

def import_assets request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ImportAssetsRequest

  # 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
   = @config.rpcs.import_assets..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#index_asset(request, options = nil) ⇒ ::Gapic::Operation #index_asset(name: nil, index: nil) ⇒ ::Gapic::Operation

Index one asset for search. Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #index_asset(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to index_asset via a request object, either of type IndexAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::IndexAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #index_asset(name: nil, index: nil) ⇒ ::Gapic::Operation

    Pass arguments to index_asset 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) (defaults to: nil)

      Required. The resource name of the asset to index. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • index (::String) (defaults to: nil)

      Optional. The name of the index. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}

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.



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1092

def index_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::IndexAssetRequest

  # 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
   = @config.rpcs.index_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#ingest_asset(request, options = nil) {|response, operation| ... } ⇒ ::Enumerable<::Google::Cloud::VisionAI::V1::IngestAssetResponse>

Ingests data for the asset. It is not allowed to ingest a data chunk which is already expired according to TTL. This method is only available via the gRPC API (not HTTP since bi-directional streaming is not supported via HTTP).

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

# Create an input stream.
input = Gapic::StreamInput.new

# Call the ingest_asset method to start streaming.
output = client.ingest_asset input

# Send requests on the stream. For each request object, set fields by
# passing keyword arguments. Be sure to close the stream when done.
input << Google::Cloud::VisionAI::V1::IngestAssetRequest.new
input << Google::Cloud::VisionAI::V1::IngestAssetRequest.new
input.close

# The returned object is a streamed enumerable yielding elements of type
# ::Google::Cloud::VisionAI::V1::IngestAssetResponse
output.each do |current_response|
  p current_response
end

Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3379

def ingest_asset request, options = nil
  unless request.is_a? ::Enumerable
    raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
    request = request.to_enum
  end

  request = request.lazy.map do |req|
    ::Gapic::Protobuf.coerce req, to: ::Google::Cloud::VisionAI::V1::IngestAssetRequest
  end

  # 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
   = @config.rpcs.ingest_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @warehouse_stub.call_rpc :ingest_asset, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_annotations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Annotation> #list_annotations(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Annotation>

Lists a list of annotations inside asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_annotations method.
result = client.list_annotations 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::VisionAI::V1::Annotation.
  p item
end

Overloads:

  • #list_annotations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Annotation>

    Pass arguments to list_annotations via a request object, either of type ListAnnotationsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListAnnotationsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_annotations(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Annotation>

    Pass arguments to list_annotations 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) (defaults to: nil)

      The parent, which owns this collection of annotations. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of annotations to return. The service may return fewer than this value. If unspecified, at most 50 annotations will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListAnnotations call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListAnnotations must match the call that provided the page token.

    • filter (::String) (defaults to: nil)

      The filter applied to the returned list. We only support filtering for the following fields: For corpus of STREAM_VIDEO type: partition.temporal_partition.start_time, partition.temporal_partition.end_time, and key. For corpus of VIDEO_ON_DEMAND type, partition.relative_temporal_partition.start_offset, partition.relative_temporal_partition.end_offset, and key. For corpus of IMAGE type, only key is supported. Timestamps are specified in the RFC-3339 format, and only one restriction may be applied per field, joined by conjunctions. Format: "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND key = "example_key""

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3116

def list_annotations request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListAnnotationsRequest

  # 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
   = @config.rpcs.list_annotations..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_annotations, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_annotations, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Asset> #list_assets(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Asset>

Lists an list of assets inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_assets method.
result = client.list_assets 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::VisionAI::V1::Asset.
  p item
end

Overloads:

  • #list_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Asset>

    Pass arguments to list_assets via a request object, either of type ListAssetsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListAssetsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_assets(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Asset>

    Pass arguments to list_assets 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) (defaults to: nil)

      Required. The parent, which owns this collection of assets. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of assets to return. The service may return fewer than this value. If unspecified, at most 50 assets will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListAssets call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListAssets must match the call that provided the page token.

    • filter (::String) (defaults to: nil)

      The filter applied to the returned list. Only the following filterings are supported: "assets_with_contents = true", which returns assets with contents uploaded; "assets_with_contents = false", which returns assets without contents.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 603

def list_assets request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListAssetsRequest

  # 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
   = @config.rpcs.list_assets..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_assets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_assets, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_collections(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Collection> #list_collections(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Collection>

Lists collections inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_collections method.
result = client.list_collections 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::VisionAI::V1::Collection.
  p item
end

Overloads:

  • #list_collections(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Collection>

    Pass arguments to list_collections via a request object, either of type ListCollectionsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListCollectionsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_collections(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Collection>

    Pass arguments to list_collections 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) (defaults to: nil)

      Required. The parent corpus. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListCollectionsRequest call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListCollectionsRequest must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 6029

def list_collections request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListCollectionsRequest

  # 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
   = @config.rpcs.list_collections..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_collections, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_collections, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_corpora(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Corpus> #list_corpora(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Corpus>

Lists all corpora in a project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_corpora method.
result = client.list_corpora 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::VisionAI::V1::Corpus.
  p item
end

Overloads:

  • #list_corpora(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Corpus>

    Pass arguments to list_corpora via a request object, either of type ListCorporaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListCorporaRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_corpora(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Corpus>

    Pass arguments to list_corpora 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) (defaults to: nil)

      Required. The resource name of the project from which to list corpora.

    • page_size (::Integer) (defaults to: nil)

      Requested page size. API may return fewer results than requested. If negative, INVALID_ARGUMENT error will be returned. If unspecified or 0, API will pick a default size, which is 10. If the requested page size is larger than the maximum size, API will pick use the maximum size, which is 20.

    • page_token (::String) (defaults to: nil)

      A token identifying a page of results for the server to return. Typically obtained via ListCorporaResponse.next_page_token of the previous Warehouse.ListCorpora call.

    • filter (::String) (defaults to: nil)

      The filter applied to the returned corpora list. Only the following restrictions are supported: type=<Corpus.Type>, type!=<Corpus.Type>.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2176

def list_corpora request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListCorporaRequest

  # 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
   = @config.rpcs.list_corpora..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_corpora, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_corpora, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_data_schemas(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::DataSchema> #list_data_schemas(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::DataSchema>

Lists a list of data schemas inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_data_schemas method.
result = client.list_data_schemas 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::VisionAI::V1::DataSchema.
  p item
end

Overloads:

  • #list_data_schemas(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::DataSchema>

    Pass arguments to list_data_schemas via a request object, either of type ListDataSchemasRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListDataSchemasRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_data_schemas(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::DataSchema>

    Pass arguments to list_data_schemas 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) (defaults to: nil)

      Required. The parent, which owns this collection of data schemas. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of data schemas to return. The service may return fewer than this value. If unspecified, at most 50 data schemas will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListDataSchemas call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListDataSchemas must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2813

def list_data_schemas request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListDataSchemasRequest

  # 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
   = @config.rpcs.list_data_schemas..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_data_schemas, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_data_schemas, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_index_endpoints(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexEndpoint> #list_index_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexEndpoint>

Lists all IndexEndpoints in a project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_index_endpoints method.
result = client.list_index_endpoints 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::VisionAI::V1::IndexEndpoint.
  p item
end

Overloads:

  • #list_index_endpoints(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexEndpoint>

    Pass arguments to list_index_endpoints via a request object, either of type ListIndexEndpointsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListIndexEndpointsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_index_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexEndpoint>

    Pass arguments to list_index_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) (defaults to: nil)

      Required. Format: projects/{project}/locations/{location}

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer items than requested. The service may return fewer than this value. If unspecified, a page size of 50 will be used. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      Optional. A token identifying a page of results the server should return.

    • filter (::String) (defaults to: nil)

      Optional. The filter applied to the returned list. We only support filtering for the deployed_image_index.image_index field. However, to filter by a corpus instead of an image index, simply use deployed_image_index.corpus, which will return all endpoints with deployed_image_index.image_index inside of the given corpus. A basic filter on image index would look like: deployed_image_index.image_index = "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" A basic filter on corpus would look like: deployed_image_index.corpus = "projects/123/locations/us-central1/corpora/my_corpus"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5154

def list_index_endpoints request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListIndexEndpointsRequest

  # 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
   = @config.rpcs.list_index_endpoints..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_index_endpoints, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_index_endpoints, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_indexes(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Index> #list_indexes(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Index>

List all Indexes in a given Corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_indexes method.
result = client.list_indexes 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::VisionAI::V1::Index.
  p item
end

Overloads:

  • #list_indexes(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Index>

    Pass arguments to list_indexes via a request object, either of type ListIndexesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListIndexesRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_indexes(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::Index>

    Pass arguments to list_indexes 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) (defaults to: nil)

      Required. The parent corpus that owns this collection of indexes. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of indexes to return. The service may return fewer than this value. If unspecified, at most 50 indexes will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListIndexes call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListIndexes must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1702

def list_indexes request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListIndexesRequest

  # 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
   = @config.rpcs.list_indexes..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_indexes, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_indexes, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_search_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchConfig> #list_search_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchConfig>

Lists all search configurations inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_search_configs method.
result = client.list_search_configs 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::VisionAI::V1::SearchConfig.
  p item
end

Overloads:

  • #list_search_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchConfig>

    Pass arguments to list_search_configs via a request object, either of type ListSearchConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListSearchConfigsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_search_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchConfig>

    Pass arguments to list_search_configs 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) (defaults to: nil)

      Required. The parent, which owns this collection of search configurations. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of search configurations to return. The service may return fewer than this value. If unspecified, a page size of 50 will be used. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListSearchConfigs call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListSearchConfigs must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4160

def list_search_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListSearchConfigsRequest

  # 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
   = @config.rpcs.list_search_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_search_configs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_search_configs, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_search_hypernyms(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchHypernym> #list_search_hypernyms(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchHypernym>

Lists SearchHypernyms inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the list_search_hypernyms method.
result = client.list_search_hypernyms 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::VisionAI::V1::SearchHypernym.
  p item
end

Overloads:

  • #list_search_hypernyms(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchHypernym>

    Pass arguments to list_search_hypernyms via a request object, either of type ListSearchHypernymsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ListSearchHypernymsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_search_hypernyms(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchHypernym>

    Pass arguments to list_search_hypernyms 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) (defaults to: nil)

      Required. The parent, which owns this collection of SearchHypernyms. Format: projects/{project_number}/locations/{location}/corpora/{corpus}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of SearchHypernyms returned. The service may return fewer than this value. If unspecified, a page size of 50 will be used. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous SearchHypernym call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to SearchHypernym must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4620

def list_search_hypernyms request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ListSearchHypernymsRequest

  # 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
   = @config.rpcs.list_search_hypernyms..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @warehouse_stub.call_rpc :list_search_hypernyms, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :list_search_hypernyms, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.

Returns:

  • (Logger)


256
257
258
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 256

def logger
  @warehouse_stub.logger
end

#remove_collection_item(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::RemoveCollectionItemResponse #remove_collection_item(item: nil) ⇒ ::Google::Cloud::VisionAI::V1::RemoveCollectionItemResponse

Removes an item from a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::RemoveCollectionItemResponse.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 6201

def remove_collection_item request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::RemoveCollectionItemRequest

  # 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
   = @config.rpcs.remove_collection_item..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.item&.collection
    header_params["item.collection"] = request.item.collection
  end

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

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

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

  @warehouse_stub.call_rpc :remove_collection_item, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#remove_index_asset(request, options = nil) ⇒ ::Gapic::Operation #remove_index_asset(name: nil, index: nil) ⇒ ::Gapic::Operation

Remove one asset's index data for search. Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #remove_index_asset(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to remove_index_asset via a request object, either of type RemoveIndexAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::RemoveIndexAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #remove_index_asset(name: nil, index: nil) ⇒ ::Gapic::Operation

    Pass arguments to remove_index_asset 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) (defaults to: nil)

      Required. The resource name of the asset to index. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • index (::String) (defaults to: nil)

      Optional. The name of the index. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}

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.



1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1193

def remove_index_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::RemoveIndexAssetRequest

  # 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
   = @config.rpcs.remove_index_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#search_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem> #search_assets(schema_key_sorting_strategy: nil, corpus: nil, page_size: nil, page_token: nil, content_time_ranges: nil, criteria: nil, facet_selections: nil, result_annotation_keys: nil, search_query: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

Search media asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the search_assets method.
result = client.search_assets 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::VisionAI::V1::SearchResultItem.
  p item
end

Overloads:

  • #search_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

    Pass arguments to search_assets via a request object, either of type SearchAssetsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::SearchAssetsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search_assets(schema_key_sorting_strategy: nil, corpus: nil, page_size: nil, page_token: nil, content_time_ranges: nil, criteria: nil, facet_selections: nil, result_annotation_keys: nil, search_query: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

    Pass arguments to search_assets 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:

    • schema_key_sorting_strategy (::Google::Cloud::VisionAI::V1::SchemaKeySortingStrategy, ::Hash) (defaults to: nil)

      Sort by the value under the data schema key.

    • corpus (::String) (defaults to: nil)

      Required. The parent corpus to search. Format: projects/{project_id}/locations/{location_id}/corpora/{corpus_id}

    • page_size (::Integer) (defaults to: nil)

      The number of results to be returned in this page. If it's 0, the server will decide the appropriate page_size.

    • page_token (::String) (defaults to: nil)

      The continuation token to fetch the next page. If empty, it means it is fetching the first page.

    • content_time_ranges (::Google::Cloud::VisionAI::V1::DateTimeRangeArray, ::Hash) (defaults to: nil)

      Time ranges that matching video content must fall within. If no ranges are provided, there will be no time restriction. This field is treated just like the criteria below, but defined separately for convenience as it is used frequently. Note that if the end_time is in the future, it will be clamped to the time the request was received.

    • criteria (::Array<::Google::Cloud::VisionAI::V1::Criteria, ::Hash>) (defaults to: nil)

      Criteria applied to search results.

    • facet_selections (::Array<::Google::Cloud::VisionAI::V1::FacetGroup, ::Hash>) (defaults to: nil)

      Stores most recent facet selection state. Only facet groups with user's selection will be presented here. Selection state is either selected or unselected. Only selected facet buckets will be used as search criteria.

    • result_annotation_keys (::Array<::String>) (defaults to: nil)

      A list of annotation keys to specify the annotations to be retrieved and returned with each search result. Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search strategy must not be NO_SEARCH.

    • search_query (::String) (defaults to: nil)

      Global search query. Allows user to search assets without needing to specify which field the value belongs to.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4740

def search_assets request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::SearchAssetsRequest

  # 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
   = @config.rpcs.search_assets..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.corpus
    header_params["corpus"] = request.corpus
  end

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

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

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

  @warehouse_stub.call_rpc :search_assets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :search_assets, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#search_index_endpoint(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem> #search_index_endpoint(image_query: nil, text_query: nil, index_endpoint: nil, criteria: nil, exclusion_criteria: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

Search a deployed index endpoint (IMAGE corpus type only).

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the search_index_endpoint method.
result = client.search_index_endpoint 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::VisionAI::V1::SearchResultItem.
  p item
end

Overloads:

  • #search_index_endpoint(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

    Pass arguments to search_index_endpoint via a request object, either of type SearchIndexEndpointRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::SearchIndexEndpointRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search_index_endpoint(image_query: nil, text_query: nil, index_endpoint: nil, criteria: nil, exclusion_criteria: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::SearchResultItem>

    Pass arguments to search_index_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:

    • image_query (::Google::Cloud::VisionAI::V1::ImageQuery, ::Hash) (defaults to: nil)

      An image-only query.

      Note: The following fields are mutually exclusive: image_query, text_query. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • text_query (::String) (defaults to: nil)

      A text-only query.

      Note: The following fields are mutually exclusive: text_query, image_query. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • index_endpoint (::String) (defaults to: nil)

      Required. The index endpoint to search. Format: projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}

    • criteria (::Array<::Google::Cloud::VisionAI::V1::Criteria, ::Hash>) (defaults to: nil)

      Criteria applied to search results.

    • exclusion_criteria (::Array<::Google::Cloud::VisionAI::V1::Criteria, ::Hash>) (defaults to: nil)

      Criteria to exclude from search results. Note that fetch_matched_annotations will be ignored.

    • page_size (::Integer) (defaults to: nil)

      Requested page size. API may return fewer results than requested. If negative, INVALID_ARGUMENT error will be returned. If unspecified or 0, API will pick a default size, which is 10. If the requested page size is larger than the maximum size, API will pick the maximum size, which is 100.

    • page_token (::String) (defaults to: nil)

      The continuation token to fetch the next page. If empty, it means it is fetching the first page.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4855

def search_index_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::SearchIndexEndpointRequest

  # 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
   = @config.rpcs.search_index_endpoint..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index_endpoint
    header_params["index_endpoint"] = request.index_endpoint
  end

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

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

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

  @warehouse_stub.call_rpc :search_index_endpoint, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :search_index_endpoint, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#undeploy_index(request, options = nil) ⇒ ::Gapic::Operation #undeploy_index(index_endpoint: nil) ⇒ ::Gapic::Operation

Undeploys an Index from IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #undeploy_index(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undeploy_index via a request object, either of type UndeployIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UndeployIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #undeploy_index(index_endpoint: nil) ⇒ ::Gapic::Operation

    Pass arguments to undeploy_index 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:

    • index_endpoint (::String) (defaults to: nil)

      Required. Resource name of the IndexEndpoint resource on which the undeployment will act. Format: projects/{project}/locations/{location}/indexEndpoints/{index_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.



5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5544

def undeploy_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UndeployIndexRequest

  # 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
   = @config.rpcs.undeploy_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index_endpoint
    header_params["index_endpoint"] = request.index_endpoint
  end

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

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

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

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

#universe_domainString

The effective universe domain

Returns:

  • (String)


136
137
138
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 136

def universe_domain
  @warehouse_stub.universe_domain
end

#update_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation #update_annotation(annotation: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

Updates annotation inside asset.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Annotation.
p result

Overloads:

  • #update_annotation(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to update_annotation via a request object, either of type UpdateAnnotationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateAnnotationRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_annotation(annotation: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Annotation

    Pass arguments to update_annotation 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:

    • annotation (::Google::Cloud::VisionAI::V1::Annotation, ::Hash) (defaults to: nil)

      Required. The annotation to update. The annotation's name field is used to identify the annotation to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3208

def update_annotation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateAnnotationRequest

  # 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
   = @config.rpcs.update_annotation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.annotation&.name
    header_params["annotation.name"] = request.annotation.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_annotation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset #update_asset(asset: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

Updates an asset inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Asset.
p result

Overloads:

  • #update_asset(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to update_asset via a request object, either of type UpdateAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_asset(asset: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Asset

    Pass arguments to update_asset 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:

    • asset (::Google::Cloud::VisionAI::V1::Asset, ::Hash) (defaults to: nil)

      Required. The asset to update.

      The asset's name field is used to identify the asset to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 409

def update_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateAssetRequest

  # 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
   = @config.rpcs.update_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.asset&.name
    header_params["asset.name"] = request.asset.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_asset, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_collection(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection #update_collection(collection: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

Updates a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Collection.
p result

Overloads:

  • #update_collection(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

    Pass arguments to update_collection via a request object, either of type UpdateCollectionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateCollectionRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_collection(collection: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Collection

    Pass arguments to update_collection 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:

    • collection (::Google::Cloud::VisionAI::V1::Collection, ::Hash) (defaults to: nil)

      Required. The collection to update.

      The collection's name field is used to identify the collection to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated.

      • Unset update_mask or set update_mask to be a single "*" only will update all updatable fields with the value provided in collection.
      • To update display_name value to empty string, set it in the collection to empty string, and set update_mask with "display_name". Same applies to other updatable string fields in the collection.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5929

def update_collection request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateCollectionRequest

  # 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
   = @config.rpcs.update_collection..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.collection&.name
    header_params["collection.name"] = request.collection.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_collection, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_corpus(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus #update_corpus(corpus: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

Updates a corpus in a project.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::Corpus.
p result

Overloads:

  • #update_corpus(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

    Pass arguments to update_corpus via a request object, either of type UpdateCorpusRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateCorpusRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_corpus(corpus: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::Corpus

    Pass arguments to update_corpus 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:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2069

def update_corpus request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateCorpusRequest

  # 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
   = @config.rpcs.update_corpus..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.corpus&.name
    header_params["corpus.name"] = request.corpus.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_corpus, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema #update_data_schema(data_schema: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

Updates data schema inside corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::DataSchema.
p result

Overloads:

  • #update_data_schema(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to update_data_schema via a request object, either of type UpdateDataSchemaRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateDataSchemaRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_data_schema(data_schema: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::DataSchema

    Pass arguments to update_data_schema 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:

    • data_schema (::Google::Cloud::VisionAI::V1::DataSchema, ::Hash) (defaults to: nil)

      Required. The data schema's name field is used to identify the data schema to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 2538

def update_data_schema request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateDataSchemaRequest

  # 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
   = @config.rpcs.update_data_schema..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.data_schema&.name
    header_params["data_schema.name"] = request.data_schema.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_data_schema, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_index(request, options = nil) ⇒ ::Gapic::Operation #update_index(index: nil, update_mask: nil) ⇒ ::Gapic::Operation

Updates an Index under the corpus. Users can perform a metadata-only update or trigger a full index rebuild with different update_mask values.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #update_index(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_index via a request object, either of type UpdateIndexRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateIndexRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_index(index: nil, update_mask: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_index 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:

    • index (::Google::Cloud::VisionAI::V1::Index, ::Hash) (defaults to: nil)

      Required. The resource being updated.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Required. Field mask is used to specify the fields to be overwritten in the Index resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field of the resource will be overwritten if it is in the mask. Empty field mask is not allowed. If the mask is "*", it triggers a full update of the index, and also a whole rebuild of index data.

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.



1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1511

def update_index request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateIndexRequest

  # 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
   = @config.rpcs.update_index..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index&.name
    header_params["index.name"] = request.index.name
  end

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

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

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

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

#update_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation #update_index_endpoint(index_endpoint: nil, update_mask: nil) ⇒ ::Gapic::Operation

Updates an IndexEndpoint.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #update_index_endpoint(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_index_endpoint via a request object, either of type UpdateIndexEndpointRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateIndexEndpointRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_index_endpoint(index_endpoint: nil, update_mask: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_index_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:

    • index_endpoint (::Google::Cloud::VisionAI::V1::IndexEndpoint, ::Hash) (defaults to: nil)

      Required. The resource being updated.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Required. Field mask is used to specify the fields to be overwritten in the IndexEndpoint resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field of the resource will be overwritten if it is in the mask. Empty field mask is not allowed. If the mask is "*", then this is a full replacement of the resource.

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.



5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 5256

def update_index_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateIndexEndpointRequest

  # 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
   = @config.rpcs.update_index_endpoint..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index_endpoint&.name
    header_params["index_endpoint.name"] = request.index_endpoint.name
  end

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

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

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

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

#update_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig #update_search_config(search_config: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

Updates a search configuration inside a corpus.

Please follow the rules below to create a valid UpdateSearchConfigRequest. --- General Rules ---

  1. Request.search_configuration.name must already exist.
  2. Request must contain at least one non-empty search_criteria_property or facet_property.
  3. mapped_fields must not be empty, and must map to existing UGA keys.
  4. All mapped_fields must be of the same type.
  5. All mapped_fields must share the same granularity.
  6. All mapped_fields must share the same semantic SearchConfig match options. For property-specific rules, please reference the comments for FacetProperty and SearchCriteriaProperty.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchConfig.
p result

Overloads:

  • #update_search_config(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to update_search_config via a request object, either of type UpdateSearchConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateSearchConfigRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_search_config(search_config: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchConfig

    Pass arguments to update_search_config 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:

    • search_config (::Google::Cloud::VisionAI::V1::SearchConfig, ::Hash) (defaults to: nil)

      Required. The search configuration to update.

      The search configuration's name field is used to identify the resource to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated. If left unset, all field paths will be updated/overwritten.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 3881

def update_search_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateSearchConfigRequest

  # 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
   = @config.rpcs.update_search_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.search_config&.name
    header_params["search_config.name"] = request.search_config.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_search_config, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym #update_search_hypernym(search_hypernym: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

Updates a SearchHypernym inside a corpus.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

# The returned object is of type Google::Cloud::VisionAI::V1::SearchHypernym.
p result

Overloads:

  • #update_search_hypernym(request, options = nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to update_search_hypernym via a request object, either of type UpdateSearchHypernymRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UpdateSearchHypernymRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_search_hypernym(search_hypernym: nil, update_mask: nil) ⇒ ::Google::Cloud::VisionAI::V1::SearchHypernym

    Pass arguments to update_search_hypernym 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:

    • search_hypernym (::Google::Cloud::VisionAI::V1::SearchHypernym, ::Hash) (defaults to: nil)

      Required. The SearchHypernym to update. The search hypernym's name field is used to identify the search hypernym to be updated. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated. If left unset, all field paths will be updated/overwritten.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 4344

def update_search_hypernym request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UpdateSearchHypernymRequest

  # 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
   = @config.rpcs.update_search_hypernym..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.search_hypernym&.name
    header_params["search_hypernym.name"] = request.search_hypernym.name
  end

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

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

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

  @warehouse_stub.call_rpc :update_search_hypernym, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#upload_asset(request, options = nil) ⇒ ::Gapic::Operation #upload_asset(name: nil, asset_source: nil) ⇒ ::Gapic::Operation

Upload asset by specifing the asset Cloud Storage uri. For video warehouse, it requires users who call this API have read access to the cloud storage file. Once it is uploaded, it can be retrieved by GenerateRetrievalUrl API which by default, only can retrieve cloud storage files from the same project of the warehouse. To allow retrieval cloud storage files that are in a separate project, it requires to find the vision ai service account (Go to IAM, check checkbox to show "Include Google-provided role grants", search for "Cloud Vision AI Service Agent") and grant the read access of the cloud storage files to that service account.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

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

Overloads:

  • #upload_asset(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to upload_asset via a request object, either of type UploadAssetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::UploadAssetRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #upload_asset(name: nil, asset_source: nil) ⇒ ::Gapic::Operation

    Pass arguments to upload_asset 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) (defaults to: nil)

      Required. The resource name of the asset to upload. Format: projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}

    • asset_source (::Google::Cloud::VisionAI::V1::AssetSource, ::Hash) (defaults to: nil)

      The source of the asset.

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.



806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 806

def upload_asset request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::UploadAssetRequest

  # 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
   = @config.rpcs.upload_asset..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#view_collection_items(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::CollectionItem> #view_collection_items(collection: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::CollectionItem>

View items inside a collection.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the view_collection_items method.
result = client.view_collection_items 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::VisionAI::V1::CollectionItem.
  p item
end

Overloads:

  • #view_collection_items(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::CollectionItem>

    Pass arguments to view_collection_items via a request object, either of type ViewCollectionItemsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ViewCollectionItemsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #view_collection_items(collection: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::CollectionItem>

    Pass arguments to view_collection_items 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:

    • collection (::String) (defaults to: nil)

      Required. The collection to view. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of collections to return. The service may return fewer than this value. If unspecified, at most 50 collections will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ViewCollectionItemsRequest call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ViewCollectionItemsRequest must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 6302

def view_collection_items request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ViewCollectionItemsRequest

  # 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
   = @config.rpcs.view_collection_items..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.collection
    header_params["collection"] = request.collection
  end

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

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

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

  @warehouse_stub.call_rpc :view_collection_items, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :view_collection_items, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#view_indexed_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexedAsset> #view_indexed_assets(index: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexedAsset>

Lists assets inside an index.

Examples:

Basic example

require "google/cloud/vision_ai/v1"

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

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

# Call the view_indexed_assets method.
result = client.view_indexed_assets 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::VisionAI::V1::IndexedAsset.
  p item
end

Overloads:

  • #view_indexed_assets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexedAsset>

    Pass arguments to view_indexed_assets via a request object, either of type ViewIndexedAssetsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::VisionAI::V1::ViewIndexedAssetsRequest, ::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #view_indexed_assets(index: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::VisionAI::V1::IndexedAsset>

    Pass arguments to view_indexed_assets 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:

    • index (::String) (defaults to: nil)

      Required. The index that owns this collection of assets. Format: projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}

    • page_size (::Integer) (defaults to: nil)

      The maximum number of assets to return. The service may return fewer than this value. If unspecified, at most 50 assets will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ViewIndexedAssets call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ViewIndexedAssets must match the call that provided the page token.

    • filter (::String) (defaults to: nil)

      The filter applied to the returned list. Only the following filterings are supported: "asset_id = xxxx", which returns asset with specified id. "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
# File 'lib/google/cloud/vision_ai/v1/warehouse/client.rb', line 1302

def view_indexed_assets request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ViewIndexedAssetsRequest

  # 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
   = @config.rpcs.view_indexed_assets..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.index
    header_params["index"] = request.index
  end

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

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

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

  @warehouse_stub.call_rpc :view_indexed_assets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @warehouse_stub, :view_indexed_assets, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end