google-cloud-recommender-v1 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fa6709702cbfa76e63fc80af13987becad8f6a02a251a867ffb38be92678419
4
- data.tar.gz: 4b94202ff71a5d024df9e63eaa60afd34166b955e4dad6c571c488839b46c48c
3
+ metadata.gz: beae71e611f6079030b92e7b99760bc720dcc40ea73de75cf327f94476eb10d9
4
+ data.tar.gz: 9f6b442b44b2d755d6221655b0f3e443442a045fc9b7b6105d449099221706e1
5
5
  SHA512:
6
- metadata.gz: 4357f1e257fd83e1d6dd908ccd2566243f7131cc0c92e1022e14cfe0a6d00a163dd30f6e4f39f807ecf852c6c8cdb9be50492253be3d5618a3879d76f77a5022
7
- data.tar.gz: e2f75c28174c6fa73715ef818ea5d98543012c080922a8010053ee6ce9a2fcad242ca13848cc063bb1b4cc4f9499f1cebb6d978904c4a882fc7337c641100cb7
6
+ metadata.gz: d27b855b1b9f8af0b6a1c65372343c991cb809bf8780df4b179a0aaad8291e38e268af02177876da04ff833896d3c31da0b244690fb050c2f2945dd0349fa1af
7
+ data.tar.gz: 81b7ecdc10976e822addb75a78877cdb5b514d1a71674c0d0c7f35eea7a9334ca940272040d18356ad96bc51a13cc5d38c72cf924158d848b312b2bb6b243a82
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.list_recommendations request
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 categories like
35
- # performance optimization, cost savings, reliability, feature discovery, etc.
36
- # These recommendations are generated automatically based on analysis of user
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 categories like
31
- # performance optimization, cost savings, reliability, feature discovery, etc.
32
- # These recommendations are generated automatically based on analysis of user
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
@@ -169,6 +169,237 @@ module Google
169
169
 
170
170
  # Service calls
171
171
 
