google-cloud-recommender-v1 0.3.0 → 0.4.1

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: 89f78d8318141b9e69c3d18d971cf029b8a53e98b953a7b26d77c62f2e2fabdb
4
- data.tar.gz: c24971dd003e588861c24103ae463727db74042a2fbe0ff11d6581e18b0f22ff
3
+ metadata.gz: c45454588421c7a0916d630c8cd41002c59696b21db34badc2d5546c6108e698
4
+ data.tar.gz: 5ae6f7132215f06d6c9ab09a0a40a68f5b48c656221a05934ddd7c1a4d40df37
5
5
  SHA512:
6
- metadata.gz: ed777bb21a784a3675713cf115e30306ee6ee3689cb1ce482da1accbc2da4b95e0de906bd2d31f1c7ffed9ab6983bbfcfcdcab6b85565136f5babf32083957a9
7
- data.tar.gz: 529b99b1eafcca74341f74ba5ad98b269c1ddf40ec4d18fdf32b306e76ebd16427d53d0fbb310ad206445ecbc0faa27e98dd3f6270cfc9a79f705e2e4d022ea4
6
+ metadata.gz: f8ec412aa5326c7b67c8cc695428e70a1e90ea468e2f17f50d5094d77dca5951513ebabdbb35fb0fbaea3c1d846091d0b8baa9f752661c645c093e5bd0ed9b3f
7
+ data.tar.gz: f22829a620edfed13d96ec29b25733f570bd8ff775488adb0d4862f8d3413b946b87695c3936ac4838dc56d9a7ee96cb9cb26e7a02116073a7d976cf8a35b778
@@ -27,7 +27,7 @@ export RECOMMENDER_CREDENTIALS=path/to/keyfile.json
27
27
  ```ruby
28
28
  require "google/cloud/recommender/v1"
29
29
 
30
- client = Google::Cloud::Recommender::V1::Recommender::Client.new
30
+ client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
31
31
  ```
32
32
 
33
33
  ## Credential Lookup
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
64
64
 
65
65
  The environment variables that google-cloud-recommender-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
- {Google::Cloud::Recommender::V1::Recommender::Credentials}):
67
+ {::Google::Cloud::Recommender::V1::Recommender::Credentials}):
68
68
 
69
69
  1. `RECOMMENDER_CREDENTIALS` - Path to JSON file, or JSON contents
70
70
  2. `RECOMMENDER_KEYFILE` - Path to JSON file, or JSON contents
@@ -77,7 +77,7 @@ require "google/cloud/recommender/v1"
77
77
 
78
78
  ENV["RECOMMENDER_CREDENTIALS"] = "path/to/keyfile.json"
79
79
 
80
- client = Google::Cloud::Recommender::V1::Recommender::Client.new
80
+ client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
81
81
  ```
82
82
 
83
83
  ### Configuration
@@ -88,7 +88,7 @@ environment variables. Either on an individual client initialization:
88
88
  ```ruby
89
89
  require "google/cloud/recommender/v1"
90
90
 
91
- client = Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
91
+ client = ::Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
92
92
  config.credentials = "path/to/keyfile.json"
93
93
  end
94
94
  ```
@@ -98,11 +98,11 @@ Or configured globally for all clients:
98
98
  ```ruby
99
99
  require "google/cloud/recommender/v1"
100
100
 
101
- Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
101
+ ::Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
102
102
  config.credentials = "path/to/keyfile.json"
103
103
  end
104
104
 
105
- client = Google::Cloud::Recommender::V1::Recommender::Client.new
105
+ client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
106
106
  ```
107
107
 
108
108
  ### Cloud SDK
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Recommender V1
1
+ # Ruby Client for the Recommender V1 API
2
2
 
3
3
  API Client library for the Recommender V1 API
4
4
 
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
12
12
  $ gem install google-cloud-recommender-v1
13
13
  ```
14
14
 
