Class: Google::Cloud::Recommender::V1::Recommender::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Recommender::V1::Recommender::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/recommender/v1/recommender/client.rb
Overview
Client for the Recommender service.
Provides insights and recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. Insights and recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.
Defined Under Namespace
Classes: Configuration
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the Recommender Client class.
Instance Method Summary collapse
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the Recommender Client instance.
-
#get_insight(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Insight
Gets the requested insight.
-
#get_insight_type_config(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig
Gets the requested InsightTypeConfig.
-
#get_recommendation(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Gets the requested recommendation.
-
#get_recommender_config(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig
Gets the requested Recommender Config.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new Recommender client object.
-
#list_insights(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>
Lists insights for the specified Cloud Resource.
-
#list_recommendations(request, options = nil) {|response, operation| ... } ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>
Lists recommendations for the specified Cloud Resource.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#mark_insight_accepted(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Insight
Marks the Insight State as Accepted.
-
#mark_recommendation_claimed(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Claimed.
-
#mark_recommendation_dismissed(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Mark the Recommendation State as Dismissed.
-
#mark_recommendation_failed(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Failed.
-
#mark_recommendation_succeeded(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Succeeded.
-
#universe_domain ⇒ String
The effective universe domain.
-
#update_insight_type_config(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig
Updates an InsightTypeConfig change.
-
#update_recommender_config(request, options = nil) {|response, operation| ... } ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig
Updates a Recommender Config.
Methods included from Paths
#insight_path, #insight_type_config_path, #insight_type_path, #recommendation_path, #recommender_config_path, #recommender_path
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new Recommender client object.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 155 def initialize # These require statements are intentionally placed here to initialize # the gRPC module only when it's required. # See https://github.com/googleapis/toolkit/issues/446 require "gapic/grpc" require "google/cloud/recommender/v1/recommender_service_services_pb" # 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.nil? || (@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 @recommender_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Recommender::V1::Recommender::Stub, credentials: credentials, endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, channel_args: @config.channel_args, interceptors: @config.interceptors, channel_pool_config: @config.channel_pool, logger: @config.logger ) @recommender_stub.stub_logger&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the Recommender Client class.
See Configuration for a description of the configuration fields.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 65 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Recommender", "V1"] 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.rpcs.list_insights.timeout = 60.0 default_config.rpcs.list_insights.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_insight.timeout = 60.0 default_config.rpcs.get_insight.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.mark_insight_accepted.timeout = 60.0 default_config.rpcs.list_recommendations.timeout = 60.0 default_config.rpcs.list_recommendations.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_recommendation.timeout = 60.0 default_config.rpcs.get_recommendation.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.mark_recommendation_claimed.timeout = 60.0 default_config.rpcs.mark_recommendation_succeeded.timeout = 60.0 default_config.rpcs.mark_recommendation_failed.timeout = 60.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#configure {|config| ... } ⇒ Client::Configuration
Configure the Recommender 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.
125 126 127 128 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 125 def configure yield @config if block_given? @config end |
#get_insight(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Insight #get_insight(name: nil) ⇒ ::Google::Cloud::Recommender::V1::Insight
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 408 def get_insight request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetInsightRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_insight..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_insight.timeout, metadata: , retry_policy: @config.rpcs.get_insight.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :get_insight, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_insight_type_config(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig #get_insight_type_config(name: nil) ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig
Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1418 def get_insight_type_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetInsightTypeConfigRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_insight_type_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_insight_type_config.timeout, metadata: , retry_policy: @config.rpcs.get_insight_type_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :get_insight_type_config, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_recommendation(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation #get_recommendation(name: nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
735 736 737 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 773 774 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 735 def get_recommendation request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetRecommendationRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_recommendation..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_recommendation.timeout, metadata: , retry_policy: @config.rpcs.get_recommendation.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :get_recommendation, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#get_recommender_config(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig #get_recommender_config(name: nil) ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig
Gets the requested Recommender Config. There is only one instance of the config for each Recommender.
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1231 def get_recommender_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetRecommenderConfigRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_recommender_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.get_recommender_config.timeout, metadata: , retry_policy: @config.rpcs.get_recommender_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :get_recommender_config, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_insights(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight> #list_insights(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Insight>
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 320 def list_insights request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::ListInsightsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_insights..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_insights.timeout, metadata: , retry_policy: @config.rpcs.list_insights.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :list_insights, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @recommender_stub, :list_insights, request, response, operation, yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#list_recommendations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation> #list_recommendations(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.
647 648 649 650 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 686 687 688 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 647 def list_recommendations request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::ListRecommendationsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_recommendations..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.parent header_params["parent"] = request.parent end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.list_recommendations.timeout, metadata: , retry_policy: @config.rpcs.list_recommendations.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :list_recommendations, request, options: do |response, operation| response = ::Gapic::PagedEnumerable.new @recommender_stub, :list_recommendations, request, response, operation, yield response, operation if block_given? throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
211 212 213 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 211 def logger @recommender_stub.logger end |
#mark_insight_accepted(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Insight #mark_insight_accepted(name: nil, state_metadata: nil, etag: nil) ⇒ ::Google::Cloud::Recommender::V1::Insight
Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender API that they have applied some action based on the insight. This stops the insight content from being updated.
MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the recommender.*.update IAM permission for the specified insight.
503 504 505 506 507 508 509 510 511 512 513 514 515 516 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 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 503 def mark_insight_accepted request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkInsightAcceptedRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.mark_insight_accepted..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.mark_insight_accepted.timeout, metadata: , retry_policy: @config.rpcs.mark_insight_accepted.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :mark_insight_accepted, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#mark_recommendation_claimed(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation #mark_recommendation_claimed(name: nil, state_metadata: nil, etag: nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Claimed. Users can use this method to indicate to the Recommender API that they are starting to apply the recommendation themselves. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationClaimed can be applied to recommendations in CLAIMED, SUCCEEDED, FAILED, or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 931 def mark_recommendation_claimed request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.mark_recommendation_claimed..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.mark_recommendation_claimed.timeout, metadata: , retry_policy: @config.rpcs.mark_recommendation_claimed.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :mark_recommendation_claimed, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#mark_recommendation_dismissed(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation #mark_recommendation_dismissed(name: nil, etag: nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Mark the Recommendation State as Dismissed. Users can use this method to indicate to the Recommender API that an ACTIVE recommendation has to be marked back as DISMISSED.
MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 830 def mark_recommendation_dismissed request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationDismissedRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.mark_recommendation_dismissed..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.mark_recommendation_dismissed.timeout, metadata: , retry_policy: @config.rpcs.mark_recommendation_dismissed.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :mark_recommendation_dismissed, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#mark_recommendation_failed(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation #mark_recommendation_failed(name: nil, state_metadata: nil, etag: nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Failed. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation failed. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1135 def mark_recommendation_failed request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.mark_recommendation_failed..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.mark_recommendation_failed.timeout, metadata: , retry_policy: @config.rpcs.mark_recommendation_failed.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :mark_recommendation_failed, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#mark_recommendation_succeeded(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation #mark_recommendation_succeeded(name: nil, state_metadata: nil, etag: nil) ⇒ ::Google::Cloud::Recommender::V1::Recommendation
Marks the Recommendation State as Succeeded. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation was successful. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1033 def mark_recommendation_succeeded request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.mark_recommendation_succeeded..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.name header_params["name"] = request.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.mark_recommendation_succeeded.timeout, metadata: , retry_policy: @config.rpcs.mark_recommendation_succeeded.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :mark_recommendation_succeeded, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
135 136 137 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 135 def universe_domain @recommender_stub.universe_domain end |
#update_insight_type_config(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig #update_insight_type_config(insight_type_config: nil, update_mask: nil, validate_only: nil) ⇒ ::Google::Cloud::Recommender::V1::InsightTypeConfig
Updates an InsightTypeConfig change. This will create a new revision of the config.
1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1509 def update_insight_type_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::UpdateInsightTypeConfigRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_insight_type_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.insight_type_config&.name header_params["insight_type_config.name"] = request.insight_type_config.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.update_insight_type_config.timeout, metadata: , retry_policy: @config.rpcs.update_insight_type_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :update_insight_type_config, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |
#update_recommender_config(request, options = nil) ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig #update_recommender_config(recommender_config: nil, update_mask: nil, validate_only: nil) ⇒ ::Google::Cloud::Recommender::V1::RecommenderConfig
Updates a Recommender Config. This will create a new revision of the config.
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 |
# File 'lib/google/cloud/recommender/v1/recommender/client.rb', line 1322 def update_recommender_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::UpdateRecommenderConfigRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_recommender_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Recommender::V1::VERSION [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = {} if request.recommender_config&.name header_params["recommender_config.name"] = request.recommender_config.name end request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") [:"x-goog-request-params"] ||= request_params_header .apply_defaults timeout: @config.rpcs.update_recommender_config.timeout, metadata: , retry_policy: @config.rpcs.update_recommender_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @recommender_stub.call_rpc :update_recommender_config, request, options: do |response, operation| yield response, operation if block_given? end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end |