Class: Google::Cloud::AIPlatform::V1::FeaturestoreOnlineServingService::Rest::ServiceStub

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb

Overview

REST service stub for the FeaturestoreOnlineServingService service. Service stub contains baseline method implementations including transcoding, making the REST call, and deserialing the response.

Instance Method Summary collapse

Constructor Details

#initialize(endpoint:, endpoint_template:, universe_domain:, credentials:) ⇒ ServiceStub

Returns a new instance of ServiceStub.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 33

def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
  # These require statements are intentionally placed here to initialize
  # the REST modules only when it's required.
  require "gapic/rest"

  @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
                                               endpoint_template: endpoint_template,
                                               universe_domain: universe_domain,
                                               credentials: credentials,
                                               numeric_enums: true,
                                               raise_faraday_errors: false
end

Instance Method Details

#endpointString

The effective endpoint

Returns:

  • (String)


60
61
62
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 60

def endpoint
  @client_stub.endpoint
end

#read_feature_values(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::ReadFeatureValuesResponse

Baseline implementation for the read_feature_values REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 78

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

  verb, uri, query_string_params, body = ServiceStub.transcode_read_feature_values_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::AIPlatform::V1::ReadFeatureValuesResponse.decode_json response.body, ignore_unknown_fields: true

  yield result, operation if block_given?
  result
end

#streaming_read_feature_values(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation

Baseline implementation for the streaming_read_feature_values REST call

Parameters:

Yield Parameters:

  • chunk (::String)

    The chunk of data received during server streaming.

Returns:

  • (::Gapic::Rest::TransportOperation)

Raises:

  • (::ArgumentError)


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 113

def streaming_read_feature_values request_pb, options = nil, &block
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  verb, uri, query_string_params, body = ServiceStub.transcode_streaming_read_feature_values_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri: uri,
    body: body || "",
    params: query_string_params,
    options: options,
    is_server_streaming: true,
    &block
  )
  ::Gapic::Rest::TransportOperation.new response
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


51
52
53
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 51

def universe_domain
  @client_stub.universe_domain
end

#write_feature_values(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::WriteFeatureValuesResponse

Baseline implementation for the write_feature_values REST call

Parameters:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/rest/service_stub.rb', line 149

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

  verb, uri, query_string_params, body = ServiceStub.transcode_write_feature_values_request request_pb
  query_string_params = if query_string_params.any?
                          query_string_params.to_h { |p| p.split "=", 2 }
                        else
                          {}
                        end

  response = @client_stub.make_http_request(
    verb,
    uri:     uri,
    body:    body || "",
    params:  query_string_params,
    options: options
  )
  operation = ::Gapic::Rest::TransportOperation.new response
  result = ::Google::Cloud::AIPlatform::V1::WriteFeatureValuesResponse.decode_json response.body, ignore_unknown_fields: true

  yield result, operation if block_given?
  result
end