15
+ ## Before You Begin
16
+
17
+ In order to use this library, you first need to go through the following steps:
18
+
19
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
20
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
21
+ 1. {file:AUTHENTICATION.md Set up authentication.}
22
+
23
+ ## Quick Start
24
+
25
+ ```ruby
26
+ require "google/cloud/recommender/v1"
27
+
28
+ client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
29
+ request = my_create_request
30
+ response = client.list_recommendations request
31
+ ```
32
+
33
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-recommender-v1/latest)
34
+ for class and method documentation.
35
+
36
+ ## Enabling Logging
37
+
38
+ To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
39
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
40
+ or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
41
+ that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
42
+ and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
43
+
44
+ Configuring a Ruby stdlib logger:
45
+
46
+ ```ruby
47
+ require "logger"
48
+
49
+ module MyLogger
50
+ LOGGER = Logger.new $stderr, level: Logger::WARN
51
+ def logger
52
+ LOGGER
53
+ end
54
+ end
55
+
56
+ # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
57
+ module GRPC
58
+ extend MyLogger
59
+ end
60
+ ```
61
+
15
62
  ## Supported Ruby Versions
16
63
 
17
64
  This library is supported on Ruby 2.4+.
@@ -1 +1,21 @@
1
- require "google/cloud/recommender/v1/version"
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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/recommender/v1"
@@ -17,3 +17,19 @@
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
19
  require "google/cloud/recommender/v1/recommender"
20
+ require "google/cloud/recommender/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Recommender
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/recommender/v1"
29
+ # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -16,5 +16,37 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "google/cloud/recommender/v1/recommender/client"
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/recommender/v1/version"
24
+
20
25
  require "google/cloud/recommender/v1/recommender/credentials"
26
+ require "google/cloud/recommender/v1/recommender/paths"
27
+ require "google/cloud/recommender/v1/recommender/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Recommender
32
+ module V1
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.
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/recommender/v1/recommender"
42
+ # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
43
+ #
44
+ module Recommender
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "recommender", "helpers.rb"
52
+ require "google/cloud/recommender/v1/recommender/helpers" if ::File.file? helper_path
@@ -16,15 +16,8 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
- require "gapic/common"
20
- require "gapic/config"
21
- require "gapic/config/method"
22
-
23
19
  require "google/cloud/errors"
24
- require "google/cloud/recommender/v1/version"
25
20
  require "google/cloud/recommender/v1/recommender_service_pb"
26
- require "google/cloud/recommender/v1/recommender/credentials"
27
- require "google/cloud/recommender/v1/recommender/paths"
28
21
 
29
22
  module Google
30
23
  module Cloud
@@ -48,15 +41,15 @@ module Google
48
41
  ##
49
42
  # Configure the Recommender Client class.
50
43
  #
51
- # See {Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
44
+ # See {::Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
52
45
  # for a description of the configuration fields.
53
46
  #
54
47
  # ## Example
55
48
  #
56
49
  # To modify the configuration for all Recommender clients:
57
50
  #
58
- # Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
59
- # config.timeout = 10_000
51
+ # ::Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
52
+ # config.timeout = 10.0
60
53
  # end
61
54
  #
62
55
  # @yield [config] Configure the Client client.
@@ -110,7 +103,7 @@ module Google
110
103
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
111
104
  # should be made on {Client.configure}.
112
105
  #
113
- # See {Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
106
+ # See {::Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
114
107
  # for a description of the configuration fields.
115
108
  #
116
109
  # @yield [config] Configure the Client client.
@@ -131,13 +124,13 @@ module Google
131
124
  # To create a new Recommender client with the default
132
125
  # configuration:
133
126
  #
134
- # client = Google::Cloud::Recommender::V1::Recommender::Client.new
127
+ # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new
135
128
  #
136
129
  # To create a new Recommender client with a custom
137
130
  # configuration:
138
131
  #
139
- # client = Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
140
- # config.timeout = 10_000
132
+ # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
133
+ # config.timeout = 10.0
141
134
  # end
142
135
  #
143
136
  # @yield [config] Configure the Recommender client.
@@ -162,10 +155,11 @@ module Google
162
155
  if credentials.is_a?(String) || credentials.is_a?(Hash)
163
156
  credentials = Credentials.new credentials, scope: @config.scope
164
157
  end
165
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
158
+ @quota_project_id = @config.quota_project
159
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
160
 