172
+ ##
173
+ # Lists insights for a Cloud project. Requires the recommender.*.list IAM
174
+ # permission for the specified insight type.
175
+ #
176
+ # @overload list_insights(request, options = nil)
177
+ # Pass arguments to `list_insights` via a request object, either of type
178
+ # {::Google::Cloud::Recommender::V1::ListInsightsRequest} or an equivalent Hash.
179
+ #
180
+ # @param request [::Google::Cloud::Recommender::V1::ListInsightsRequest, ::Hash]
181
+ # A request object representing the call parameters. Required. To specify no
182
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
183
+ # @param options [::Gapic::CallOptions, ::Hash]
184
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
185
+ #
186
+ # @overload list_insights(parent: nil, page_size: nil, page_token: nil, filter: nil)
187
+ # Pass arguments to `list_insights` via keyword arguments. Note that at
188
+ # least one keyword argument is required. To specify no parameters, or to keep all
189
+ # the default parameter values, pass an empty Hash as a request object (see above).
190
+ #
191
+ # @param parent [::String]
192
+ # Required. The container resource on which to execute the request.
193
+ # Acceptable formats:
194
+ #
195
+ # 1.
196
+ # "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
197
+ #
198
+ # LOCATION here refers to GCP Locations:
199
+ # https://cloud.google.com/about/locations/
200
+ # @param page_size [::Integer]
201
+ # Optional. The maximum number of results to return from this request. Non-positive
202
+ # values are ignored. If not specified, the server will determine the number
203
+ # of results to return.
204
+ # @param page_token [::String]
205
+ # Optional. If present, retrieves the next batch of results from the preceding call to
206
+ # this method. `page_token` must be the value of `next_page_token` from the
207
+ # previous response. The values of other method parameters must be identical
208
+ # to those in the previous call.
209
+ # @param filter [::String]
210
+ # Optional. Filter expression to restrict the insights returned. Supported
211
+ # filter fields: state
212
+ # Eg: `state:"DISMISSED" or state:"ACTIVE"
213
+ #
214
+ # @yield [response, operation] Access the result along with the RPC operation
215
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>]
216
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
217
+ #
218
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>]
219
+ #
220
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
221
+ #
222
+ def list_insights request, options = nil
223
+ raise ::ArgumentError, "request must be provided" if request.nil?
224
+
225
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::ListInsightsRequest
226
+
227
+ # Converts hash and nil to an options object
228
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
229
+
230
+ # Customize the options with defaults
231
+ metadata = @config.rpcs.list_insights.metadata.to_h
232
+
233
+ # Set x-goog-api-client and x-goog-user-project headers
234
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
235
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
236
+ gapic_version: ::Google::Cloud::Recommender::V1::VERSION
237
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
238
+
239
+ header_params = {
240
+ "parent" => request.parent
241
+ }
242
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
243
+ metadata[:"x-goog-request-params"] ||= request_params_header
244
+
245
+ options.apply_defaults timeout: @config.rpcs.list_insights.timeout,
246
+ metadata: metadata,
247
+ retry_policy: @config.rpcs.list_insights.retry_policy
248
+ options.apply_defaults metadata: @config.metadata,
249
+ retry_policy: @config.retry_policy
250
+
251
+ @recommender_stub.call_rpc :list_insights, request, options: options do |response, operation|
252
+ response = ::Gapic::PagedEnumerable.new @recommender_stub, :list_insights, request, response, operation, options
253
+ yield response, operation if block_given?
254
+ return response
255
+ end
256
+ rescue ::GRPC::BadStatus => e
257
+ raise ::Google::Cloud::Error.from_error(e)
258
+ end
259
+
260
+ ##
261
+ # Gets the requested insight. Requires the recommender.*.get IAM permission
262
+ # for the specified insight type.
263
+ #
264
+ # @overload get_insight(request, options = nil)
265
+ # Pass arguments to `get_insight` via a request object, either of type
266
+ # {::Google::Cloud::Recommender::V1::GetInsightRequest} or an equivalent Hash.
267
+ #
268
+ # @param request [::Google::Cloud::Recommender::V1::GetInsightRequest, ::Hash]
269
+ # A request object representing the call parameters. Required. To specify no
270
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
271
+ # @param options [::Gapic::CallOptions, ::Hash]
272
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
273
+ #
274
+ # @overload get_insight(name: nil)
275
+ # Pass arguments to `get_insight` via keyword arguments. Note that at
276
+ # least one keyword argument is required. To specify no parameters, or to keep all
277
+ # the default parameter values, pass an empty Hash as a request object (see above).
278
+ #
279
+ # @param name [::String]
280
+ # Required. Name of the insight.
281
+ #
282
+ # @yield [response, operation] Access the result along with the RPC operation
283
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Insight]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
285
+ #
286
+ # @return [::Google::Cloud::Recommender::V1::Insight]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
+ #
290
+ def get_insight request, options = nil
291
+ raise ::ArgumentError, "request must be provided" if request.nil?
292
+
293
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetInsightRequest
294
+
295
+ # Converts hash and nil to an options object
296
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
297
+
298
+ # Customize the options with defaults
299
+ metadata = @config.rpcs.get_insight.metadata.to_h
300
+
301
+ # Set x-goog-api-client and x-goog-user-project headers
302
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
303
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
304
+ gapic_version: ::Google::Cloud::Recommender::V1::VERSION
305
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
+
307
+ header_params = {
308
+ "name" => request.name
309
+ }
310
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
+ metadata[:"x-goog-request-params"] ||= request_params_header
312
+
313
+ options.apply_defaults timeout: @config.rpcs.get_insight.timeout,
314
+ metadata: metadata,
315
+ retry_policy: @config.rpcs.get_insight.retry_policy
316
+ options.apply_defaults metadata: @config.metadata,
317
+ retry_policy: @config.retry_policy
318
+
319
+ @recommender_stub.call_rpc :get_insight, request, options: options do |response, operation|
320
+ yield response, operation if block_given?
321
+ return response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Marks the Insight State as Accepted. Users can use this method to
329
+ # indicate to the Recommender API that they have applied some action based
330
+ # on the insight. This stops the insight content from being updated.
331
+ #
332
+ # MarkInsightAccepted can be applied to insights in ACTIVE state. Requires
333
+ # the recommender.*.update IAM permission for the specified insight.
334
+ #
335
+ # @overload mark_insight_accepted(request, options = nil)
336
+ # Pass arguments to `mark_insight_accepted` via a request object, either of type
337
+ # {::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest} or an equivalent Hash.
338
+ #
339
+ # @param request [::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest, ::Hash]
340
+ # A request object representing the call parameters. Required. To specify no
341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
342
+ # @param options [::Gapic::CallOptions, ::Hash]
343
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
344
+ #
345
+ # @overload mark_insight_accepted(name: nil, state_metadata: nil, etag: nil)
346
+ # Pass arguments to `mark_insight_accepted` via keyword arguments. Note that at
347
+ # least one keyword argument is required. To specify no parameters, or to keep all
348
+ # the default parameter values, pass an empty Hash as a request object (see above).
349
+ #
350
+ # @param name [::String]
351
+ # Required. Name of the insight.
352
+ # @param state_metadata [::Hash{::String => ::String}]
353
+ # Optional. State properties user wish to include with this state. Full replace of the
354
+ # current state_metadata.
355
+ # @param etag [::String]
356
+ # Required. Fingerprint of the Insight. Provides optimistic locking.
357
+ #
358
+ # @yield [response, operation] Access the result along with the RPC operation
359
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Insight]
360
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
361
+ #
362
+ # @return [::Google::Cloud::Recommender::V1::Insight]
363
+ #
364
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
365
+ #
366
+ def mark_insight_accepted request, options = nil
367
+ raise ::ArgumentError, "request must be provided" if request.nil?
368
+
369
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest
370
+
371
+ # Converts hash and nil to an options object
372
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
373
+
374
+ # Customize the options with defaults
375
+ metadata = @config.rpcs.mark_insight_accepted.metadata.to_h
376
+
377
+ # Set x-goog-api-client and x-goog-user-project headers
378
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
379
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
380
+ gapic_version: ::Google::Cloud::Recommender::V1::VERSION
381
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
382
+
383
+ header_params = {
384
+ "name" => request.name
385
+ }
386
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
387
+ metadata[:"x-goog-request-params"] ||= request_params_header
388
+
389
+ options.apply_defaults timeout: @config.rpcs.mark_insight_accepted.timeout,
390
+ metadata: metadata,
391
+ retry_policy: @config.rpcs.mark_insight_accepted.retry_policy
392
+ options.apply_defaults metadata: @config.metadata,
393
+ retry_policy: @config.retry_policy
394
+
395
+ @recommender_stub.call_rpc :mark_insight_accepted, request, options: options do |response, operation|
396
+ yield response, operation if block_given?
397
+ return response
398
+ end
399
+ rescue ::GRPC::BadStatus => e
400
+ raise ::Google::Cloud::Error.from_error(e)
401
+ end
402
+
172
403
  ##
