google-cloud-recommender-v1 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/recommender/v1.rb +3 -0
- data/lib/google/cloud/recommender/v1/insight_pb.rb +60 -0
- data/lib/google/cloud/recommender/v1/recommendation_pb.rb +5 -0
- data/lib/google/cloud/recommender/v1/recommender.rb +4 -4
- data/lib/google/cloud/recommender/v1/recommender/client.rb +293 -17
- data/lib/google/cloud/recommender/v1/recommender/paths.rb +288 -20
- data/lib/google/cloud/recommender/v1/recommender_service_pb.rb +23 -0
- data/lib/google/cloud/recommender/v1/recommender_service_services_pb.rb +31 -17
- data/lib/google/cloud/recommender/v1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/cloud/recommender/v1/insight.rb +141 -0
- data/proto_docs/google/cloud/recommender/v1/recommendation.rb +17 -4
- data/proto_docs/google/cloud/recommender/v1/recommender_service.rb +83 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46fb7c89b82a0dea66ee1a8f050fef7fee2ca7f0ca80a708e0ec5da7a46078ce
|
4
|
+
data.tar.gz: f05bb2566528e5dcc18e3529748db0d9b9b4ab0e3cfdf24b4c06c4f4dfcb88b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 500a68ce669f879dd97620bb00eff11a50238f8065d74fb7538def6ccfa96de555b0b7dccba5af074906439561b12e00aae5693db35f08c91e848ab717c58749
|
7
|
+
data.tar.gz: f7954ff026b31d5ac06e4dd56251252c85f37bba6828249f2fb43fc351186f45c85d16cea443fe8ad4138bf4eb1cba918ebc2163da860a8004a91f5405a1d168
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ require "google/cloud/recommender/v1"
|
|
28
28
|
|
29
29
|
client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
|
30
30
|
request = my_create_request
|
31
|
-
response = client.
|
31
|
+
response = client.list_insights request
|
32
32
|
```
|
33
33
|
|
34
34
|
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-recommender-v1/latest)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/recommender/v1/insight.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
require 'google/protobuf/duration_pb'
|
8
|
+
require 'google/protobuf/struct_pb'
|
9
|
+
require 'google/protobuf/timestamp_pb'
|
10
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
+
add_file("google/cloud/recommender/v1/insight.proto", :syntax => :proto3) do
|
12
|
+
add_message "google.cloud.recommender.v1.Insight" do
|
13
|
+
optional :name, :string, 1
|
14
|
+
optional :description, :string, 2
|
15
|
+
repeated :target_resources, :string, 9
|
16
|
+
optional :insight_subtype, :string, 10
|
17
|
+
optional :content, :message, 3, "google.protobuf.Struct"
|
18
|
+
optional :last_refresh_time, :message, 4, "google.protobuf.Timestamp"
|
19
|
+
optional :observation_period, :message, 5, "google.protobuf.Duration"
|
20
|
+
optional :state_info, :message, 6, "google.cloud.recommender.v1.InsightStateInfo"
|
21
|
+
optional :category, :enum, 7, "google.cloud.recommender.v1.Insight.Category"
|
22
|
+
optional :etag, :string, 11
|
23
|
+
repeated :associated_recommendations, :message, 8, "google.cloud.recommender.v1.Insight.RecommendationReference"
|
24
|
+
end
|
25
|
+
add_message "google.cloud.recommender.v1.Insight.RecommendationReference" do
|
26
|
+
optional :recommendation, :string, 1
|
27
|
+
end
|
28
|
+
add_enum "google.cloud.recommender.v1.Insight.Category" do
|
29
|
+
value :CATEGORY_UNSPECIFIED, 0
|
30
|
+
value :COST, 1
|
31
|
+
value :SECURITY, 2
|
32
|
+
value :PERFORMANCE, 3
|
33
|
+
value :MANAGEABILITY, 4
|
34
|
+
end
|
35
|
+
add_message "google.cloud.recommender.v1.InsightStateInfo" do
|
36
|
+
optional :state, :enum, 1, "google.cloud.recommender.v1.InsightStateInfo.State"
|
37
|
+
map :state_metadata, :string, :string, 2
|
38
|
+
end
|
39
|
+
add_enum "google.cloud.recommender.v1.InsightStateInfo.State" do
|
40
|
+
value :STATE_UNSPECIFIED, 0
|
41
|
+
value :ACTIVE, 1
|
42
|
+
value :ACCEPTED, 2
|
43
|
+
value :DISMISSED, 3
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module Google
|
49
|
+
module Cloud
|
50
|
+
module Recommender
|
51
|
+
module V1
|
52
|
+
Insight = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Insight").msgclass
|
53
|
+
Insight::RecommendationReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Insight.RecommendationReference").msgclass
|
54
|
+
Insight::Category = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Insight.Category").enummodule
|
55
|
+
InsightStateInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.InsightStateInfo").msgclass
|
56
|
+
InsightStateInfo::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.InsightStateInfo.State").enummodule
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -20,6 +20,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
20
20
|
optional :content, :message, 7, "google.cloud.recommender.v1.RecommendationContent"
|
21
21
|
optional :state_info, :message, 10, "google.cloud.recommender.v1.RecommendationStateInfo"
|
22
22
|
optional :etag, :string, 11
|
23
|
+
repeated :associated_insights, :message, 14, "google.cloud.recommender.v1.Recommendation.InsightReference"
|
24
|
+
end
|
25
|
+
add_message "google.cloud.recommender.v1.Recommendation.InsightReference" do
|
26
|
+
optional :insight, :string, 1
|
23
27
|
end
|
24
28
|
add_message "google.cloud.recommender.v1.RecommendationContent" do
|
25
29
|
repeated :operation_groups, :message, 2, "google.cloud.recommender.v1.OperationGroup"
|
@@ -83,6 +87,7 @@ module Google
|
|
83
87
|
module Recommender
|
84
88
|
module V1
|
85
89
|
Recommendation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Recommendation").msgclass
|
90
|
+
Recommendation::InsightReference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Recommendation.InsightReference").msgclass
|
86
91
|
RecommendationContent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.RecommendationContent").msgclass
|
87
92
|
OperationGroup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.OperationGroup").msgclass
|
88
93
|
Operation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.Operation").msgclass
|
@@ -31,10 +31,10 @@ module Google
|
|
31
31
|
module Recommender
|
32
32
|
module V1
|
33
33
|
##
|
34
|
-
# Provides recommendations for cloud customers for various
|
35
|
-
# performance optimization, cost savings, reliability, feature
|
36
|
-
#
|
37
|
-
# resources, configuration and monitoring metrics.
|
34
|
+
# Provides insights and recommendations for cloud customers for various
|
35
|
+
# categories like performance optimization, cost savings, reliability, feature
|
36
|
+
# discovery, etc. Insights and recommendations are generated automatically
|
37
|
+
# based on analysis of user resources, configuration and monitoring metrics.
|
38
38
|
#
|
39
39
|
# To load this service and instantiate a client:
|
40
40
|
#
|
@@ -27,10 +27,10 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Client for the Recommender service.
|
29
29
|
#
|
30
|
-
# Provides recommendations for cloud customers for various
|
31
|
-
# performance optimization, cost savings, reliability, feature
|
32
|
-
#
|
33
|
-
# resources, configuration and monitoring metrics.
|
30
|
+
# Provides insights and recommendations for cloud customers for various
|
31
|
+
# categories like performance optimization, cost savings, reliability, feature
|
32
|
+
# discovery, etc. Insights and recommendations are generated automatically
|
33
|
+
# based on analysis of user resources, configuration and monitoring metrics.
|
34
34
|
#
|
35
35
|
class Client
|
36
36
|
include Paths
|
@@ -68,12 +68,30 @@ module Google
|
|
68
68
|
end
|
69
69
|
default_config = Client::Configuration.new parent_config
|
70
70
|
|
71
|
+
default_config.rpcs.list_insights.timeout = 60.0
|
72
|
+
default_config.rpcs.list_insights.retry_policy = {
|
73
|
+
initial_delay: 0.1,
|
74
|
+
max_delay: 60.0,
|
75
|
+
multiplier: 1.3,
|
76
|
+
retry_codes: [4, 14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.get_insight.timeout = 60.0
|
80
|
+
default_config.rpcs.get_insight.retry_policy = {
|
81
|
+
initial_delay: 0.1,
|
82
|
+
max_delay: 60.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: [4, 14]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.mark_insight_accepted.timeout = 60.0
|
88
|
+
|
71
89
|
default_config.rpcs.list_recommendations.timeout = 60.0
|
72
90
|
default_config.rpcs.list_recommendations.retry_policy = {
|
73
91
|
initial_delay: 0.1,
|
74
92
|
max_delay: 60.0,
|
75
93
|
multiplier: 1.3,
|
76
|
-
retry_codes: [
|
94
|
+
retry_codes: [4, 14]
|
77
95
|
}
|
78
96
|
|
79
97
|
default_config.rpcs.get_recommendation.timeout = 60.0
|
@@ -81,7 +99,7 @@ module Google
|
|
81
99
|
initial_delay: 0.1,
|
82
100
|
max_delay: 60.0,
|
83
101
|
multiplier: 1.3,
|
84
|
-
retry_codes: [
|
102
|
+
retry_codes: [4, 14]
|
85
103
|
}
|
86
104
|
|
87
105
|
default_config.rpcs.mark_recommendation_claimed.timeout = 60.0
|
@@ -169,6 +187,239 @@ module Google
|
|
169
187
|
|
170
188
|
# Service calls
|
171
189
|
|
190
|
+
##
|
191
|
+
# Lists insights for a Cloud project. Requires the recommender.*.list IAM
|
192
|
+
# permission for the specified insight type.
|
193
|
+
#
|
194
|
+
# @overload list_insights(request, options = nil)
|
195
|
+
# Pass arguments to `list_insights` via a request object, either of type
|
196
|
+
# {::Google::Cloud::Recommender::V1::ListInsightsRequest} or an equivalent Hash.
|
197
|
+
#
|
198
|
+
# @param request [::Google::Cloud::Recommender::V1::ListInsightsRequest, ::Hash]
|
199
|
+
# A request object representing the call parameters. Required. To specify no
|
200
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
201
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
202
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
203
|
+
#
|
204
|
+
# @overload list_insights(parent: nil, page_size: nil, page_token: nil, filter: nil)
|
205
|
+
# Pass arguments to `list_insights` via keyword arguments. Note that at
|
206
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
207
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
208
|
+
#
|
209
|
+
# @param parent [::String]
|
210
|
+
# Required. The container resource on which to execute the request.
|
211
|
+
# Acceptable formats:
|
212
|
+
#
|
213
|
+
# 1.
|
214
|
+
# "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
|
215
|
+
#
|
216
|
+
# LOCATION here refers to GCP Locations:
|
217
|
+
# https://cloud.google.com/about/locations/
|
218
|
+
# INSIGHT_TYPE_ID refers to supported insight types:
|
219
|
+
# https://cloud.google.com/recommender/docs/insights/insight-types.)
|
220
|
+
# @param page_size [::Integer]
|
221
|
+
# Optional. The maximum number of results to return from this request. Non-positive
|
222
|
+
# values are ignored. If not specified, the server will determine the number
|
223
|
+
# of results to return.
|
224
|
+
# @param page_token [::String]
|
225
|
+
# Optional. If present, retrieves the next batch of results from the preceding call to
|
226
|
+
# this method. `page_token` must be the value of `next_page_token` from the
|
227
|
+
# previous response. The values of other method parameters must be identical
|
228
|
+
# to those in the previous call.
|
229
|
+
# @param filter [::String]
|
230
|
+
# Optional. Filter expression to restrict the insights returned. Supported
|
231
|
+
# filter fields: state
|
232
|
+
# Eg: `state:"DISMISSED" or state:"ACTIVE"
|
233
|
+
#
|
234
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
235
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>]
|
236
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
237
|
+
#
|
238
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>]
|
239
|
+
#
|
240
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
241
|
+
#
|
242
|
+
def list_insights request, options = nil
|
243
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
244
|
+
|
245
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::ListInsightsRequest
|
246
|
+
|
247
|
+
# Converts hash and nil to an options object
|
248
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
249
|
+
|
250
|
+
# Customize the options with defaults
|
251
|
+
metadata = @config.rpcs.list_insights.metadata.to_h
|
252
|
+
|
253
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
254
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
255
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
256
|
+
gapic_version: ::Google::Cloud::Recommender::V1::VERSION
|
257
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
258
|
+
|
259
|
+
header_params = {
|
260
|
+
"parent" => request.parent
|
261
|
+
}
|
262
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
263
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
264
|
+
|
265
|
+
options.apply_defaults timeout: @config.rpcs.list_insights.timeout,
|
266
|
+
metadata: metadata,
|
267
|
+
retry_policy: @config.rpcs.list_insights.retry_policy
|
268
|
+
options.apply_defaults metadata: @config.metadata,
|
269
|
+
retry_policy: @config.retry_policy
|
270
|
+
|
271
|
+
@recommender_stub.call_rpc :list_insights, request, options: options do |response, operation|
|
272
|
+
response = ::Gapic::PagedEnumerable.new @recommender_stub, :list_insights, request, response, operation, options
|
273
|
+
yield response, operation if block_given?
|
274
|
+
return response
|
275
|
+
end
|
276
|
+
rescue ::GRPC::BadStatus => e
|
277
|
+
raise ::Google::Cloud::Error.from_error(e)
|
278
|
+
end
|
279
|
+
|
280
|
+
##
|
281
|
+
# Gets the requested insight. Requires the recommender.*.get IAM permission
|
282
|
+
# for the specified insight type.
|
283
|
+
#
|
284
|
+
# @overload get_insight(request, options = nil)
|
285
|
+
# Pass arguments to `get_insight` via a request object, either of type
|
286
|
+
# {::Google::Cloud::Recommender::V1::GetInsightRequest} or an equivalent Hash.
|
287
|
+
#
|
288
|
+
# @param request [::Google::Cloud::Recommender::V1::GetInsightRequest, ::Hash]
|
289
|
+
# A request object representing the call parameters. Required. To specify no
|
290
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
291
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
292
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
293
|
+
#
|
294
|
+
# @overload get_insight(name: nil)
|
295
|
+
# Pass arguments to `get_insight` via keyword arguments. Note that at
|
296
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
297
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
298
|
+
#
|
299
|
+
# @param name [::String]
|
300
|
+
# Required. Name of the insight.
|
301
|
+
#
|
302
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
303
|
+
# @yieldparam response [::Google::Cloud::Recommender::V1::Insight]
|
304
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
305
|
+
#
|
306
|
+
# @return [::Google::Cloud::Recommender::V1::Insight]
|
307
|
+
#
|
308
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
309
|
+
#
|
310
|
+
def get_insight request, options = nil
|
311
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
312
|
+
|
313
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetInsightRequest
|
314
|
+
|
315
|
+
# Converts hash and nil to an options object
|
316
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
317
|
+
|
318
|
+
# Customize the options with defaults
|
319
|
+
metadata = @config.rpcs.get_insight.metadata.to_h
|
320
|
+
|
321
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
322
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
323
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
324
|
+
gapic_version: ::Google::Cloud::Recommender::V1::VERSION
|
325
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
326
|
+
|
327
|
+
header_params = {
|
328
|
+
"name" => request.name
|
329
|
+
}
|
330
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
331
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
332
|
+
|
333
|
+
options.apply_defaults timeout: @config.rpcs.get_insight.timeout,
|
334
|
+
metadata: metadata,
|
335
|
+
retry_policy: @config.rpcs.get_insight.retry_policy
|
336
|
+
options.apply_defaults metadata: @config.metadata,
|
337
|
+
retry_policy: @config.retry_policy
|
338
|
+
|
339
|
+
@recommender_stub.call_rpc :get_insight, request, options: options do |response, operation|
|
340
|
+
yield response, operation if block_given?
|
341
|
+
return response
|
342
|
+
end
|
343
|
+
rescue ::GRPC::BadStatus => e
|
344
|
+
raise ::Google::Cloud::Error.from_error(e)
|
345
|
+
end
|
346
|
+
|
347
|
+
##
|
348
|
+
# Marks the Insight State as Accepted. Users can use this method to
|
349
|
+
# indicate to the Recommender API that they have applied some action based
|
350
|
+
# on the insight. This stops the insight content from being updated.
|
351
|
+
#
|
352
|
+
# MarkInsightAccepted can be applied to insights in ACTIVE state. Requires
|
353
|
+
# the recommender.*.update IAM permission for the specified insight.
|
354
|
+
#
|
355
|
+
# @overload mark_insight_accepted(request, options = nil)
|
356
|
+
# Pass arguments to `mark_insight_accepted` via a request object, either of type
|
357
|
+
# {::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest} or an equivalent Hash.
|
358
|
+
#
|
359
|
+
# @param request [::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest, ::Hash]
|
360
|
+
# A request object representing the call parameters. Required. To specify no
|
361
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
362
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
363
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
364
|
+
#
|
365
|
+
# @overload mark_insight_accepted(name: nil, state_metadata: nil, etag: nil)
|
366
|
+
# Pass arguments to `mark_insight_accepted` via keyword arguments. Note that at
|
367
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
368
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
369
|
+
#
|
370
|
+
# @param name [::String]
|
371
|
+
# Required. Name of the insight.
|
372
|
+
# @param state_metadata [::Hash{::String => ::String}]
|
373
|
+
# Optional. State properties user wish to include with this state. Full replace of the
|
374
|
+
# current state_metadata.
|
375
|
+
# @param etag [::String]
|
376
|
+
# Required. Fingerprint of the Insight. Provides optimistic locking.
|
377
|
+
#
|
378
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
379
|
+
# @yieldparam response [::Google::Cloud::Recommender::V1::Insight]
|
380
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
381
|
+
#
|
382
|
+
# @return [::Google::Cloud::Recommender::V1::Insight]
|
383
|
+
#
|
384
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
385
|
+
#
|
386
|
+
def mark_insight_accepted request, options = nil
|
387
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
388
|
+
|
389
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest
|
390
|
+
|
391
|
+
# Converts hash and nil to an options object
|
392
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
393
|
+
|
394
|
+
# Customize the options with defaults
|
395
|
+
metadata = @config.rpcs.mark_insight_accepted.metadata.to_h
|
396
|
+
|
397
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
398
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
399
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
400
|
+
gapic_version: ::Google::Cloud::Recommender::V1::VERSION
|
401
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
402
|
+
|
403
|
+
header_params = {
|
404
|
+
"name" => request.name
|
405
|
+
}
|
406
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
407
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
408
|
+
|
409
|
+
options.apply_defaults timeout: @config.rpcs.mark_insight_accepted.timeout,
|
410
|
+
metadata: metadata,
|
411
|
+
retry_policy: @config.rpcs.mark_insight_accepted.retry_policy
|
412
|
+
options.apply_defaults metadata: @config.metadata,
|
413
|
+
retry_policy: @config.retry_policy
|
414
|
+
|
415
|
+
@recommender_stub.call_rpc :mark_insight_accepted, request, options: options do |response, operation|
|
416
|
+
yield response, operation if block_given?
|
417
|
+
return response
|
418
|
+
end
|
419
|
+
rescue ::GRPC::BadStatus => e
|
420
|
+
raise ::Google::Cloud::Error.from_error(e)
|
421
|
+
end
|
422
|
+
|
172
423
|
##
|
173
424
|
# Lists recommendations for a Cloud project. Requires the recommender.*.list
|
174
425
|
# IAM permission for the specified recommender.
|
@@ -197,6 +448,8 @@ module Google
|
|
197
448
|
#
|
198
449
|
# LOCATION here refers to GCP Locations:
|
199
450
|
# https://cloud.google.com/about/locations/
|
451
|
+
# RECOMMENDER_ID refers to supported recommenders:
|
452
|
+
# https://cloud.google.com/recommender/docs/recommenders.
|
200
453
|
# @param page_size [::Integer]
|
201
454
|
# Optional. The maximum number of results to return from this request. Non-positive
|
202
455
|
# values are ignored. If not specified, the server will determine the number
|
@@ -325,10 +578,10 @@ module Google
|
|
325
578
|
end
|
326
579
|
|
327
580
|
##
|
328
|
-
#
|
581
|
+
# Marks the Recommendation State as Claimed. Users can use this method to
|
329
582
|
# indicate to the Recommender API that they are starting to apply the
|
330
583
|
# recommendation themselves. This stops the recommendation content from being
|
331
|
-
# updated.
|
584
|
+
# updated. Associated insights are frozen and placed in the ACCEPTED state.
|
332
585
|
#
|
333
586
|
# MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
|
334
587
|
# SUCCEEDED, FAILED, or ACTIVE state.
|
@@ -407,10 +660,11 @@ module Google
|
|
407
660
|
end
|
408
661
|
|
409
662
|
##
|
410
|
-
#
|
663
|
+
# Marks the Recommendation State as Succeeded. Users can use this method to
|
411
664
|
# indicate to the Recommender API that they have applied the recommendation
|
412
665
|
# themselves, and the operation was successful. This stops the recommendation
|
413
|
-
# content from being updated.
|
666
|
+
# content from being updated. Associated insights are frozen and placed in
|
667
|
+
# the ACCEPTED state.
|
414
668
|
#
|
415
669
|
# MarkRecommendationSucceeded can be applied to recommendations in ACTIVE,
|
416
670
|
# CLAIMED, SUCCEEDED, or FAILED state.
|
@@ -489,10 +743,11 @@ module Google
|
|
489
743
|
end
|
490
744
|
|
491
745
|
##
|
492
|
-
#
|
746
|
+
# Marks the Recommendation State as Failed. Users can use this method to
|
493
747
|
# indicate to the Recommender API that they have applied the recommendation
|
494
748
|
# themselves, and the operation failed. This stops the recommendation content
|
495
|
-
# from being updated.
|
749
|
+
# from being updated. Associated insights are frozen and placed in the
|
750
|
+
# ACCEPTED state.
|
496
751
|
#
|
497
752
|
# MarkRecommendationFailed can be applied to recommendations in ACTIVE,
|
498
753
|
# CLAIMED, SUCCEEDED, or FAILED state.
|
@@ -585,19 +840,19 @@ module Google
|
|
585
840
|
#
|
586
841
|
# # Examples
|
587
842
|
#
|
588
|
-
# To modify the global config, setting the timeout for
|
843
|
+
# To modify the global config, setting the timeout for list_insights
|
589
844
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
590
845
|
#
|
591
846
|
# ::Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
|
592
847
|
# config.timeout = 10.0
|
593
|
-
# config.rpcs.
|
848
|
+
# config.rpcs.list_insights.timeout = 20.0
|
594
849
|
# end
|
595
850
|
#
|
596
851
|
# To apply the above configuration only to a new client:
|
597
852
|
#
|
598
853
|
# client = ::Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
|
599
854
|
# config.timeout = 10.0
|
600
|
-
# config.rpcs.
|
855
|
+
# config.rpcs.list_insights.timeout = 20.0
|
601
856
|
# end
|
602
857
|
#
|
603
858
|
# @!attribute [rw] endpoint
|
@@ -655,7 +910,7 @@ module Google
|
|
655
910
|
|
656
911
|
config_attr :endpoint, "recommender.googleapis.com", ::String
|
657
912
|
config_attr :credentials, nil do |value|
|
658
|
-
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
913
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
659
914
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
660
915
|
allowed.any? { |klass| klass === value }
|
661
916
|
end
|
@@ -695,7 +950,7 @@ module Google
|
|
695
950
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
696
951
|
# the following configuration fields:
|
697
952
|
#
|
698
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
953
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
699
954
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
700
955
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
701
956
|
# include the following keys:
|
@@ -706,6 +961,21 @@ module Google
|
|
706
961
|
# trigger a retry.
|
707
962
|
#
|
708
963
|
class Rpcs
|
964
|
+
##
|
965
|
+
# RPC-specific configuration for `list_insights`
|
966
|
+
# @return [::Gapic::Config::Method]
|
967
|
+
#
|
968
|
+
attr_reader :list_insights
|
969
|
+
##
|
970
|
+
# RPC-specific configuration for `get_insight`
|
971
|
+
# @return [::Gapic::Config::Method]
|
972
|
+
#
|
973
|
+
attr_reader :get_insight
|
974
|
+
##
|
975
|
+
# RPC-specific configuration for `mark_insight_accepted`
|
976
|
+
# @return [::Gapic::Config::Method]
|
977
|
+
#
|
978
|
+
attr_reader :mark_insight_accepted
|
709
979
|
##
|
710
980
|
# RPC-specific configuration for `list_recommendations`
|
711
981
|
# @return [::Gapic::Config::Method]
|
@@ -734,6 +1004,12 @@ module Google
|
|
734
1004
|
|
735
1005
|
# @private
|
736
1006
|
def initialize parent_rpcs = nil
|
1007
|
+
list_insights_config = parent_rpcs&.list_insights if parent_rpcs&.respond_to? :list_insights
|
1008
|
+
@list_insights = ::Gapic::Config::Method.new list_insights_config
|
1009
|
+
get_insight_config = parent_rpcs&.get_insight if parent_rpcs&.respond_to? :get_insight
|
1010
|
+
@get_insight = ::Gapic::Config::Method.new get_insight_config
|
1011
|
+
mark_insight_accepted_config = parent_rpcs&.mark_insight_accepted if parent_rpcs&.respond_to? :mark_insight_accepted
|
1012
|
+
@mark_insight_accepted = ::Gapic::Config::Method.new mark_insight_accepted_config
|
737
1013
|
list_recommendations_config = parent_rpcs&.list_recommendations if parent_rpcs&.respond_to? :list_recommendations
|
738
1014
|
@list_recommendations = ::Gapic::Config::Method.new list_recommendations_config
|
739
1015
|
get_recommendation_config = parent_rpcs&.get_recommendation if parent_rpcs&.respond_to? :get_recommendation
|