167
- @recommender_stub = Gapic::ServiceStub.new(
168
- Google::Cloud::Recommender::V1::Recommender::Stub,
161
+ @recommender_stub = ::Gapic::ServiceStub.new(
162
+ ::Google::Cloud::Recommender::V1::Recommender::Stub,
169
163
  credentials: credentials,
170
164
  endpoint: @config.endpoint,
171
165
  channel_args: @config.channel_args,
@@ -180,14 +174,21 @@ module Google
180
174
  # IAM permission for the specified recommender.
181
175
  #
182
176
  # @overload list_recommendations(request, options = nil)
183
- # @param request [Google::Cloud::Recommender::V1::ListRecommendationsRequest | Hash]
184
- # Lists recommendations for a Cloud project. Requires the recommender.*.list
185
- # IAM permission for the specified recommender.
186
- # @param options [Gapic::CallOptions, Hash]
177
+ # Pass arguments to `list_recommendations` via a request object, either of type
178
+ # {::Google::Cloud::Recommender::V1::ListRecommendationsRequest} or an equivalent Hash.
179
+ #
180
+ # @param request [::Google::Cloud::Recommender::V1::ListRecommendationsRequest, ::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]
187
184
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
188
185
  #
189
186
  # @overload list_recommendations(parent: nil, page_size: nil, page_token: nil, filter: nil)
190
- # @param parent [String]
187
+ # Pass arguments to `list_recommendations` 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]
191
192
  # Required. The container resource on which to execute the request.
192
193
  # Acceptable formats:
193
194
  #
@@ -196,42 +197,41 @@ module Google
196
197
  #
197
198
  # LOCATION here refers to GCP Locations:
198
199
  # https://cloud.google.com/about/locations/
199
- # @param page_size [Integer]
200
+ # @param page_size [::Integer]
200
201
  # Optional. The maximum number of results to return from this request. Non-positive
201
202
  # values are ignored. If not specified, the server will determine the number
202
203
  # of results to return.
203
- # @param page_token [String]
204
+ # @param page_token [::String]
204
205
  # Optional. If present, retrieves the next batch of results from the preceding call to
205
206
  # this method. `page_token` must be the value of `next_page_token` from the
206
207
  # previous response. The values of other method parameters must be identical
207
208
  # to those in the previous call.
208
- # @param filter [String]
209
+ # @param filter [::String]
209
210
  # Filter expression to restrict the recommendations returned. Supported
210
211
  # filter fields: state_info.state
211
212
  # Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED"
212
213
  #
213
- #
214
214
  # @yield [response, operation] Access the result along with the RPC operation
215
- # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::Recommender::V1::Recommendation>]
216
- # @yieldparam operation [GRPC::ActiveCall::Operation]
215
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>]
216
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
217
217
  #
218
- # @return [Gapic::PagedEnumerable<Google::Cloud::Recommender::V1::Recommendation>]
218
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Recommender::V1::Recommendation>]
219
219
  #
220
- # @raise [Google::Cloud::Error] if the RPC is aborted.
220
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
221
221
  #
222
222
  def list_recommendations request, options = nil
223
- raise ArgumentError, "request must be provided" if request.nil?
223
+ raise ::ArgumentError, "request must be provided" if request.nil?
224
224
 
225
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::ListRecommendationsRequest
225
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::ListRecommendationsRequest
226
226
 
227
227
  # Converts hash and nil to an options object
228
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
228
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
229
229
 
230
230
  # Customize the options with defaults
231
231
  metadata = @config.rpcs.list_recommendations.metadata.to_h
232
232
 
233
233
  # Set x-goog-api-client and x-goog-user-project headers
234
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
234
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
235
235
  lib_name: @config.lib_name, lib_version: @config.lib_version,
236
236
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
237
237
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -249,12 +249,12 @@ module Google
249
249
  retry_policy: @config.retry_policy
250
250
 
251
251
  @recommender_stub.call_rpc :list_recommendations, request, options: options do |response, operation|
252
- response = Gapic::PagedEnumerable.new @recommender_stub, :list_recommendations, request, response, operation, options
252
+ response = ::Gapic::PagedEnumerable.new @recommender_stub, :list_recommendations, request, response, operation, options
253
253
  yield response, operation if block_given?
254
254
  return response
255
255
  end
256
- rescue GRPC::BadStatus => e
257
- raise Google::Cloud::Error.from_error(e)
256
+ rescue ::GRPC::BadStatus => e
257
+ raise ::Google::Cloud::Error.from_error(e)
258
258
  end
259
259
 
260
260
  ##
@@ -262,38 +262,44 @@ module Google
262
262
  # IAM permission for the specified recommender.
263
263
  #
264
264
  # @overload get_recommendation(request, options = nil)