173
404
  # Lists recommendations for a Cloud project. Requires the recommender.*.list
174
405
  # IAM permission for the specified recommender.
@@ -325,10 +556,10 @@ module Google
325
556
  end
326
557
 
327
558
  ##
328
- # Mark the Recommendation State as Claimed. Users can use this method to
559
+ # Marks the Recommendation State as Claimed. Users can use this method to
329
560
  # indicate to the Recommender API that they are starting to apply the
330
561
  # recommendation themselves. This stops the recommendation content from being
331
- # updated.
562
+ # updated. Associated insights are frozen and placed in the ACCEPTED state.
332
563
  #
333
564
  # MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
334
565
  # SUCCEEDED, FAILED, or ACTIVE state.
@@ -407,10 +638,11 @@ module Google
407
638
  end
408
639
 
409
640
  ##
410
- # Mark the Recommendation State as Succeeded. Users can use this method to
641
+ # Marks the Recommendation State as Succeeded. Users can use this method to
411
642
  # indicate to the Recommender API that they have applied the recommendation
412
643
  # themselves, and the operation was successful. This stops the recommendation
413
- # content from being updated.
644
+ # content from being updated. Associated insights are frozen and placed in
645
+ # the ACCEPTED state.
414
646
  #
415
647
  # MarkRecommendationSucceeded can be applied to recommendations in ACTIVE,
416
648
  # CLAIMED, SUCCEEDED, or FAILED state.
@@ -489,10 +721,11 @@ module Google
489
721
  end
490
722
 
491
723
  ##
492
- # Mark the Recommendation State as Failed. Users can use this method to
724
+ # Marks the Recommendation State as Failed. Users can use this method to
493
725
  # indicate to the Recommender API that they have applied the recommendation
494
726
  # themselves, and the operation failed. This stops the recommendation content
495
- # from being updated.
727
+ # from being updated. Associated insights are frozen and placed in the
728
+ # ACCEPTED state.
496
729
  #
497
730
  # MarkRecommendationFailed can be applied to recommendations in ACTIVE,
498
731
  # CLAIMED, SUCCEEDED, or FAILED state.
@@ -585,19 +818,19 @@ module Google
585
818
  #
586
819
  # # Examples
587
820
  #
588
- # To modify the global config, setting the timeout for list_recommendations
821
+ # To modify the global config, setting the timeout for list_insights
589
822
  # to 20 seconds, and all remaining timeouts to 10 seconds:
