Class: Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb

Overview

Client for the DataLabelingService service.

Service for the AI Platform Data Labeling API.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#annotated_dataset_path, #annotation_spec_set_path, #data_item_path, #dataset_path, #evaluation_job_path, #evaluation_path, #example_path, #instruction_path, #project_path

Constructor Details

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

Create a new DataLabelingService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the DataLabelingService client.

Yield Parameters:



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 253

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/datalabeling/v1beta1/data_labeling_service_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

  @data_labeling_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::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
  )

  @data_labeling_service_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
end

Instance Attribute Details

#operations_client::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Operations (readonly)

Get the associated client for long-running operations.



316
317
318
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 316

def operations_client
  @operations_client
end

Class Method Details

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

Configure the DataLabelingService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all DataLabelingService clients
::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



62
63
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 62

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "DataLabeling", "V1beta1"]
    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.rpcs.create_dataset.timeout = 30.0

    default_config.rpcs.get_dataset.timeout = 30.0
    default_config.rpcs.get_dataset.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_datasets.timeout = 30.0
    default_config.rpcs.list_datasets.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_dataset.timeout = 30.0
    default_config.rpcs.delete_dataset.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.import_data.timeout = 30.0

    default_config.rpcs.export_data.timeout = 30.0
    default_config.rpcs.export_data.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_data_item.timeout = 30.0
    default_config.rpcs.get_data_item.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_data_items.timeout = 30.0
    default_config.rpcs.list_data_items.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_annotated_dataset.timeout = 30.0
    default_config.rpcs.get_annotated_dataset.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_annotated_datasets.timeout = 30.0
    default_config.rpcs.list_annotated_datasets.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.label_image.timeout = 30.0

    default_config.rpcs.label_video.timeout = 30.0

    default_config.rpcs.label_text.timeout = 30.0

    default_config.rpcs.get_example.timeout = 30.0
    default_config.rpcs.get_example.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_examples.timeout = 30.0
    default_config.rpcs.list_examples.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.create_annotation_spec_set.timeout = 30.0

    default_config.rpcs.get_annotation_spec_set.timeout = 30.0
    default_config.rpcs.get_annotation_spec_set.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_annotation_spec_sets.timeout = 30.0
    default_config.rpcs.list_annotation_spec_sets.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_annotation_spec_set.timeout = 30.0
    default_config.rpcs.delete_annotation_spec_set.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.create_instruction.timeout = 30.0

    default_config.rpcs.get_instruction.timeout = 30.0
    default_config.rpcs.get_instruction.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_instructions.timeout = 30.0
    default_config.rpcs.list_instructions.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_instruction.timeout = 30.0
    default_config.rpcs.delete_instruction.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_evaluation.timeout = 30.0
    default_config.rpcs.get_evaluation.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.search_evaluations.timeout = 30.0
    default_config.rpcs.search_evaluations.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.search_example_comparisons.timeout = 30.0

    default_config.rpcs.create_evaluation_job.timeout = 30.0

    default_config.rpcs.update_evaluation_job.timeout = 30.0

    default_config.rpcs.get_evaluation_job.timeout = 30.0
    default_config.rpcs.get_evaluation_job.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.pause_evaluation_job.timeout = 30.0

    default_config.rpcs.resume_evaluation_job.timeout = 30.0

    default_config.rpcs.delete_evaluation_job.timeout = 30.0
    default_config.rpcs.delete_evaluation_job.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_evaluation_jobs.timeout = 30.0
    default_config.rpcs.list_evaluation_jobs.retry_policy = {
      initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

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

Configure the DataLabelingService 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:



223
224
225
226
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 223

def configure
  yield @config if block_given?
  @config
end

#create_annotation_spec_set(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet #create_annotation_spec_set(parent: nil, annotation_spec_set: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

Creates an annotation spec set by providing a set of labels.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::CreateAnnotationSpecSetRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet.
p result

Overloads:

  • #create_annotation_spec_set(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::CreateAnnotationSpecSetRequest, ::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_spec_set(parent: nil, annotation_spec_set: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

    Pass arguments to create_annotation_spec_set 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. AnnotationSpecSet resource parent, format: projects/{project_id}

    • annotation_spec_set (::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet, ::Hash) (defaults to: nil)

      Required. Annotation spec set to create. Annotation specs must be included. Only one annotation spec will be accepted for annotation specs with same display_name.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1977
1978
1979
1980
1981
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1977

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::CreateAnnotationSpecSetRequest

  # 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_spec_set..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::DataLabeling::V1beta1::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_spec_set.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_annotation_spec_set.retry_policy

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

  @data_labeling_service_stub.call_rpc :create_annotation_spec_set, 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_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset #create_dataset(parent: nil, dataset: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

Creates dataset. If success return a Dataset resource.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::CreateDatasetRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::Dataset.
p result

Overloads:

  • #create_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::CreateDatasetRequest, ::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_dataset(parent: nil, dataset: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

    Pass arguments to create_dataset 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.



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 376

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::CreateDatasetRequest

  # 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_dataset..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::DataLabeling::V1beta1::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_dataset.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_dataset.retry_policy

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

  @data_labeling_service_stub.call_rpc :create_dataset, 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_evaluation_job(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob #create_evaluation_job(parent: nil, job: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

Creates an evaluation job.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::CreateEvaluationJobRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::EvaluationJob.
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.



3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3042

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::CreateEvaluationJobRequest

  # 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_evaluation_job..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::DataLabeling::V1beta1::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_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :create_evaluation_job, 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_instruction(request, options = nil) ⇒ ::Gapic::Operation #create_instruction(parent: nil, instruction: nil) ⇒ ::Gapic::Operation

Creates an instruction for how data should be labeled.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::CreateInstructionRequest.new

# Call the create_instruction method.
result = client.create_instruction 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_instruction(request, options = nil) ⇒ ::Gapic::Operation

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::CreateInstructionRequest, ::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_instruction(parent: nil, instruction: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instruction 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. Instruction resource parent, format: projects/{project_id}

    • instruction (::Google::Cloud::DataLabeling::V1beta1::Instruction, ::Hash) (defaults to: nil)

      Required. Instruction of how to perform the labeling task.

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.



2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2347

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::CreateInstructionRequest

  # 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_instruction..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::DataLabeling::V1beta1::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_instruction.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_instruction.retry_policy

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

  @data_labeling_service_stub.call_rpc :create_instruction, 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_annotated_dataset(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_annotated_dataset(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an annotated dataset by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::DeleteAnnotatedDatasetRequest.new

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

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

Overloads:

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

    Pass arguments to delete_annotated_dataset via a request object, either of type Google::Cloud::DataLabeling::V1beta1::DeleteAnnotatedDatasetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::DeleteAnnotatedDatasetRequest, ::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_annotated_dataset(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_annotated_dataset 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 annotated dataset to delete, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1331

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::DeleteAnnotatedDatasetRequest

  # 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_annotated_dataset..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::DataLabeling::V1beta1::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_annotated_dataset.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_annotated_dataset.retry_policy

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

  @data_labeling_service_stub.call_rpc :delete_annotated_dataset, 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_spec_set(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_annotation_spec_set(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an annotation spec set by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::DeleteAnnotationSpecSetRequest.new

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

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

Overloads:

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

    Pass arguments to delete_annotation_spec_set via a request object, either of type Google::Cloud::DataLabeling::V1beta1::DeleteAnnotationSpecSetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::DeleteAnnotationSpecSetRequest, ::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_spec_set(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_annotation_spec_set 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. AnnotationSpec resource name, format: projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2252

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::DeleteAnnotationSpecSetRequest

  # 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_spec_set..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::DataLabeling::V1beta1::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_spec_set.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_annotation_spec_set.retry_policy

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

  @data_labeling_service_stub.call_rpc :delete_annotation_spec_set, 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_dataset(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_dataset(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a dataset by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::DeleteDatasetRequest.new

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

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

Overloads:

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

    Pass arguments to delete_dataset via a request object, either of type Google::Cloud::DataLabeling::V1beta1::DeleteDatasetRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::DeleteDatasetRequest, ::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_dataset(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_dataset 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. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 651

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::DeleteDatasetRequest

  # 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_dataset..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::DataLabeling::V1beta1::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_dataset.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_dataset.retry_policy

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

  @data_labeling_service_stub.call_rpc :delete_dataset, 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_evaluation_job(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_evaluation_job(name: nil) ⇒ ::Google::Protobuf::Empty

Stops and deletes an evaluation job.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::DeleteEvaluationJobRequest.new

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

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

Overloads:

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

    Pass arguments to delete_evaluation_job via a request object, either of type Google::Cloud::DataLabeling::V1beta1::DeleteEvaluationJobRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::DeleteEvaluationJobRequest, ::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_evaluation_job(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_evaluation_job 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 evaluation job that is going to be deleted. Format:

      "projects/{project_id}/evaluationJobs/{evaluation_job_id}"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3492

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::DeleteEvaluationJobRequest

  # 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_evaluation_job..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::DataLabeling::V1beta1::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_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :delete_evaluation_job, 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_instruction(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_instruction(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an instruction object by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::DeleteInstructionRequest.new

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

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

Overloads:

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

    Pass arguments to delete_instruction via a request object, either of type Google::Cloud::DataLabeling::V1beta1::DeleteInstructionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::DeleteInstructionRequest, ::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_instruction(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_instruction 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. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2624
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2624

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::DeleteInstructionRequest

  # 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_instruction..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::DataLabeling::V1beta1::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_instruction.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_instruction.retry_policy

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

  @data_labeling_service_stub.call_rpc :delete_instruction, 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

#export_data(request, options = nil) ⇒ ::Gapic::Operation #export_data(name: nil, annotated_dataset: nil, filter: nil, output_config: nil, user_email_address: nil) ⇒ ::Gapic::Operation

Exports data and annotations from dataset.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ExportDataRequest.new

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

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ExportDataRequest, ::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.

  • #export_data(name: nil, annotated_dataset: nil, filter: nil, output_config: nil, user_email_address: nil) ⇒ ::Gapic::Operation

    Pass arguments to export_data 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. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id}

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

      Required. Annotated dataset resource name. DataItem in Dataset and their annotations in specified annotated dataset will be exported. It's in format of projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}

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

      Optional. Filter is not supported at this moment.

    • output_config (::Google::Cloud::DataLabeling::V1beta1::OutputConfig, ::Hash) (defaults to: nil)

      Required. Specify the output destination.

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

      Email of the user who started the export task and should be notified by email. If empty no notification will be sent.

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.



861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 861

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ExportDataRequest

  # 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.export_data..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::DataLabeling::V1beta1::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.export_data.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.export_data.retry_policy

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

  @data_labeling_service_stub.call_rpc :export_data, 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

#get_annotated_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset #get_annotated_dataset(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset

Gets an annotated dataset by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetAnnotatedDatasetRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset.
p result

Overloads:

  • #get_annotated_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetAnnotatedDatasetRequest, ::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_annotated_dataset(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset

    Pass arguments to get_annotated_dataset 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 annotated dataset to get, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1141

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetAnnotatedDatasetRequest

  # 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_annotated_dataset..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::DataLabeling::V1beta1::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_annotated_dataset.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_annotated_dataset.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_annotated_dataset, 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_spec_set(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet #get_annotation_spec_set(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

Gets an annotation spec set by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetAnnotationSpecSetRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet.
p result

Overloads:

  • #get_annotation_spec_set(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetAnnotationSpecSetRequest, ::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_spec_set(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet

    Pass arguments to get_annotation_spec_set 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. AnnotationSpecSet resource name, format: projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2063
2064
2065
2066
2067
2068
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2063

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetAnnotationSpecSetRequest

  # 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_spec_set..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::DataLabeling::V1beta1::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_spec_set.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_annotation_spec_set.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_annotation_spec_set, 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_item(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::DataItem #get_data_item(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::DataItem

Gets a data item in a dataset by resource name. This API can be called after data are imported into dataset.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetDataItemRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::DataItem.
p result

Overloads:

  • #get_data_item(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::DataItem

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetDataItemRequest, ::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_item(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::DataItem

    Pass arguments to get_data_item 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 item to get, format: projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 950

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetDataItemRequest

  # 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_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::DataLabeling::V1beta1::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_item.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_data_item.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_data_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

#get_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset #get_dataset(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

Gets dataset by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetDatasetRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::Dataset.
p result

Overloads:

  • #get_dataset(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetDatasetRequest, ::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_dataset(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Dataset

    Pass arguments to get_dataset 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. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 462

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetDatasetRequest

  # 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_dataset..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::DataLabeling::V1beta1::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_dataset.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_dataset.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_dataset, 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_evaluation(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Evaluation #get_evaluation(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Evaluation

Gets an evaluation by resource name (to search, use projects.evaluations.search).

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetEvaluationRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::Evaluation.
p result

Overloads:

  • #get_evaluation(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Evaluation

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetEvaluationRequest, ::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_evaluation(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Evaluation

    Pass arguments to get_evaluation 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 evaluation. Format:

      "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_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/data_labeling/v1beta1/data_labeling_service/client.rb', line 2712

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetEvaluationRequest

  # 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_evaluation..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::DataLabeling::V1beta1::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_evaluation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_evaluation.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_evaluation, 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_evaluation_job(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob #get_evaluation_job(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

Gets an evaluation job by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetEvaluationJobRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::EvaluationJob.
p result

Overloads:

  • #get_evaluation_job(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetEvaluationJobRequest, ::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_evaluation_job(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

    Pass arguments to get_evaluation_job 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 evaluation job. Format:

      "projects/{project_id}/evaluationJobs/{evaluation_job_id}"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3229

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetEvaluationJobRequest

  # 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_evaluation_job..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::DataLabeling::V1beta1::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_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_evaluation_job, 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_example(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Example #get_example(name: nil, filter: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Example

Gets an example by resource name, including both data and annotation.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetExampleRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::Example.
p result

Overloads:

  • #get_example(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Example

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetExampleRequest, ::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_example(name: nil, filter: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Example

    Pass arguments to get_example 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 example, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id}

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

      Optional. An expression for filtering Examples. Filter by annotation_spec.display_name is supported. Format "annotation_spec.display_name = {display_name}"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1782

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetExampleRequest

  # 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_example..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::DataLabeling::V1beta1::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_example.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_example.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_example, 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_instruction(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Instruction #get_instruction(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Instruction

Gets an instruction by resource name.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::GetInstructionRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::Instruction.
p result

Overloads:

  • #get_instruction(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Instruction

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::GetInstructionRequest, ::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_instruction(name: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::Instruction

    Pass arguments to get_instruction 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. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2435

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::GetInstructionRequest

  # 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_instruction..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::DataLabeling::V1beta1::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_instruction.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instruction.retry_policy

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

  @data_labeling_service_stub.call_rpc :get_instruction, 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_data(request, options = nil) ⇒ ::Gapic::Operation #import_data(name: nil, input_config: nil, user_email_address: nil) ⇒ ::Gapic::Operation

Imports data into dataset based on source locations defined in request. It can be called multiple times for the same dataset. Each dataset can only have one long running operation running on it. For example, no labeling task (also long running operation) can be started while importing is still ongoing. Vice versa.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ImportDataRequest.new

# Call the import_data method.
result = client.import_data 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_data(request, options = nil) ⇒ ::Gapic::Operation

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ImportDataRequest, ::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_data(name: nil, input_config: nil, user_email_address: nil) ⇒ ::Gapic::Operation

    Pass arguments to import_data 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. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id}

    • input_config (::Google::Cloud::DataLabeling::V1beta1::InputConfig, ::Hash) (defaults to: nil)

      Required. Specify the input source of the data.

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

      Email of the user who started the import task and should be notified by email. If empty no notification will be sent.

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.



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 753

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ImportDataRequest

  # 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_data..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::DataLabeling::V1beta1::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.import_data.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_data.retry_policy

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

  @data_labeling_service_stub.call_rpc :import_data, 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

#label_image(request, options = nil) ⇒ ::Gapic::Operation #label_image(image_classification_config: nil, bounding_poly_config: nil, polyline_config: nil, segmentation_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

Starts a labeling task for image. The type of image labeling task is configured by feature in the request.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::LabelImageRequest.new

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

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::LabelImageRequest, ::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.

  • #label_image(image_classification_config: nil, bounding_poly_config: nil, polyline_config: nil, segmentation_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

    Pass arguments to label_image 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_classification_config (::Google::Cloud::DataLabeling::V1beta1::ImageClassificationConfig, ::Hash) (defaults to: nil)

      Configuration for image classification task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required.

      Note: The following fields are mutually exclusive: image_classification_config, bounding_poly_config, polyline_config, segmentation_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • bounding_poly_config (::Google::Cloud::DataLabeling::V1beta1::BoundingPolyConfig, ::Hash) (defaults to: nil)

      Configuration for bounding box and bounding poly task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required.

      Note: The following fields are mutually exclusive: bounding_poly_config, image_classification_config, polyline_config, segmentation_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • polyline_config (::Google::Cloud::DataLabeling::V1beta1::PolylineConfig, ::Hash) (defaults to: nil)

      Configuration for polyline task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required.

      Note: The following fields are mutually exclusive: polyline_config, image_classification_config, bounding_poly_config, segmentation_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • segmentation_config (::Google::Cloud::DataLabeling::V1beta1::SegmentationConfig, ::Hash) (defaults to: nil)

      Configuration for segmentation task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required.

      Note: The following fields are mutually exclusive: segmentation_config, image_classification_config, bounding_poly_config, polyline_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

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

      Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id}

    • basic_config (::Google::Cloud::DataLabeling::V1beta1::HumanAnnotationConfig, ::Hash) (defaults to: nil)

      Required. Basic human annotation config.

    • feature (::Google::Cloud::DataLabeling::V1beta1::LabelImageRequest::Feature) (defaults to: nil)

      Required. The type of image labeling task.

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.



1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1453

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::LabelImageRequest

  # 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.label_image..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::DataLabeling::V1beta1::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.label_image.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.label_image.retry_policy

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

  @data_labeling_service_stub.call_rpc :label_image, 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

#label_text(request, options = nil) ⇒ ::Gapic::Operation #label_text(text_classification_config: nil, text_entity_extraction_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

Starts a labeling task for text. The type of text labeling task is configured by feature in the request.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::LabelTextRequest.new

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

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::LabelTextRequest, ::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.

  • #label_text(text_classification_config: nil, text_entity_extraction_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

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

    • text_classification_config (::Google::Cloud::DataLabeling::V1beta1::TextClassificationConfig, ::Hash) (defaults to: nil)

      Configuration for text classification task. One of text_classification_config and text_entity_extraction_config is required.

      Note: The following fields are mutually exclusive: text_classification_config, text_entity_extraction_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • text_entity_extraction_config (::Google::Cloud::DataLabeling::V1beta1::TextEntityExtractionConfig, ::Hash) (defaults to: nil)

      Configuration for entity extraction task. One of text_classification_config and text_entity_extraction_config is required.

      Note: The following fields are mutually exclusive: text_entity_extraction_config, text_classification_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

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

      Required. Name of the data set to request labeling task, format: projects/{project_id}/datasets/{dataset_id}

    • basic_config (::Google::Cloud::DataLabeling::V1beta1::HumanAnnotationConfig, ::Hash) (defaults to: nil)

      Required. Basic human annotation config.

    • feature (::Google::Cloud::DataLabeling::V1beta1::LabelTextRequest::Feature) (defaults to: nil)

      Required. The type of text labeling task.

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.



1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1689

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::LabelTextRequest

  # 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.label_text..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::DataLabeling::V1beta1::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.label_text.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.label_text.retry_policy

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

  @data_labeling_service_stub.call_rpc :label_text, 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

#label_video(request, options = nil) ⇒ ::Gapic::Operation #label_video(video_classification_config: nil, object_detection_config: nil, object_tracking_config: nil, event_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

Starts a labeling task for video. The type of video labeling task is configured by feature in the request.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::LabelVideoRequest.new

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

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::LabelVideoRequest, ::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.

  • #label_video(video_classification_config: nil, object_detection_config: nil, object_tracking_config: nil, event_config: nil, parent: nil, basic_config: nil, feature: nil) ⇒ ::Gapic::Operation

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

    • video_classification_config (::Google::Cloud::DataLabeling::V1beta1::VideoClassificationConfig, ::Hash) (defaults to: nil)

      Configuration for video classification task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required.

      Note: The following fields are mutually exclusive: video_classification_config, object_detection_config, object_tracking_config, event_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • object_detection_config (::Google::Cloud::DataLabeling::V1beta1::ObjectDetectionConfig, ::Hash) (defaults to: nil)

      Configuration for video object detection task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required.

      Note: The following fields are mutually exclusive: object_detection_config, video_classification_config, object_tracking_config, event_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • object_tracking_config (::Google::Cloud::DataLabeling::V1beta1::ObjectTrackingConfig, ::Hash) (defaults to: nil)

      Configuration for video object tracking task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required.

      Note: The following fields are mutually exclusive: object_tracking_config, video_classification_config, object_detection_config, event_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

    • event_config (::Google::Cloud::DataLabeling::V1beta1::EventConfig, ::Hash) (defaults to: nil)

      Configuration for video event task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required.

      Note: The following fields are mutually exclusive: event_config, video_classification_config, object_detection_config, object_tracking_config. If a field in that set is populated, all other fields in the set will automatically be cleared.

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

      Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id}

    • basic_config (::Google::Cloud::DataLabeling::V1beta1::HumanAnnotationConfig, ::Hash) (defaults to: nil)

      Required. Basic human annotation config.

    • feature (::Google::Cloud::DataLabeling::V1beta1::LabelVideoRequest::Feature) (defaults to: nil)

      Required. The type of video labeling task.

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.



1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1577

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::LabelVideoRequest

  # 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.label_video..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::DataLabeling::V1beta1::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.label_video.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.label_video.retry_policy

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

  @data_labeling_service_stub.call_rpc :label_video, 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

#list_annotated_datasets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset> #list_annotated_datasets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset>

Lists annotated datasets for a dataset. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListAnnotatedDatasetsRequest.new

# Call the list_annotated_datasets method.
result = client.list_annotated_datasets 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::DataLabeling::V1beta1::AnnotatedDataset.
  p item
end

Overloads:

  • #list_annotated_datasets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListAnnotatedDatasetsRequest, ::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_annotated_datasets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotatedDataset>

    Pass arguments to list_annotated_datasets 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. Name of the dataset to list annotated datasets, format: projects/{project_id}/datasets/{dataset_id}

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

      Optional. Filter is not supported at this moment.

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListAnnotatedDatasetsResponse.next_page_token of the previous [DataLabelingService.ListAnnotatedDatasets] call. Return first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1242

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListAnnotatedDatasetsRequest

  # 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_annotated_datasets..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::DataLabeling::V1beta1::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_annotated_datasets.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_annotated_datasets.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_annotated_datasets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_annotated_datasets, 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_annotation_spec_sets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet> #list_annotation_spec_sets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet>

Lists annotation spec sets for a project. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListAnnotationSpecSetsRequest.new

# Call the list_annotation_spec_sets method.
result = client.list_annotation_spec_sets 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::DataLabeling::V1beta1::AnnotationSpecSet.
  p item
end

Overloads:

  • #list_annotation_spec_sets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListAnnotationSpecSetsRequest, ::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_annotation_spec_sets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::AnnotationSpecSet>

    Pass arguments to list_annotation_spec_sets 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. Parent of AnnotationSpecSet resource, format: projects/{project_id}

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

      Optional. Filter is not supported at this moment.

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListAnnotationSpecSetsResponse.next_page_token of the previous [DataLabelingService.ListAnnotationSpecSets] call. Return first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2164

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListAnnotationSpecSetsRequest

  # 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_annotation_spec_sets..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::DataLabeling::V1beta1::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_annotation_spec_sets.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_annotation_spec_sets.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_annotation_spec_sets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_annotation_spec_sets, 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_items(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::DataItem> #list_data_items(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::DataItem>

Lists data items in a dataset. This API can be called after data are imported into dataset. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListDataItemsRequest.new

# Call the list_data_items method.
result = client.list_data_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::DataLabeling::V1beta1::DataItem.
  p item
end

Overloads:

  • #list_data_items(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::DataItem>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListDataItemsRequest, ::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_items(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::DataItem>

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

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

      Required. Name of the dataset to list data items, format: projects/{project_id}/datasets/{dataset_id}

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

      Optional. Filter is not supported at this moment.

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListDataItemsResponse.next_page_token of the previous [DataLabelingService.ListDataItems] call. Return first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1052

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListDataItemsRequest

  # 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_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::DataLabeling::V1beta1::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_items.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_data_items.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_data_items, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_data_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

#list_datasets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Dataset> #list_datasets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Dataset>

Lists datasets under a project. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListDatasetsRequest.new

# Call the list_datasets method.
result = client.list_datasets 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::DataLabeling::V1beta1::Dataset.
  p item
end

Overloads:

  • #list_datasets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Dataset>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListDatasetsRequest, ::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_datasets(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Dataset>

    Pass arguments to list_datasets 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. Dataset resource parent, format: projects/{project_id}

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

      Optional. Filter on dataset is not supported at this moment.

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListDatasetsResponse.next_page_token of the previous [DataLabelingService.ListDatasets] call. Returns the first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 563

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListDatasetsRequest

  # 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_datasets..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::DataLabeling::V1beta1::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_datasets.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_datasets.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_datasets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_datasets, 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_evaluation_jobs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::EvaluationJob> #list_evaluation_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::EvaluationJob>

Lists all evaluation jobs within a project with possible filters. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListEvaluationJobsRequest.new

# Call the list_evaluation_jobs method.
result = client.list_evaluation_jobs 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::DataLabeling::V1beta1::EvaluationJob.
  p item
end

Overloads:

  • #list_evaluation_jobs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::EvaluationJob>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListEvaluationJobsRequest, ::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_evaluation_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::EvaluationJob>

    Pass arguments to list_evaluation_jobs 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. Evaluation job resource parent. Format: "projects/{project_id}"

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

      Optional. You can filter the jobs to list by model_id (also known as model_name, as described in EvaluationJob.modelVersion) or by evaluation job state (as described in EvaluationJob.state). To filter by both criteria, use the AND operator or the OR operator. For example, you can use the following string for your filter: "evaluationjob.model_id = {model_name} AND evaluationjob.state = {evaluation_job_state}"

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by the nextPageToken in the response to the previous request. The request returns the first page if this is empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3601

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListEvaluationJobsRequest

  # 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_evaluation_jobs..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::DataLabeling::V1beta1::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_evaluation_jobs.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_evaluation_jobs.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_evaluation_jobs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_evaluation_jobs, 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_examples(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Example> #list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Example>

Lists examples in an annotated dataset. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListExamplesRequest.new

# Call the list_examples method.
result = client.list_examples 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::DataLabeling::V1beta1::Example.
  p item
end

Overloads:

  • #list_examples(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Example>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListExamplesRequest, ::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_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Example>

    Pass arguments to list_examples 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. Example resource parent.

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

      Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format "annotation_spec.display_name = {display_name}"

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListExamplesResponse.next_page_token of the previous [DataLabelingService.ListExamples] call. Return first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
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
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 1885

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListExamplesRequest

  # 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_examples..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::DataLabeling::V1beta1::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_examples.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_examples.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_examples, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_examples, 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_instructions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Instruction> #list_instructions(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Instruction>

Lists instructions for a project. Pagination is supported.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ListInstructionsRequest.new

# Call the list_instructions method.
result = client.list_instructions 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::DataLabeling::V1beta1::Instruction.
  p item
end

Overloads:

  • #list_instructions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Instruction>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ListInstructionsRequest, ::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_instructions(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Instruction>

    Pass arguments to list_instructions 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. Instruction resource parent, format: projects/{project_id}

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

      Optional. Filter is not supported at this moment.

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by ListInstructionsResponse.next_page_token of the previous [DataLabelingService.ListInstructions] call. Return first page if empty.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2536
2537
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/data_labeling/v1beta1/data_labeling_service/client.rb', line 2536

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ListInstructionsRequest

  # 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_instructions..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::DataLabeling::V1beta1::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_instructions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instructions.retry_policy

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

  @data_labeling_service_stub.call_rpc :list_instructions, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :list_instructions, 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)


323
324
325
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 323

def logger
  @data_labeling_service_stub.logger
end

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

Pauses an evaluation job. Pausing an evaluation job that is already in a PAUSED state is a no-op.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::PauseEvaluationJobRequest.new

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

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

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::PauseEvaluationJobRequest, ::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.

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

    Pass arguments to pause_evaluation_job 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 evaluation job that is going to be paused. Format:

      "projects/{project_id}/evaluationJobs/{evaluation_job_id}"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3317

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::PauseEvaluationJobRequest

  # 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.pause_evaluation_job..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::DataLabeling::V1beta1::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.pause_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.pause_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :pause_evaluation_job, 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

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

Resumes a paused evaluation job. A deleted evaluation job can't be resumed. Resuming a running or scheduled evaluation job is a no-op.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::ResumeEvaluationJobRequest.new

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

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

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::ResumeEvaluationJobRequest, ::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.

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

    Pass arguments to resume_evaluation_job 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 evaluation job that is going to be resumed. Format:

      "projects/{project_id}/evaluationJobs/{evaluation_job_id}"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3405

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::ResumeEvaluationJobRequest

  # 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.resume_evaluation_job..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::DataLabeling::V1beta1::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.resume_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.resume_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :resume_evaluation_job, 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

#search_evaluations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Evaluation> #search_evaluations(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Evaluation>

Searches evaluations within a project.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::SearchEvaluationsRequest.new

# Call the search_evaluations method.
result = client.search_evaluations 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::DataLabeling::V1beta1::Evaluation.
  p item
end

Overloads:

  • #search_evaluations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Evaluation>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::SearchEvaluationsRequest, ::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_evaluations(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::Evaluation>

    Pass arguments to search_evaluations 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. Evaluation search parent (project ID). Format: "projects/{project_id}"

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

      Optional. To search evaluations, you can filter by the following:

      To filter by multiple critiera, use the AND operator or the OR operator. The following examples shows a string that filters by several critiera:

      "evaluationjob.evaluation_job_id = {evaluation_job_id} AND evaluationjob.model_id = {model_name} AND evaluationjob.evaluation_job_run_time_start = {timestamp_1} AND evaluationjob.evaluation_job_run_time_end = {timestamp_2} AND annotation_spec.display_name = {display_name}"

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by the nextPageToken of the response to a previous search request.

      If you don't specify this field, the API call requests the first page of the search.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2845

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::SearchEvaluationsRequest

  # 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_evaluations..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::DataLabeling::V1beta1::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.search_evaluations.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_evaluations.retry_policy

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

  @data_labeling_service_stub.call_rpc :search_evaluations, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :search_evaluations, 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_example_comparisons(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsResponse::ExampleComparison> #search_example_comparisons(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsResponse::ExampleComparison>

Searches example comparisons from an evaluation. The return format is a list of example comparisons that show ground truth and prediction(s) for a single input. Search by providing an evaluation ID.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsRequest.new

# Call the search_example_comparisons method.
result = client.search_example_comparisons 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::DataLabeling::V1beta1::SearchExampleComparisonsResponse::ExampleComparison.
  p item
end

Overloads:

  • #search_example_comparisons(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsResponse::ExampleComparison>

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsRequest, ::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_example_comparisons(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsResponse::ExampleComparison>

    Pass arguments to search_example_comparisons 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. Name of the Evaluation resource to search for example comparisons from. Format:

      "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}"

    • page_size (::Integer) (defaults to: nil)

      Optional. Requested page size. Server may return fewer results than requested. Default value is 100.

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

      Optional. A token identifying a page of results for the server to return. Typically obtained by the [nextPageToken][SearchExampleComparisons.next_page_token] of the response to a previous search rquest.

      If you don't specify this field, the API call requests the first page of the search.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 2952

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::SearchExampleComparisonsRequest

  # 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_example_comparisons..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::DataLabeling::V1beta1::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.search_example_comparisons.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_example_comparisons.retry_policy

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

  @data_labeling_service_stub.call_rpc :search_example_comparisons, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @data_labeling_service_stub, :search_example_comparisons, 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

#universe_domainString

The effective universe domain

Returns:

  • (String)


233
234
235
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 233

def universe_domain
  @data_labeling_service_stub.universe_domain
end

#update_evaluation_job(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob #update_evaluation_job(evaluation_job: nil, update_mask: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

Updates an evaluation job. You can only update certain fields of the job's EvaluationJobConfig: humanAnnotationConfig.instruction, exampleCount, and exampleSamplePercentage.

If you want to change any other aspect of the evaluation job, you must delete the job and create a new one.

Examples:

Basic example

require "google/cloud/data_labeling/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DataLabeling::V1beta1::UpdateEvaluationJobRequest.new

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

# The returned object is of type Google::Cloud::DataLabeling::V1beta1::EvaluationJob.
p result

Overloads:

  • #update_evaluation_job(request, options = nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

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

    Parameters:

    • request (::Google::Cloud::DataLabeling::V1beta1::UpdateEvaluationJobRequest, ::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_evaluation_job(evaluation_job: nil, update_mask: nil) ⇒ ::Google::Cloud::DataLabeling::V1beta1::EvaluationJob

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

    • evaluation_job (::Google::Cloud::DataLabeling::V1beta1::EvaluationJob, ::Hash) (defaults to: nil)

      Required. Evaluation job that is going to be updated.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Optional. Mask for which fields to update. You can only provide the following fields:

      • evaluationJobConfig.humanAnnotationConfig.instruction
      • evaluationJobConfig.exampleCount
      • evaluationJobConfig.exampleSamplePercentage

      You can provide more than one of these fields by separating them with commas.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
# File 'lib/google/cloud/data_labeling/v1beta1/data_labeling_service/client.rb', line 3142

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataLabeling::V1beta1::UpdateEvaluationJobRequest

  # 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_evaluation_job..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::DataLabeling::V1beta1::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.evaluation_job&.name
    header_params["evaluation_job.name"] = request.evaluation_job.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_evaluation_job.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_evaluation_job.retry_policy

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

  @data_labeling_service_stub.call_rpc :update_evaluation_job, 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