265
- # @param request [Google::Cloud::Recommender::V1::GetRecommendationRequest | Hash]
266
- # Gets the requested recommendation. Requires the recommender.*.get
267
- # IAM permission for the specified recommender.
268
- # @param options [Gapic::CallOptions, Hash]
265
+ # Pass arguments to `get_recommendation` via a request object, either of type
266
+ # {::Google::Cloud::Recommender::V1::GetRecommendationRequest} or an equivalent Hash.
267
+ #
268
+ # @param request [::Google::Cloud::Recommender::V1::GetRecommendationRequest, ::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]
269
272
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
270
273
  #
271
274
  # @overload get_recommendation(name: nil)
272
- # @param name [String]
273
- # Required. Name of the recommendation.
275
+ # Pass arguments to `get_recommendation` 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).
274
278
  #
279
+ # @param name [::String]
280
+ # Required. Name of the recommendation.
275
281
  #
276
282
  # @yield [response, operation] Access the result along with the RPC operation
277
- # @yieldparam response [Google::Cloud::Recommender::V1::Recommendation]
278
- # @yieldparam operation [GRPC::ActiveCall::Operation]
283
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Recommendation]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
279
285
  #
280
- # @return [Google::Cloud::Recommender::V1::Recommendation]
286
+ # @return [::Google::Cloud::Recommender::V1::Recommendation]
281
287
  #
282
- # @raise [Google::Cloud::Error] if the RPC is aborted.
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
283
289
  #
284
290
  def get_recommendation request, options = nil
285
- raise ArgumentError, "request must be provided" if request.nil?
291
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
292
 
287
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::GetRecommendationRequest
293
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::GetRecommendationRequest
288
294
 
289
295
  # Converts hash and nil to an options object
290
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
296
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
297
 
292
298
  # Customize the options with defaults
293
299
  metadata = @config.rpcs.get_recommendation.metadata.to_h
294
300
 
295
301
  # Set x-goog-api-client and x-goog-user-project headers
296
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
302
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
303
  lib_name: @config.lib_name, lib_version: @config.lib_version,
298
304
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
299
305
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -314,8 +320,8 @@ module Google
314
320
  yield response, operation if block_given?
315
321
  return response
316
322
  end
317
- rescue GRPC::BadStatus => e
318
- raise Google::Cloud::Error.from_error(e)
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
319
325
  end
320
326
 
321
327
  ##
@@ -331,53 +337,51 @@ module Google
331
337
  # recommender.
332
338
  #
333
339
  # @overload mark_recommendation_claimed(request, options = nil)
334
- # @param request [Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest | Hash]
335
- # Mark the Recommendation State as Claimed. Users can use this method to
336
- # indicate to the Recommender API that they are starting to apply the
337
- # recommendation themselves. This stops the recommendation content from being
338
- # updated.
339
- #
340
- # MarkRecommendationClaimed can be applied to recommendations in CLAIMED,
341
- # SUCCEEDED, FAILED, or ACTIVE state.
342
- #
343
- # Requires the recommender.*.update IAM permission for the specified
344
- # recommender.
345
- # @param options [Gapic::CallOptions, Hash]
340
+ # Pass arguments to `mark_recommendation_claimed` via a request object, either of type
341
+ # {::Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest} or an equivalent Hash.
342
+ #
343
+ # @param request [::Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest, ::Hash]
344
+ # A request object representing the call parameters. Required. To specify no
345
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
346
+ # @param options [::Gapic::CallOptions, ::Hash]
346
347
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
347
348
  #
348
349
  # @overload mark_recommendation_claimed(name: nil, state_metadata: nil, etag: nil)
349
- # @param name [String]
350
+ # Pass arguments to `mark_recommendation_claimed` via keyword arguments. Note that at
351
+ # least one keyword argument is required. To specify no parameters, or to keep all
352
+ # the default parameter values, pass an empty Hash as a request object (see above).
353
+ #
354
+ # @param name [::String]
350
355
  # Required. Name of the recommendation.
351
- # @param state_metadata [Hash{String => String}]
356
+ # @param state_metadata [::Hash{::String => ::String}]
352
357
  # State properties to include with this state. Overwrites any existing
353
358
  # `state_metadata`.
354
359
  # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
355
360
  # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
356
- # @param etag [String]
361
+ # @param etag [::String]
357
362
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
358
363
  #
359
- #
360
364
  # @yield [response, operation] Access the result along with the RPC operation
361
- # @yieldparam response [Google::Cloud::Recommender::V1::Recommendation]
362
- # @yieldparam operation [GRPC::ActiveCall::Operation]
365
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Recommendation]
366
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
363
367
  #