590
823
  #
591
824
  # ::Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
592
825
  # config.timeout = 10.0
593
- # config.rpcs.list_recommendations.timeout = 20.0
826
+ # config.rpcs.list_insights.timeout = 20.0
594
827
  # end
595
828
  #
596
829
  # To apply the above configuration only to a new client:
597
830
  #
598
831
  # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
599
832
  # config.timeout = 10.0
600
- # config.rpcs.list_recommendations.timeout = 20.0
833
+ # config.rpcs.list_insights.timeout = 20.0
601
834
  # end
602
835
  #
603
836
  # @!attribute [rw] endpoint
@@ -706,6 +939,21 @@ module Google
706
939
  # trigger a retry.
707
940
  #
708
941
  class Rpcs
942
+ ##
943
+ # RPC-specific configuration for `list_insights`
944
+ # @return [::Gapic::Config::Method]
945
+ #
946
+ attr_reader :list_insights
947
+ ##
948
+ # RPC-specific configuration for `get_insight`
949
+ # @return [::Gapic::Config::Method]
950
+ #
951
+ attr_reader :get_insight
952
+ ##
953
+ # RPC-specific configuration for `mark_insight_accepted`
954
+ # @return [::Gapic::Config::Method]
955
+ #
956
+ attr_reader :mark_insight_accepted
709
957
  ##
710
958
  # RPC-specific configuration for `list_recommendations`
711
959
  # @return [::Gapic::Config::Method]
@@ -734,6 +982,12 @@ module Google
734
982
 
735
983
  # @private
736
984
  def initialize parent_rpcs = nil
985
+ list_insights_config = parent_rpcs&.list_insights if parent_rpcs&.respond_to? :list_insights
986
+ @list_insights = ::Gapic::Config::Method.new list_insights_config
987
+ get_insight_config = parent_rpcs&.get_insight if parent_rpcs&.respond_to? :get_insight
988
+ @get_insight = ::Gapic::Config::Method.new get_insight_config
989
+ mark_insight_accepted_config = parent_rpcs&.mark_insight_accepted if parent_rpcs&.respond_to? :mark_insight_accepted
990
+ @mark_insight_accepted = ::Gapic::Config::Method.new mark_insight_accepted_config
737
991
  list_recommendations_config = parent_rpcs&.list_recommendations if parent_rpcs&.respond_to? :list_recommendations
738
992
  @list_recommendations = ::Gapic::Config::Method.new list_recommendations_config
739
993
  get_recommendation_config = parent_rpcs&.get_recommendation if parent_rpcs&.respond_to? :get_recommendation
@@ -24,6 +24,46 @@ module Google
24
24
  module Recommender
25
25
  # Path helper methods for the Recommender API.
26
26
  module Paths
27
+ ##
28
+ # Create a fully-qualified Insight resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param insight_type [String]
37
+ # @param insight [String]
38
+ #
39
+ # @return [::String]
40
+ def insight_path project:, location:, insight_type:, insight:
41
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
42
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
43
+ raise ::ArgumentError, "insight_type cannot contain /" if insight_type.to_s.include? "/"
44
+
45
+ "projects/#{project}/locations/#{location}/insightTypes/#{insight_type}/insights/#{insight}"
46
+ end
47
+
48
+ ##
49
+ # Create a fully-qualified InsightType resource string.
50
+ #
51
+ # The resource will be in the following format:
52
+ #
53
+ # `projects/{project}/locations/{location}/insightTypes/{insight_type}`
54
+ #
55
+ # @param project [String]
56
+ # @param location [String]
57
+ # @param insight_type [String]
58
+ #
59
+ # @return [::String]
60
+ def insight_type_path project:, location:, insight_type:
61
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
62
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
63
+
64
+ "projects/#{project}/locations/#{location}/insightTypes/#{insight_type}"
65
+ end
66
+
27
67
  ##
28
68
  # Create a fully-qualified Recommendation resource string.
29
69
  #
@@ -7,9 +7,28 @@ require 'google/api/annotations_pb'
7
7
  require 'google/api/client_pb'
8
8
  require 'google/api/field_behavior_pb'
9
9
  require 'google/api/resource_pb'
10
+ require 'google/cloud/recommender/v1/insight_pb'
10
11
  require 'google/cloud/recommender/v1/recommendation_pb'
11
12
  Google::Protobuf::DescriptorPool.generated_pool.build do
