Class: Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb

Overview

REST client for the DocumentService service.

Service for ingesting Document information of the customer's website.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#branch_path, #document_path

Constructor Details

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

Create a new DocumentService REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.new

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

Yields:

  • (config)

    Configure the DocumentService client.

Yield Parameters:



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
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 123

def initialize
  # 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 == 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 = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
  end

  @document_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
end

Instance Attribute Details

#operations_client::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Operations (readonly)

Get the associated client for long-running operations.



159
160
161
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 159

def operations_client
  @operations_client
end

Class Method Details

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

Configure the DocumentService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all DocumentService clients
::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 60

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.timeout = 30.0
    default_config.retry_policy = {
      initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config.rpcs.import_documents.timeout = 300.0
    default_config.rpcs.import_documents.retry_policy = {
      initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

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

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



102
103
104
105
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 102

def configure
  yield @config if block_given?
  @config
end

#create_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document #create_document(parent: nil, document: nil, document_id: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

Creates a Document.

Overloads:

  • #create_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest, ::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_document(parent: nil, document: nil, document_id: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

    Pass arguments to create_document via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

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

      Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

    • document (::Google::Cloud::DiscoveryEngine::V1beta::Document, ::Hash) (defaults to: nil)

      Required. The Document to create.

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

      Required. The ID to use for the Document, which will become the final component of the Document.name.

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

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

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

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



370
371
372
373
374
375
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
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 370

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest

  # 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_document..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.create_document request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Deletes a Document.

Overloads:

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

    Pass arguments to delete_document via a request object, either of type Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest, ::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_document(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_document 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. Full resource name of Document, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

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

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

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 517

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest

  # 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_document..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.delete_document request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document #get_document(name: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

Gets a Document.

Overloads:

  • #get_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::GetDocumentRequest, ::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_document(name: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

    Pass arguments to get_document 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. Full resource name of Document, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}.

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

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

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 199

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetDocumentRequest

  # 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_document..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.get_document request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_documents(request, options = nil) ⇒ ::Gapic::Operation #import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, auto_generate_ids: nil, id_field: nil) ⇒ ::Gapic::Operation

Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.

Note: It is possible for a subset of the Documents to be successfully updated.

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest, ::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_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, auto_generate_ids: nil, id_field: nil) ⇒ ::Gapic::Operation

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

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call 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
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 651

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest

  # 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_documents..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.import_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_documents(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document> #list_documents(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document>

Gets a list of Documents.

Overloads:

  • #list_documents(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document>

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsRequest, ::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_documents(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document>

    Pass arguments to list_documents via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

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

      Required. The parent branch resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}. Use default_branch as the branch ID, to list documents under the default branch.

      If the caller does not have permission to list [Documents][]s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.

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

      Maximum number of Documents to return. If unspecified, defaults to 100. The maximum allowed value is

      1. Values above 1000 will be coerced to 1000.

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

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

      A page token ListDocumentsResponse.next_page_token, received from a previous DocumentService.ListDocuments call. Provide this to retrieve the subsequent page.

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

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
310
311
312
313
314
315
316
317
318
319
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 285

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsRequest

  # 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_documents..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.list_documents request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @document_service_stub, :list_documents, "documents", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#purge_documents(request, options = nil) ⇒ ::Gapic::Operation #purge_documents(parent: nil, filter: nil, force: nil) ⇒ ::Gapic::Operation

Permanently deletes all selected Documents in a branch.

This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.

To get a list of the Documents to be deleted, set PurgeDocumentsRequest.force to false.

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest, ::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.

  • #purge_documents(parent: nil, filter: nil, force: nil) ⇒ ::Gapic::Operation

    Pass arguments to purge_documents via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

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

      Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}.

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

      Required. Filter matching documents to purge. Only currently supported value is * (all items).

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

      Actually performs the purge. If force is set to false, return the expected purge count without deleting any documents.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 738

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest

  # 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.purge_documents..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.purge_documents request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document #update_document(document: nil, allow_missing: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

Updates a Document.

Overloads:

  • #update_document(request, options = nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

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

    Parameters:

    • request (::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest, ::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_document(document: nil, allow_missing: nil) ⇒ ::Google::Cloud::DiscoveryEngine::V1beta::Document

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

    • document (::Google::Cloud::DiscoveryEngine::V1beta::Document, ::Hash) (defaults to: nil)

      Required. The document to update/create.

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

      If the Document to update does not exist and allow_missing is not set, a NOT_FOUND error is returned.

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

      If set to true, and the Document is not found, a new Document will be created.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb', line 446

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest

  # 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_document..to_h

  # Set x-goog-api-client and x-goog-user-project 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::DiscoveryEngine::V1beta::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @document_service_stub.update_document request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end