364
- # @return [Google::Cloud::Recommender::V1::Recommendation]
368
+ # @return [::Google::Cloud::Recommender::V1::Recommendation]
365
369
  #
366
- # @raise [Google::Cloud::Error] if the RPC is aborted.
370
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
367
371
  #
368
372
  def mark_recommendation_claimed request, options = nil
369
- raise ArgumentError, "request must be provided" if request.nil?
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
370
374
 
371
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest
372
376
 
373
377
  # Converts hash and nil to an options object
374
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
375
379
 
376
380
  # Customize the options with defaults
377
381
  metadata = @config.rpcs.mark_recommendation_claimed.metadata.to_h
378
382
 
379
383
  # Set x-goog-api-client and x-goog-user-project headers
380
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
384
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
385
  lib_name: @config.lib_name, lib_version: @config.lib_version,
382
386
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
383
387
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -398,8 +402,8 @@ module Google
398
402
  yield response, operation if block_given?
399
403
  return response
400
404
  end
401
- rescue GRPC::BadStatus => e
402
- raise Google::Cloud::Error.from_error(e)
405
+ rescue ::GRPC::BadStatus => e
406
+ raise ::Google::Cloud::Error.from_error(e)
403
407
  end
404
408
 
405
409
  ##
@@ -415,53 +419,51 @@ module Google
415
419
  # recommender.
416
420
  #
417
421
  # @overload mark_recommendation_succeeded(request, options = nil)
418
- # @param request [Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest | Hash]
419
- # Mark the Recommendation State as Succeeded. Users can use this method to
420
- # indicate to the Recommender API that they have applied the recommendation
421
- # themselves, and the operation was successful. This stops the recommendation
422
- # content from being updated.
423
- #
424
- # MarkRecommendationSucceeded can be applied to recommendations in ACTIVE,
425
- # CLAIMED, SUCCEEDED, or FAILED state.
426
- #
427
- # Requires the recommender.*.update IAM permission for the specified
428
- # recommender.
429
- # @param options [Gapic::CallOptions, Hash]
422
+ # Pass arguments to `mark_recommendation_succeeded` via a request object, either of type
423
+ # {::Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest} or an equivalent Hash.
424
+ #
425
+ # @param request [::Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest, ::Hash]
426
+ # A request object representing the call parameters. Required. To specify no
427
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
428
+ # @param options [::Gapic::CallOptions, ::Hash]
430
429
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
431
430
  #
432
431
  # @overload mark_recommendation_succeeded(name: nil, state_metadata: nil, etag: nil)
433
- # @param name [String]
432
+ # Pass arguments to `mark_recommendation_succeeded` via keyword arguments. Note that at
433
+ # least one keyword argument is required. To specify no parameters, or to keep all
434
+ # the default parameter values, pass an empty Hash as a request object (see above).
435
+ #
436
+ # @param name [::String]
434
437
  # Required. Name of the recommendation.
435
- # @param state_metadata [Hash{String => String}]
438
+ # @param state_metadata [::Hash{::String => ::String}]
436
439
  # State properties to include with this state. Overwrites any existing
437
440
  # `state_metadata`.
438
441
  # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
439
442
  # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
440
- # @param etag [String]
443
+ # @param etag [::String]
441
444
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
442
445
  #
443
- #
444
446
  # @yield [response, operation] Access the result along with the RPC operation
445
- # @yieldparam response [Google::Cloud::Recommender::V1::Recommendation]
446
- # @yieldparam operation [GRPC::ActiveCall::Operation]
447
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Recommendation]
448
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
447
449
  #
448
- # @return [Google::Cloud::Recommender::V1::Recommendation]
450
+ # @return [::Google::Cloud::Recommender::V1::Recommendation]
449
451
  #
450
- # @raise [Google::Cloud::Error] if the RPC is aborted.
452
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
451
453
  #
452
454
  def mark_recommendation_succeeded request, options = nil
453
- raise ArgumentError, "request must be provided" if request.nil?
455
+ raise ::ArgumentError, "request must be provided" if request.nil?
454
456
 
455
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest
457
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest
456
458
 
457
459
  # Converts hash and nil to an options object
458
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
460
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
459
461
 
460
462
  # Customize the options with defaults
461
463
  metadata = @config.rpcs.mark_recommendation_succeeded.metadata.to_h
462
464
 
463
465
  # Set x-goog-api-client and x-goog-user-project headers