12
13
  add_file("google/cloud/recommender/v1/recommender_service.proto", :syntax => :proto3) do
14
+ add_message "google.cloud.recommender.v1.ListInsightsRequest" do
15
+ optional :parent, :string, 1
16
+ optional :page_size, :int32, 2
17
+ optional :page_token, :string, 3
18
+ optional :filter, :string, 4
19
+ end
20
+ add_message "google.cloud.recommender.v1.ListInsightsResponse" do
21
+ repeated :insights, :message, 1, "google.cloud.recommender.v1.Insight"
22
+ optional :next_page_token, :string, 2
23
+ end
24
+ add_message "google.cloud.recommender.v1.GetInsightRequest" do
25
+ optional :name, :string, 1
26
+ end
27
+ add_message "google.cloud.recommender.v1.MarkInsightAcceptedRequest" do
28
+ optional :name, :string, 1
29
+ map :state_metadata, :string, :string, 2
30
+ optional :etag, :string, 3
31
+ end
13
32
  add_message "google.cloud.recommender.v1.ListRecommendationsRequest" do
14
33
  optional :parent, :string, 1
15
34
  optional :page_size, :int32, 2
@@ -45,6 +64,10 @@ module Google
45
64
  module Cloud
46
65
  module Recommender
47
66
  module V1
67
+ ListInsightsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.ListInsightsRequest").msgclass
68
+ ListInsightsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.ListInsightsResponse").msgclass
69
+ GetInsightRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.GetInsightRequest").msgclass
70
+ MarkInsightAcceptedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.MarkInsightAcceptedRequest").msgclass
48
71
  ListRecommendationsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.ListRecommendationsRequest").msgclass
49
72
  ListRecommendationsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.ListRecommendationsResponse").msgclass
50
73
  GetRecommendationRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recommender.v1.GetRecommendationRequest").msgclass
@@ -1,7 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # Source: google/cloud/recommender/v1/recommender_service.proto for package 'google.cloud.recommender.v1'
3
3
  # Original file comments:
4
- # Copyright 2019 Google LLC.
4
+ # Copyright 2020 Google LLC
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
- #
19
18
 
20
19
  require 'grpc'
21
20
  require 'google/cloud/recommender/v1/recommender_service_pb'
@@ -25,10 +24,10 @@ module Google
25
24
  module Recommender
26
25
  module V1
27
26
  module Recommender
28
- # Provides recommendations for cloud customers for various categories like
29
- # performance optimization, cost savings, reliability, feature discovery, etc.
30
- # These recommendations are generated automatically based on analysis of user
31
- # resources, configuration and monitoring metrics.
27
+ # Provides insights and recommendations for cloud customers for various
28
+ # categories like performance optimization, cost savings, reliability, feature
29
+ # discovery, etc. Insights and recommendations are generated automatically
30
+ # based on analysis of user resources, configuration and monitoring metrics.
32
31
  class Service
33
32
 
34
33
  include GRPC::GenericService
@@ -37,16 +36,29 @@ module Google
37
36
  self.unmarshal_class_method = :decode
38
37
  self.service_name = 'google.cloud.recommender.v1.Recommender'
39
38
 
39
+ # Lists insights for a Cloud project. Requires the recommender.*.list IAM
40
+ # permission for the specified insight type.
41
+ rpc :ListInsights, ListInsightsRequest, ListInsightsResponse
42
+ # Gets the requested insight. Requires the recommender.*.get IAM permission
43
+ # for the specified insight type.
44
+ rpc :GetInsight, GetInsightRequest, Insight
45
+ # Marks the Insight State as Accepted. Users can use this method to
46
+ # indicate to the Recommender API that they have applied some action based
47
+ # on the insight. This stops the insight content from being updated.
48
+ #
49
+ # MarkInsightAccepted can be applied to insights in ACTIVE state. Requires
50
+ # the recommender.*.update IAM permission for the specified insight.
51
+ rpc :MarkInsightAccepted, MarkInsightAcceptedRequest, Insight
40
52
  # Lists recommendations for a Cloud project. Requires the recommender.*.list
41
53
  # IAM permission for the specified recommender.
42
54
  rpc :ListRecommendations, ListRecommendationsRequest, ListRecommendationsResponse
43
55
  # Gets the requested recommendation. Requires the recommender.*.get
44
56
  # IAM permission for the specified recommender.
45
57
  rpc :GetRecommendation, GetRecommendationRequest, Recommendation
