Class: Google::Cloud::Bigquery::RemoteFunctionOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/bigquery/remote_function_options.rb

Overview

RemoteFunctionOptions

Options for a remote user-defined function.

Instance Method Summary collapse

Constructor Details

#initializeRemoteFunctionOptions

Creates a new RemoteFunctionOptions object.

Examples:

require "google/cloud/bigquery"

remote_function_options = Google::Cloud::Bigquery::RemoteFunctionOptions.new.tap do |rfo|
  rfo.endpoint = "https://us-east1-my_gcf_project.cloudfunctions.net/remote_add"
  rfo.connection = "projects/my-project/locations/us-east1/connections/my-connection"
  rfo.user_defined_context = { "foo" => "bar" }
end


41
42
43
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 41

def initialize
  @gapi = Google::Apis::BigqueryV2::RemoteFunctionOptions.new
end

Instance Method Details

#connectionString

The fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service.

Format: projects/{projectId}/locations/{locationId}/connections/{connectionId}

Returns:

  • (String)

    The fully qualified name of the user-provided connection object. Returns an empty string if the connection is not configured.



78
79
80
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 78

def connection
  @gapi.connection || ""
end

#connection=(new_connection) ⇒ Object

Sets the fully qualified name of the user-provided connection object.

Parameters:

  • new_connection (String, nil)

    The new connection. Passing nil will clear the connection, indicating that no authentication information is configured for the remote service.



89
90
91
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 89

def connection= new_connection
  @gapi.connection = new_connection
end

#endpointString

The endpoint of the user-provided remote service, e.g. https://us-east1-my_gcf_project.cloudfunctions.net/remote_add.

Returns:

  • (String)

    The endpoint of the user-provided remote service. Returns an empty string if the endpoint is not configured.



52
53
54
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 52

def endpoint
  @gapi.endpoint || ""
end

#endpoint=(new_endpoint) ⇒ Object

Sets the endpoint of the user-provided remote service.

Parameters:

  • new_endpoint (String, nil)

    The new endpoint. Passing nil will clear the endpoint, indicating that no remote service is configured.



62
63
64
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 62

def endpoint= new_endpoint
  @gapi.endpoint = new_endpoint
end

#max_batching_rowsInteger

Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.

Returns:

  • (Integer)

    Max number of rows in each batch. Returns 0 if not set, which indicates that BigQuery dynamically decides the number of rows.



125
126
127
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 125

def max_batching_rows
  @gapi.max_batching_rows || 0
end

#max_batching_rows=(new_max_batching_rows) ⇒ Object

Sets the max number of rows in each batch sent to the remote service.

Parameters:

  • new_max_batching_rows (Integer, nil)

    The new max batching rows. Passing nil or 0 will reset the batch size, indicating that BigQuery should dynamically decide the number of rows in each batch.



136
137
138
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 136

def max_batching_rows= new_max_batching_rows
  @gapi.max_batching_rows = new_max_batching_rows
end

#user_defined_contextHash

User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.

Returns:

  • (Hash)

    The user-defined context. Returns an empty hash if no context is configured.



102
103
104
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 102

def user_defined_context
  @gapi.user_defined_context || {}
end

#user_defined_context=(new_user_defined_context) ⇒ Object

Sets the user-defined context.

Parameters:

  • new_user_defined_context (Hash, nil)

    The new user-defined context. Passing nil will clear the context, meaning no user-defined key-value pairs will be sent.



113
114
115
# File 'lib/google/cloud/bigquery/remote_function_options.rb', line 113

def user_defined_context= new_user_defined_context
  @gapi.user_defined_context = new_user_defined_context
end