464
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
466
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
465
467
  lib_name: @config.lib_name, lib_version: @config.lib_version,
466
468
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
467
469
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -482,8 +484,8 @@ module Google
482
484
  yield response, operation if block_given?
483
485
  return response
484
486
  end
485
- rescue GRPC::BadStatus => e
486
- raise Google::Cloud::Error.from_error(e)
487
+ rescue ::GRPC::BadStatus => e
488
+ raise ::Google::Cloud::Error.from_error(e)
487
489
  end
488
490
 
489
491
  ##
@@ -499,53 +501,51 @@ module Google
499
501
  # recommender.
500
502
  #
501
503
  # @overload mark_recommendation_failed(request, options = nil)
502
- # @param request [Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest | Hash]
503
- # Mark the Recommendation State as Failed. Users can use this method to
504
- # indicate to the Recommender API that they have applied the recommendation
505
- # themselves, and the operation failed. This stops the recommendation content
506
- # from being updated.
507
- #
508
- # MarkRecommendationFailed can be applied to recommendations in ACTIVE,
509
- # CLAIMED, SUCCEEDED, or FAILED state.
510
- #
511
- # Requires the recommender.*.update IAM permission for the specified
512
- # recommender.
513
- # @param options [Gapic::CallOptions, Hash]
504
+ # Pass arguments to `mark_recommendation_failed` via a request object, either of type
505
+ # {::Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest} or an equivalent Hash.
506
+ #
507
+ # @param request [::Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest, ::Hash]
508
+ # A request object representing the call parameters. Required. To specify no
509
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
510
+ # @param options [::Gapic::CallOptions, ::Hash]
514
511
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
515
512
  #
516
513
  # @overload mark_recommendation_failed(name: nil, state_metadata: nil, etag: nil)
517
- # @param name [String]
514
+ # Pass arguments to `mark_recommendation_failed` via keyword arguments. Note that at
515
+ # least one keyword argument is required. To specify no parameters, or to keep all
516
+ # the default parameter values, pass an empty Hash as a request object (see above).
517
+ #
518
+ # @param name [::String]
518
519
  # Required. Name of the recommendation.
519
- # @param state_metadata [Hash{String => String}]
520
+ # @param state_metadata [::Hash{::String => ::String}]
520
521
  # State properties to include with this state. Overwrites any existing
521
522
  # `state_metadata`.
522
523
  # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
523
524
  # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
524
- # @param etag [String]
525
+ # @param etag [::String]
525
526
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
526
527
  #
527
- #
528
528
  # @yield [response, operation] Access the result along with the RPC operation
529
- # @yieldparam response [Google::Cloud::Recommender::V1::Recommendation]
530
- # @yieldparam operation [GRPC::ActiveCall::Operation]
529
+ # @yieldparam response [::Google::Cloud::Recommender::V1::Recommendation]
530
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
531
531
  #
532
- # @return [Google::Cloud::Recommender::V1::Recommendation]
532
+ # @return [::Google::Cloud::Recommender::V1::Recommendation]
533
533
  #
534
- # @raise [Google::Cloud::Error] if the RPC is aborted.
534
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
535
535
  #
536
536
  def mark_recommendation_failed request, options = nil
537
- raise ArgumentError, "request must be provided" if request.nil?
537
+ raise ::ArgumentError, "request must be provided" if request.nil?
538
538
 
539
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest
539
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest
540
540
 
541
541
  # Converts hash and nil to an options object
542
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
542
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
543
543
 
544
544
  # Customize the options with defaults
545
545
  metadata = @config.rpcs.mark_recommendation_failed.metadata.to_h
546
546
 
547
547
  # Set x-goog-api-client and x-goog-user-project headers
548
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
548
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
549
  lib_name: @config.lib_name, lib_version: @config.lib_version,
550
550
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
551
551
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -566,8 +566,8 @@ module Google
566
566
  yield response, operation if block_given?
567
567
  return response
568
568
  end
569
- rescue GRPC::BadStatus => e
570
- raise Google::Cloud::Error.from_error(e)
569
+ rescue ::GRPC::BadStatus => e
570
+ raise ::Google::Cloud::Error.from_error(e)
571
571
  end
572
572
 
573
573
  ##
@@ -577,7 +577,7 @@ module Google
577
577
  # providing control over timeouts, retry behavior, logging, transport
578
578
  # parameters, and other low-level controls. Certain parameters can also be
579
579
  # applied individually to specific RPCs. See