46
- # Mark the Recommendation State as Claimed. Users can use this method to
58
+ # Marks the Recommendation State as Claimed. Users can use this method to
47
59
  # indicate to the Recommender API that they are starting to apply the
48
60
  # recommendation themselves. This stops the recommendation content from being
49
- # updated.
61
+ # updated. Associated insights are frozen and placed in the ACCEPTED state.
50
62
  #
51
63
  # MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
52
64
  # SUCCEEDED, FAILED, or ACTIVE state.
@@ -54,10 +66,11 @@ module Google
54
66
  # Requires the recommender.*.update IAM permission for the specified
55
67
  # recommender.
56
68
  rpc :MarkRecommendationClaimed, MarkRecommendationClaimedRequest, Recommendation
57
- # Mark the Recommendation State as Succeeded. Users can use this method to
69
+ # Marks the Recommendation State as Succeeded. Users can use this method to
58
70
  # indicate to the Recommender API that they have applied the recommendation
59
71
  # themselves, and the operation was successful. This stops the recommendation
60
- # content from being updated.
72
+ # content from being updated. Associated insights are frozen and placed in
73
+ # the ACCEPTED state.
61
74
  #
62
75
  # MarkRecommendationSucceeded can be applied to recommendations in ACTIVE,
63
76
  # CLAIMED, SUCCEEDED, or FAILED state.
@@ -65,10 +78,11 @@ module Google
65
78
  # Requires the recommender.*.update IAM permission for the specified
66
79
  # recommender.
67
80
  rpc :MarkRecommendationSucceeded, MarkRecommendationSucceededRequest, Recommendation
68
- # Mark the Recommendation State as Failed. Users can use this method to
81
+ # Marks the Recommendation State as Failed. Users can use this method to
69
82
  # indicate to the Recommender API that they have applied the recommendation
70
83
  # themselves, and the operation failed. This stops the recommendation content
71
- # from being updated.
84
+ # from being updated. Associated insights are frozen and placed in the
85
+ # ACCEPTED state.
72
86
  #
73
87
  # MarkRecommendationFailed can be applied to recommendations in ACTIVE,
74
88
  # CLAIMED, SUCCEEDED, or FAILED state.
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Recommender
23
23
  module V1