580
- # {Google::Cloud::Recommender::V1::Recommender::Client::Configuration::Rpcs}
580
+ # {::Google::Cloud::Recommender::V1::Recommender::Client::Configuration::Rpcs}
581
581
  # for a list of RPCs that can be configured independently.
582
582
  #
583
583
  # Configuration can be applied globally to all clients, or to a single client
@@ -588,22 +588,22 @@ module Google
588
588
  # To modify the global config, setting the timeout for list_recommendations
589
589
  # to 20 seconds, and all remaining timeouts to 10 seconds:
590
590
  #
591
- # Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
592
- # config.timeout = 10_000
593
- # config.rpcs.list_recommendations.timeout = 20_000
591
+ # ::Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
592
+ # config.timeout = 10.0
593
+ # config.rpcs.list_recommendations.timeout = 20.0
594
594
  # end
595
595
  #
596
596
  # To apply the above configuration only to a new client:
597
597
  #
598
- # client = Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
599
- # config.timeout = 10_000
600
- # config.rpcs.list_recommendations.timeout = 20_000
598
+ # client = ::Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
599
+ # config.timeout = 10.0
600
+ # config.rpcs.list_recommendations.timeout = 20.0
601
601
  # end
602
602
  #
603
603
  # @!attribute [rw] endpoint
604
604
  # The hostname or hostname:port of the service endpoint.
605
605
  # Defaults to `"recommender.googleapis.com"`.
606
- # @return [String]
606
+ # @return [::String]
607
607
  # @!attribute [rw] credentials
608
608
  # Credentials to send with calls. You may provide any of the following types:
609
609
  # * (`String`) The path to a service account key file in JSON format
@@ -615,29 +615,29 @@ module Google
615
615
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
616
616
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
617
617
  # * (`nil`) indicating no credentials
618
- # @return [Object]
618
+ # @return [::Object]
619
619
  # @!attribute [rw] scope
620
620
  # The OAuth scopes
621
- # @return [Array<String>]
621
+ # @return [::Array<::String>]
622
622
  # @!attribute [rw] lib_name
623
623
  # The library name as recorded in instrumentation and logging
624
- # @return [String]
624
+ # @return [::String]
625
625
  # @!attribute [rw] lib_version
626
626
  # The library version as recorded in instrumentation and logging
627
- # @return [String]
627
+ # @return [::String]
628
628
  # @!attribute [rw] channel_args
629
629
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
630
630
  # `GRPC::Core::Channel` object is provided as the credential.
631
- # @return [Hash]
631
+ # @return [::Hash]
632
632
  # @!attribute [rw] interceptors
633
633
  # An array of interceptors that are run before calls are executed.
634
- # @return [Array<GRPC::ClientInterceptor>]
634
+ # @return [::Array<::GRPC::ClientInterceptor>]
635
635
  # @!attribute [rw] timeout
636
- # The call timeout in milliseconds.
637
- # @return [Numeric]
636
+ # The call timeout in seconds.
637
+ # @return [::Numeric]
638
638
  # @!attribute [rw] metadata
639
639
  # Additional gRPC headers to be sent with the call.
640
- # @return [Hash{Symbol=>String}]
640
+ # @return [::Hash{::Symbol=>::String}]
641
641
  # @!attribute [rw] retry_policy
642
642
  # The retry policy. The value is a hash with the following keys:
643
643
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -645,25 +645,29 @@ module Google
645
645
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
646
646
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
647
647
  # trigger a retry.
648
- # @return [Hash]
648
+ # @return [::Hash]
649
+ # @!attribute [rw] quota_project
650
+ # A separate project against which to charge quota.
651
+ # @return [::String]
649
652
  #
650
653
  class Configuration
651
- extend Gapic::Config
654
+ extend ::Gapic::Config
652
655
 
653
- config_attr :endpoint, "recommender.googleapis.com", String
654
- config_attr :credentials, nil do |value|
656
+ config_attr :endpoint, "recommender.googleapis.com", ::String
657
+ config_attr :credentials, nil do |value|
655
658
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
656
659
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
657
660
  allowed.any? { |klass| klass === value }
658
661
  end