24
- VERSION = "0.4.3"
24
+ VERSION = "0.5.0"
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Recommender
23
+ module V1
24
+ # An insight along with the information used to derive the insight. The insight
25
+ # may have associated recomendations as well.
26
+ # @!attribute [rw] name
27
+ # @return [::String]
28
+ # Name of the insight.
29
+ # @!attribute [rw] description
30
+ # @return [::String]
31
+ # Free-form human readable summary in English. The maximum length is 500
32
+ # characters.
33
+ # @!attribute [rw] target_resources
34
+ # @return [::Array<::String>]
35
+ # Fully qualified resource names that this insight is targeting.
36
+ # @!attribute [rw] insight_subtype
37
+ # @return [::String]
38
+ # Insight subtype. Insight content schema will be stable for a given subtype.
39
+ # @!attribute [rw] content
40
+ # @return [::Google::Protobuf::Struct]
41
+ # A struct of custom fields to explain the insight.
42
+ # Example: "grantedPermissionsCount": "1000"
43
+ # @!attribute [rw] last_refresh_time
44
+ # @return [::Google::Protobuf::Timestamp]
45
+ # Timestamp of the latest data used to generate the insight.
46
+ # @!attribute [rw] observation_period
47
+ # @return [::Google::Protobuf::Duration]
48
+ # Observation period that led to the insight. The source data used to
49
+ # generate the insight ends at last_refresh_time and begins at
50
+ # (last_refresh_time - observation_period).
51
+ # @!attribute [rw] state_info
52
+ # @return [::Google::Cloud::Recommender::V1::InsightStateInfo]
53
+ # Information state and metadata.
54
+ # @!attribute [rw] category
55
+ # @return [::Google::Cloud::Recommender::V1::Insight::Category]
56
+ # Category being targeted by the insight.
57
+ # @!attribute [rw] etag
58
+ # @return [::String]
59
+ # Fingerprint of the Insight. Provides optimistic locking when updating
60
+ # states.
61
+ # @!attribute [rw] associated_recommendations
62
+ # @return [::Array<::Google::Cloud::Recommender::V1::Insight::RecommendationReference>]
63
+ # Recommendations derived from this insight.
64
+ class Insight
65
+ include ::Google::Protobuf::MessageExts
66
+ extend ::Google::Protobuf::MessageExts::ClassMethods
67
+
68
+ # Reference to an associated recommendation.
69
+ # @!attribute [rw] recommendation
70
+ # @return [::String]
71
+ # Recommendation resource name, e.g.
72
+ # projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID]
73
+ class RecommendationReference
74
+ include ::Google::Protobuf::MessageExts
75
+ extend ::Google::Protobuf::MessageExts::ClassMethods
76
+ end
77
+
78
+ # Insight category.
79
+ module Category
80
+ # Unspecified category.
81
+ CATEGORY_UNSPECIFIED = 0
82
+
83
+ # The insight is related to cost.
84
+ COST = 1
85
+
86
+ # The insight is related to security.
87
+ SECURITY = 2
88
+
89
+ # The insight is related to performance.
90
+ PERFORMANCE = 3
91
+
92
+ # This insight is related to manageability.
93
+ MANAGEABILITY = 4
94
+ end
95
+ end
96
+
97
+ # Information related to insight state.
98
+ # @!attribute [rw] state
99
+ # @return [::Google::Cloud::Recommender::V1::InsightStateInfo::State]
100
+ # Insight state.
101
+ # @!attribute [rw] state_metadata
102
+ # @return [::Google::Protobuf::Map{::String => ::String}]
103
+ # A map of metadata for the state, provided by user or automations systems.
104
+ class InsightStateInfo
105
+ include ::Google::Protobuf::MessageExts
106
+ extend ::Google::Protobuf::MessageExts::ClassMethods
107
+
108
+ # @!attribute [rw] key
109
+ # @return [::String]
110
+ # @!attribute [rw] value
111
+ # @return [::String]
112
+ class StateMetadataEntry
113
+ include ::Google::Protobuf::MessageExts
114
+ extend ::Google::Protobuf::MessageExts::ClassMethods
115
+ end
116
+
117
+ # Represents insight state.
118
+ module State
119
+ # Unspecified state.
120
+ STATE_UNSPECIFIED = 0
121
+
122
+ # Insight is active. Content for ACTIVE insights can be updated by Google.
123
+ # ACTIVE insights can be marked DISMISSED OR ACCEPTED.
124
+ ACTIVE = 1
125
+
126
+ # Some action has been taken based on this insight. Insights become
127
+ # accepted when a recommendation derived from the insight has been marked
128
+ # CLAIMED, SUCCEEDED, or FAILED. ACTIVE insights can also be marked
129
+ # ACCEPTED explicitly. Content for ACCEPTED insights is immutable. ACCEPTED
130
+ # insights can only be marked ACCEPTED (which may update state metadata).
131
+ ACCEPTED = 2
132
+
133
+ # Insight is dismissed. Content for DISMISSED insights can be updated by
134
+ # Google. DISMISSED insights can be marked as ACTIVE.
135
+ DISMISSED = 3
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -64,9 +64,22 @@ module Google
64
64
  # @return [::String]
65
65
  # Fingerprint of the Recommendation. Provides optimistic locking when
66
66
  # updating states.
67
+ # @!attribute [rw] associated_insights
68
+ # @return [::Array<::Google::Cloud::Recommender::V1::Recommendation::InsightReference>]
69
+ # Insights that led to this recommendation.
67
70
  class Recommendation
68
71
  include ::Google::Protobuf::MessageExts
69
72
  extend ::Google::Protobuf::MessageExts::ClassMethods
73
+
74
+ # Reference to an associated insight.
75
+ # @!attribute [rw] insight
76
+ # @return [::String]
77
+ # Insight resource name, e.g.
78
+ # projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID]
79
+ class InsightReference
80
+ include ::Google::Protobuf::MessageExts
81
+ extend ::Google::Protobuf::MessageExts::ClassMethods
82
+ end
70
83
  end
71
84
 
72
85
  # Contains what resources are changing and how they are changing.
@@ -264,7 +277,7 @@ module Google
264
277
  extend ::Google::Protobuf::MessageExts::ClassMethods
265
278
  end
266
279
 
267
- # Represents Recommendation State
280
+ # Represents Recommendation State.
268
281
  module State
269
282
  # Default state. Don't use directly.
270
283
  STATE_UNSPECIFIED = 0
@@ -21,6 +21,85 @@ module Google
21
21
  module Cloud
22
22
  module Recommender
23
23
  module V1
24
+ # Request for the `ListInsights` method.
25
+ # @!attribute [rw] parent
26
+ # @return [::String]
27
+ # Required. The container resource on which to execute the request.
28
+ # Acceptable formats:
29
+ #
30
+ # 1.
31
+ # "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
32
+ #
33
+ # LOCATION here refers to GCP Locations:
34
+ # https://cloud.google.com/about/locations/
35
+ # @!attribute [rw] page_size
36
+ # @return [::Integer]
37
+ # Optional. The maximum number of results to return from this request. Non-positive
38
+ # values are ignored. If not specified, the server will determine the number
39
+ # of results to return.
40
+ # @!attribute [rw] page_token
41
+ # @return [::String]
42
+ # Optional. If present, retrieves the next batch of results from the preceding call to
43
+ # this method. `page_token` must be the value of `next_page_token` from the
44
+ # previous response. The values of other method parameters must be identical
45
+ # to those in the previous call.
46
+ # @!attribute [rw] filter
47
+ # @return [::String]
48
+ # Optional. Filter expression to restrict the insights returned. Supported
49
+ # filter fields: state
50
+ # Eg: `state:"DISMISSED" or state:"ACTIVE"
51
+ class ListInsightsRequest
52
+ include ::Google::Protobuf::MessageExts
53
+ extend ::Google::Protobuf::MessageExts::ClassMethods
54
+ end
55
+
56
+ # Response to the `ListInsights` method.
57
+ # @!attribute [rw] insights
58
+ # @return [::Array<::Google::Cloud::Recommender::V1::Insight>]
59
+ # The set of insights for the `parent` resource.
60
+ # @!attribute [rw] next_page_token
61
+ # @return [::String]
62
+ # A token that can be used to request the next page of results. This field is
63
+ # empty if there are no additional results.
64
+ class ListInsightsResponse
65
+ include ::Google::Protobuf::MessageExts
66
+ extend ::Google::Protobuf::MessageExts::ClassMethods
67
+ end
68
+
69
+ # Request to the `GetInsight` method.
70
+ # @!attribute [rw] name
71
+ # @return [::String]
72
+ # Required. Name of the insight.
73
+ class GetInsightRequest
74
+ include ::Google::Protobuf::MessageExts
75
+ extend ::Google::Protobuf::MessageExts::ClassMethods
76
+ end
77
+
78
+ # Request for the `MarkInsightAccepted` method.
79
+ # @!attribute [rw] name
80
+ # @return [::String]
81
+ # Required. Name of the insight.
82
+ # @!attribute [rw] state_metadata
83
+ # @return [::Google::Protobuf::Map{::String => ::String}]
84
+ # Optional. State properties user wish to include with this state. Full replace of the
85
+ # current state_metadata.
86
+ # @!attribute [rw] etag
87
+ # @return [::String]
88
+ # Required. Fingerprint of the Insight. Provides optimistic locking.
89
+ class MarkInsightAcceptedRequest
90
+ include ::Google::Protobuf::MessageExts
91
+ extend ::Google::Protobuf::MessageExts::ClassMethods
92
+
93
+ # @!attribute [rw] key
94
+ # @return [::String]
95
+ # @!attribute [rw] value
96
+ # @return [::String]
97
+ class StateMetadataEntry
98
+ include ::Google::Protobuf::MessageExts
99
+ extend ::Google::Protobuf::MessageExts::ClassMethods
100
+ end
101
+ end
102
+
24
103
  # Request for the `ListRecommendations` method.
25
104
  # @!attribute [rw] parent
26
105
  # @return [::String]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-recommender-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.2'
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-errors
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -163,6 +163,7 @@ files:
163
163
  - README.md
164
164
  - lib/google-cloud-recommender-v1.rb
165
165
  - lib/google/cloud/recommender/v1.rb
166
+ - lib/google/cloud/recommender/v1/insight_pb.rb
166
167
  - lib/google/cloud/recommender/v1/recommendation_pb.rb
167
168
  - lib/google/cloud/recommender/v1/recommender.rb
168
169
  - lib/google/cloud/recommender/v1/recommender/client.rb
@@ -174,6 +175,7 @@ files:
174
175
  - proto_docs/README.md
175
176
  - proto_docs/google/api/field_behavior.rb
176
177
  - proto_docs/google/api/resource.rb
178
+ - proto_docs/google/cloud/recommender/v1/insight.rb
177
179
  - proto_docs/google/cloud/recommender/v1/recommendation.rb
178
180
  - proto_docs/google/cloud/recommender/v1/recommender_service.rb
179
181
  - proto_docs/google/protobuf/duration.rb