659
- config_attr :scope, nil, String, Array, nil
660
- config_attr :lib_name, nil, String, nil
661
- config_attr :lib_version, nil, String, nil
662
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
663
- config_attr :interceptors, nil, Array, nil
664
- config_attr :timeout, nil, Numeric, nil
665
- config_attr :metadata, nil, Hash, nil
666
- config_attr :retry_policy, nil, Hash, Proc, nil
662
+ config_attr :scope, nil, ::String, ::Array, nil
663
+ config_attr :lib_name, nil, ::String, nil
664
+ config_attr :lib_version, nil, ::String, nil
665
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
666
+ config_attr :interceptors, nil, ::Array, nil
667
+ config_attr :timeout, nil, ::Numeric, nil
668
+ config_attr :metadata, nil, ::Hash, nil
669
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
670
+ config_attr :quota_project, nil, ::String, nil
667
671
 
668
672
  # @private
669
673
  def initialize parent_config = nil
@@ -704,42 +708,42 @@ module Google
704
708
  class Rpcs
705
709
  ##
706
710
  # RPC-specific configuration for `list_recommendations`
707
- # @return [Gapic::Config::Method]
711
+ # @return [::Gapic::Config::Method]
708
712
  #
709
713
  attr_reader :list_recommendations
710
714
  ##
711
715
  # RPC-specific configuration for `get_recommendation`
712
- # @return [Gapic::Config::Method]
716
+ # @return [::Gapic::Config::Method]
713
717
  #
714
718
  attr_reader :get_recommendation
715
719
  ##
716
720
  # RPC-specific configuration for `mark_recommendation_claimed`
717
- # @return [Gapic::Config::Method]
721
+ # @return [::Gapic::Config::Method]
718
722
  #
719
723
  attr_reader :mark_recommendation_claimed
720
724
  ##
721
725
  # RPC-specific configuration for `mark_recommendation_succeeded`
722
- # @return [Gapic::Config::Method]
726
+ # @return [::Gapic::Config::Method]
723
727
  #
724
728
  attr_reader :mark_recommendation_succeeded
725
729
  ##
726
730
  # RPC-specific configuration for `mark_recommendation_failed`
727
- # @return [Gapic::Config::Method]
731
+ # @return [::Gapic::Config::Method]
728
732
  #
729
733
  attr_reader :mark_recommendation_failed
730
734
 
731
735
  # @private
732
736
  def initialize parent_rpcs = nil
733
737
  list_recommendations_config = parent_rpcs&.list_recommendations if parent_rpcs&.respond_to? :list_recommendations
734
- @list_recommendations = Gapic::Config::Method.new list_recommendations_config
738
+ @list_recommendations = ::Gapic::Config::Method.new list_recommendations_config
735
739
  get_recommendation_config = parent_rpcs&.get_recommendation if parent_rpcs&.respond_to? :get_recommendation
736
- @get_recommendation = Gapic::Config::Method.new get_recommendation_config
740
+ @get_recommendation = ::Gapic::Config::Method.new get_recommendation_config
737
741
  mark_recommendation_claimed_config = parent_rpcs&.mark_recommendation_claimed if parent_rpcs&.respond_to? :mark_recommendation_claimed
738
- @mark_recommendation_claimed = Gapic::Config::Method.new mark_recommendation_claimed_config
742
+ @mark_recommendation_claimed = ::Gapic::Config::Method.new mark_recommendation_claimed_config
739
743
  mark_recommendation_succeeded_config = parent_rpcs&.mark_recommendation_succeeded if parent_rpcs&.respond_to? :mark_recommendation_succeeded
740
- @mark_recommendation_succeeded = Gapic::Config::Method.new mark_recommendation_succeeded_config
744
+ @mark_recommendation_succeeded = ::Gapic::Config::Method.new mark_recommendation_succeeded_config
741
745
  mark_recommendation_failed_config = parent_rpcs&.mark_recommendation_failed if parent_rpcs&.respond_to? :mark_recommendation_failed
742
- @mark_recommendation_failed = Gapic::Config::Method.new mark_recommendation_failed_config
746
+ @mark_recommendation_failed = ::Gapic::Config::Method.new mark_recommendation_failed_config
743
747
 
744
748
  yield self if block_given?
745
749
  end
@@ -751,13 +755,3 @@ module Google
751
755
  end
752
756
  end
753
757
  end
754
-
755
- # rubocop:disable Lint/HandleExceptions
756
-
757
- # Once client is loaded, load helpers.rb if it exists.
758
- begin
759
- require "google/cloud/recommender/v1/recommender/helpers"
760
- rescue LoadError
761
- end
762
-
763
- # rubocop:enable Lint/HandleExceptions