google-cloud-recommender-v1 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 736646a7b14bb372a37c935d1226bc4b44eaf94b05ce0f310cdcfb34fca8757d
4
- data.tar.gz: ce84d36a2d29029c05bf87a776ba66f2a89560dab41dfcc1c4628472b84b4e4c
3
+ metadata.gz: 0c07ede538d7b6fe226deff0fe9555b72bc8b1ef957c4d1badf2bcfe1e8131db
4
+ data.tar.gz: 2a2578a106bae9b06695edafff7e5ada609faeaf62bb7dfa34d3deb6f15ac62c
5
5
  SHA512:
6
- metadata.gz: 0cb5533b2734e04980a328e56cd9d12c3607adadc387e51506e47281cb5175099df39354609d9be0bfa15e47b570b491ab4bc21bab5171b2a51a3e89cfe56d82
7
- data.tar.gz: 9b8cfe7d18e2e5f8eac84fcee2e3501405811a508f2d1f18e694a2339dd1b39b8cd7c82d96b52020c1b93f44028fc3787e3d4298659c76a7cf53b13f37a4707d
6
+ metadata.gz: a115cc7aafef4de636abb88c6a3e9d6e6a127f24fca040ff6752cd0d993e9f72cd6e1da5207db2820c7cfafd7ebc2030500f92295c281fd7fdba1adf2ba0f487
7
+ data.tar.gz: 7d1a8ad0828a66cd7959530436aba412a405222e59df4377bb0c917d1f7d4e1332f4b425beefcd9535da1eaaafb450d01916e0620c35560ba6e840f9ec33c747
data/AUTHENTICATION.md CHANGED
@@ -1,16 +1,17 @@
1
1
  # Authentication
2
2
 
3
- In general, the google-cloud-recommender-v1 library uses [Service
4
- Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
- credentials to connect to Google Cloud services. When running within [Google
6
- Cloud Platform environments](#google-cloud-platform-environments)
7
- the credentials will be discovered automatically. When running on other
3
+ In general, the google-cloud-recommender-v1 library uses
4
+ [Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
5
+ credentials to connect to Google Cloud services. When running within
6
+ [Google Cloud Platform environments](#google-cloud-platform-environments) the
7
+ credentials will be discovered automatically. When running on other
8
8
  environments, the Service Account credentials can be specified by providing the
9
- path to the [JSON
10
- keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
11
- the account (or the JSON itself) in [environment
12
- variables](#environment-variables). Additionally, Cloud SDK credentials can also
13
- be discovered automatically, but this is only recommended during development.
9
+ path to the
10
+ [JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys)
11
+ for the account (or the JSON itself) in
12
+ [environment variables](#environment-variables). Additionally, Cloud SDK
13
+ credentials can also be discovered automatically, but this is only recommended
14
+ during development.
14
15
 
15
16
  ## Quickstart
16
17
 
@@ -46,23 +47,24 @@ without **Service Account Credentials** directly in code.
46
47
 
47
48
  ### Google Cloud Platform environments
48
49
 
49
- When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE),
50
- Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions
51
- (GCF) and Cloud Run, **Credentials** and are discovered
52
- automatically. Code should be written as if already authenticated.
50
+ When running on Google Cloud Platform (GCP), including Google Compute Engine
51
+ (GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
52
+ Functions (GCF) and Cloud Run, **Credentials** are discovered automatically.
53
+ Code should be written as if already authenticated.
53
54
 
54
55
  ### Environment Variables
55
56
 
56
- The **Credentials JSON** can be placed in environment
57
- variables instead of declaring them directly in code. Each service has its own
58
- environment variable, allowing for different service accounts to be used for
59
- different services. (See the READMEs for the individual service gems for
60
- details.) The path to the **Credentials JSON** file can be stored in the
61
- environment variable, or the **Credentials JSON** itself can be stored for
62
- environments such as Docker containers where writing files is difficult or not
63
- encouraged.
57
+ The **Credentials JSON** can be placed in environment variables instead of
58
+ declaring them directly in code. Each service has its own environment variable,
59
+ allowing for different service accounts to be used for different services. (See
60
+ the READMEs for the individual service gems for details.) The path to the
61
+ **Credentials JSON** file can be stored in the environment variable, or the
62
+ **Credentials JSON** itself can be stored for environments such as Docker
63
+ containers where writing files is difficult or not encouraged.
64
64
 
65
- The environment variables that google-cloud-recommender-v1 checks for credentials are configured on the service Credentials class (such as {Google::Cloud::Recommender::V1::Recommender::Credentials}):
65
+ The environment variables that google-cloud-recommender-v1
66
+ checks for credentials are configured on the service Credentials class (such as
67
+ {Google::Cloud::Recommender::V1::Recommender::Credentials}):
66
68
 
67
69
  1. `RECOMMENDER_CREDENTIALS` - Path to JSON file, or JSON contents
68
70
  2. `RECOMMENDER_KEYFILE` - Path to JSON file, or JSON contents
@@ -80,7 +82,8 @@ client = Google::Cloud::Recommender::V1::Recommender::Client.new
80
82
 
81
83
  ### Configuration
82
84
 
83
- The **Credentials JSON** can be configured instead of placing them in environment variables. Either on an individual client initialization:
85
+ The **Credentials JSON** can be configured instead of placing them in
86
+ environment variables. Either on an individual client initialization:
84
87
 
85
88
  ```ruby
86
89
  require "google/cloud/recommender/v1"
@@ -137,15 +140,15 @@ environments](#google-cloud-platform-environments), you need a Google
137
140
  Developers service account.
138
141
 
139
142
  1. Visit the [Google Developers Console][dev-console].
140
- 1. Create a new project or click on an existing project.
141
- 1. Activate the slide-out navigation tray and select **API Manager**. From
143
+ 2. Create a new project or click on an existing project.
144
+ 3. Activate the slide-out navigation tray and select **API Manager**. From
142
145
  here, you will enable the APIs that your application requires.
143
146
 
144
147
  ![Enable the APIs that your application requires][enable-apis]
145
148
 
146
149
  *Note: You may need to enable billing in order to use these services.*
147
150
 
148
- 1. Select **Credentials** from the side navigation.
151
+ 4. Select **Credentials** from the side navigation.
149
152
 
150
153
  You should see a screen like one of the following.
151
154
 
@@ -40,7 +40,18 @@ module Google
40
40
  attr_reader :recommender_stub
41
41
 
42
42
  ##
43
- # Configuration for the Recommender Client API.
43
+ # Configure the Recommender Client class.
44
+ #
45
+ # See {Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # ## Example
49
+ #
50
+ # To modify the configuration for all Recommender clients:
51
+ #
52
+ # Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
53
+ # config.timeout = 10_000
54
+ # end
44
55
  #
45
56
  # @yield [config] Configure the Client client.
46
57
  # @yieldparam config [Client::Configuration]
@@ -56,7 +67,31 @@ module Google
56
67
  break parent_const.configure if parent_const&.respond_to? :configure
57
68
  namespace.pop
58
69
  end
59
- Client::Configuration.new parent_config
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.rpcs.list_recommendations.timeout = 60.0
73
+ default_config.rpcs.list_recommendations.retry_policy = {
74
+ initial_delay: 0.1,
75
+ max_delay: 60.0,
76
+ multiplier: 1.3,
77
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
78
+ }
79
+
80
+ default_config.rpcs.get_recommendation.timeout = 60.0
81
+ default_config.rpcs.get_recommendation.retry_policy = {
82
+ initial_delay: 0.1,
83
+ max_delay: 60.0,
84
+ multiplier: 1.3,
85
+ retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
86
+ }
87
+
88
+ default_config.rpcs.mark_recommendation_claimed.timeout = 60.0
89
+
90
+ default_config.rpcs.mark_recommendation_succeeded.timeout = 60.0
91
+
92
+ default_config.rpcs.mark_recommendation_failed.timeout = 60.0
93
+
94
+ default_config
60
95
  end
61
96
  yield @configure if block_given?
62
97
  @configure
@@ -69,6 +104,9 @@ module Google
69
104
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
70
105
  # should be made on {Client.configure}.
71
106
  #
107
+ # See {Google::Cloud::Recommender::V1::Recommender::Client::Configuration}
108
+ # for a description of the configuration fields.
109
+ #
72
110
  # @yield [config] Configure the Client client.
73
111
  # @yieldparam config [Client::Configuration]
74
112
  #
@@ -80,9 +118,23 @@ module Google
80
118
  end
81
119
 
82
120
  ##
83
- # Create a new Client client object.
121
+ # Create a new Recommender client object.
84
122
  #
85
- # @yield [config] Configure the Client client.
123
+ # ## Examples
124
+ #
125
+ # To create a new Recommender client with the default
126
+ # configuration:
127
+ #
128
+ # client = Google::Cloud::Recommender::V1::Recommender::Client.new
129
+ #
130
+ # To create a new Recommender client with a custom
131
+ # configuration:
132
+ #
133
+ # client = Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
134
+ # config.timeout = 10_000
135
+ # end
136
+ #
137
+ # @yield [config] Configure the Recommender client.
86
138
  # @yieldparam config [Client::Configuration]
87
139
  #
88
140
  def initialize
@@ -104,7 +156,7 @@ module Google
104
156
  if credentials.is_a?(String) || credentials.is_a?(Hash)
105
157
  credentials = Credentials.new credentials, scope: @config.scope
106
158
  end
107
-
159
+ @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
108
160
 
109
161
  @recommender_stub = Gapic::ServiceStub.new(
110
162
  Google::Cloud::Recommender::V1::Recommender::Stub,
@@ -167,15 +219,16 @@ module Google
167
219
  request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::ListRecommendationsRequest
168
220
 
169
221
  # Converts hash and nil to an options object
170
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
222
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
171
223
 
172
224
  # Customize the options with defaults
173
225
  metadata = @config.rpcs.list_recommendations.metadata.to_h
174
226
 
175
- # Set x-goog-api-client header
227
+ # Set x-goog-api-client and x-goog-user-project headers
176
228
  metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
177
229
  lib_name: @config.lib_name, lib_version: @config.lib_version,
178
230
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
231
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
179
232
 
180
233
  header_params = {
181
234
  "parent" => request.parent
@@ -228,15 +281,16 @@ module Google
228
281
  request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::GetRecommendationRequest
229
282
 
230
283
  # Converts hash and nil to an options object
231
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
284
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
285
 
233
286
  # Customize the options with defaults
234
287
  metadata = @config.rpcs.get_recommendation.metadata.to_h
235
288
 
236
- # Set x-goog-api-client header
289
+ # Set x-goog-api-client and x-goog-user-project headers
237
290
  metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
238
291
  lib_name: @config.lib_name, lib_version: @config.lib_version,
239
292
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
293
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
240
294
 
241
295
  header_params = {
242
296
  "name" => request.name
@@ -291,8 +345,8 @@ module Google
291
345
  # @param state_metadata [Hash{String => String}]
292
346
  # State properties to include with this state. Overwrites any existing
293
347
  # `state_metadata`.
294
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
295
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
348
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
349
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
296
350
  # @param etag [String]
297
351
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
298
352
  #
@@ -311,15 +365,16 @@ module Google
311
365
  request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationClaimedRequest
312
366
 
313
367
  # Converts hash and nil to an options object
314
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
368
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
315
369
 
316
370
  # Customize the options with defaults
317
371
  metadata = @config.rpcs.mark_recommendation_claimed.metadata.to_h
318
372
 
319
- # Set x-goog-api-client header
373
+ # Set x-goog-api-client and x-goog-user-project headers
320
374
  metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
321
375
  lib_name: @config.lib_name, lib_version: @config.lib_version,
322
376
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
377
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
323
378
 
324
379
  header_params = {
325
380
  "name" => request.name
@@ -374,8 +429,8 @@ module Google
374
429
  # @param state_metadata [Hash{String => String}]
375
430
  # State properties to include with this state. Overwrites any existing
376
431
  # `state_metadata`.
377
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
378
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
432
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
433
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
379
434
  # @param etag [String]
380
435
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
381
436
  #
@@ -394,15 +449,16 @@ module Google
394
449
  request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationSucceededRequest
395
450
 
396
451
  # Converts hash and nil to an options object
397
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
452
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
398
453
 
399
454
  # Customize the options with defaults
400
455
  metadata = @config.rpcs.mark_recommendation_succeeded.metadata.to_h
401
456
 
402
- # Set x-goog-api-client header
457
+ # Set x-goog-api-client and x-goog-user-project headers
403
458
  metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
404
459
  lib_name: @config.lib_name, lib_version: @config.lib_version,
405
460
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
461
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
406
462
 
407
463
  header_params = {
408
464
  "name" => request.name
@@ -457,8 +513,8 @@ module Google
457
513
  # @param state_metadata [Hash{String => String}]
458
514
  # State properties to include with this state. Overwrites any existing
459
515
  # `state_metadata`.
460
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
461
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
516
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
517
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
462
518
  # @param etag [String]
463
519
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
464
520
  #
@@ -477,15 +533,16 @@ module Google
477
533
  request = Gapic::Protobuf.coerce request, to: Google::Cloud::Recommender::V1::MarkRecommendationFailedRequest
478
534
 
479
535
  # Converts hash and nil to an options object
480
- options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
536
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
481
537
 
482
538
  # Customize the options with defaults
483
539
  metadata = @config.rpcs.mark_recommendation_failed.metadata.to_h
484
540
 
485
- # Set x-goog-api-client header
541
+ # Set x-goog-api-client and x-goog-user-project headers
486
542
  metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
487
543
  lib_name: @config.lib_name, lib_version: @config.lib_version,
488
544
  gapic_version: ::Google::Cloud::Recommender::V1::VERSION
545
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
489
546
 
490
547
  header_params = {
491
548
  "name" => request.name
@@ -509,6 +566,81 @@ module Google
509
566
 
510
567
  ##
511
568
  # Configuration class for the Recommender API.
569
+ #
570
+ # This class represents the configuration for Recommender,
571
+ # providing control over timeouts, retry behavior, logging, transport
572
+ # parameters, and other low-level controls. Certain parameters can also be
573
+ # applied individually to specific RPCs. See
574
+ # {Google::Cloud::Recommender::V1::Recommender::Client::Configuration::Rpcs}
575
+ # for a list of RPCs that can be configured independently.
576
+ #
577
+ # Configuration can be applied globally to all clients, or to a single client
578
+ # on construction.
579
+ #
580
+ # # Examples
581
+ #
582
+ # To modify the global config, setting the timeout for list_recommendations
583
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
584
+ #
585
+ # Google::Cloud::Recommender::V1::Recommender::Client.configure do |config|
586
+ # config.timeout = 10_000
587
+ # config.rpcs.list_recommendations.timeout = 20_000
588
+ # end
589
+ #
590
+ # To apply the above configuration only to a new client:
591
+ #
592
+ # client = Google::Cloud::Recommender::V1::Recommender::Client.new do |config|
593
+ # config.timeout = 10_000
594
+ # config.rpcs.list_recommendations.timeout = 20_000
595
+ # end
596
+ #
597
+ # @!attribute [rw] endpoint
598
+ # The hostname or hostname:port of the service endpoint.
599
+ # Defaults to `"recommender.googleapis.com"`.
600
+ # @return [String]
601
+ # @!attribute [rw] credentials
602
+ # Credentials to send with calls. You may provide any of the following types:
603
+ # * (`String`) The path to a service account key file in JSON format
604
+ # * (`Hash`) A service account key as a Hash
605
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
606
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
607
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
608
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
609
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
610
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
611
+ # * (`nil`) indicating no credentials
612
+ # @return [Object]
613
+ # @!attribute [rw] scope
614
+ # The OAuth scopes
615
+ # @return [Array<String>]
616
+ # @!attribute [rw] lib_name
617
+ # The library name as recorded in instrumentation and logging
618
+ # @return [String]
619
+ # @!attribute [rw] lib_version
620
+ # The library version as recorded in instrumentation and logging
621
+ # @return [String]
622
+ # @!attribute [rw] channel_args
623
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
624
+ # `GRPC::Core::Channel` object is provided as the credential.
625
+ # @return [Hash]
626
+ # @!attribute [rw] interceptors
627
+ # An array of interceptors that are run before calls are executed.
628
+ # @return [Array<GRPC::ClientInterceptor>]
629
+ # @!attribute [rw] timeout
630
+ # The call timeout in milliseconds.
631
+ # @return [Numeric]
632
+ # @!attribute [rw] metadata
633
+ # Additional gRPC headers to be sent with the call.
634
+ # @return [Hash{Symbol=>String}]
635
+ # @!attribute [rw] retry_policy
636
+ # The retry policy. The value is a hash with the following keys:
637
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
638
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
639
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
640
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
641
+ # trigger a retry.
642
+ # @return [Hash]
643
+ #
512
644
  class Configuration
513
645
  extend Gapic::Config
514
646
 
@@ -527,12 +659,17 @@ module Google
527
659
  config_attr :metadata, nil, Hash, nil
528
660
  config_attr :retry_policy, nil, Hash, Proc, nil
529
661
 
662
+ # @private
530
663
  def initialize parent_config = nil
531
664
  @parent_config = parent_config unless parent_config.nil?
532
665
 
533
666
  yield self if block_given?
534
667
  end
535
668
 
669
+ ##
670
+ # Configurations for individual RPCs
671
+ # @return [Rpcs]
672
+ #
536
673
  def rpcs
537
674
  @rpcs ||= begin
538
675
  parent_rpcs = nil
@@ -543,13 +680,49 @@ module Google
543
680
 
544
681
  ##
545
682
  # Configuration RPC class for the Recommender API.
683
+ #
684
+ # Includes fields providing the configuration for each RPC in this service.
685
+ # Each configuration object is of type `Gapic::Config::Method` and includes
686
+ # the following configuration fields:
687
+ #
688
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
689
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
690
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
691
+ # include the following keys:
692
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
693
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
694
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
695
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
696
+ # trigger a retry.
697
+ #
546
698
  class Rpcs
699
+ ##
700
+ # RPC-specific configuration for `list_recommendations`
701
+ # @return [Gapic::Config::Method]
702
+ #
547
703
  attr_reader :list_recommendations
704
+ ##
705
+ # RPC-specific configuration for `get_recommendation`
706
+ # @return [Gapic::Config::Method]
707
+ #
548
708
  attr_reader :get_recommendation
709
+ ##
710
+ # RPC-specific configuration for `mark_recommendation_claimed`
711
+ # @return [Gapic::Config::Method]
712
+ #
549
713
  attr_reader :mark_recommendation_claimed
714
+ ##
715
+ # RPC-specific configuration for `mark_recommendation_succeeded`
716
+ # @return [Gapic::Config::Method]
717
+ #
550
718
  attr_reader :mark_recommendation_succeeded
719
+ ##
720
+ # RPC-specific configuration for `mark_recommendation_failed`
721
+ # @return [Gapic::Config::Method]
722
+ #
551
723
  attr_reader :mark_recommendation_failed
552
724
 
725
+ # @private
553
726
  def initialize parent_rpcs = nil
554
727
  list_recommendations_config = parent_rpcs&.list_recommendations if parent_rpcs&.respond_to? :list_recommendations
555
728
  @list_recommendations = Gapic::Config::Method.new list_recommendations_config
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Recommender
23
23
  module V1
24
- VERSION = "0.1.1"
24
+ VERSION = "0.2.0"
25
25
  end
26
26
  end
27
27
  end
@@ -27,110 +27,110 @@ module Google
27
27
  #
28
28
  # Example:
29
29
  #
30
- # message Topic \\\{
30
+ # message Topic {
31
31
  # // Indicates this message defines a resource schema.
32
- # // Declares the resource type in the format of \\\{service\}/\\\{kind\}.
33
- # // For Kubernetes resources, the format is \\\{api group\}/\\\{kind\}.
34
- # option (google.api.resource) = \\\{
32
+ # // Declares the resource type in the format of {service}/{kind}.
33
+ # // For Kubernetes resources, the format is {api group}/{kind}.
34
+ # option (google.api.resource) = {
35
35
  # type: "pubsub.googleapis.com/Topic"
36
- # name_descriptor: \\\{
37
- # pattern: "projects/\\\{project\}/topics/\\\{topic\}"
36
+ # name_descriptor: {
37
+ # pattern: "projects/{project}/topics/{topic}"
38
38
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
39
- # parent_name_extractor: "projects/\\\{project\}"
40
- # \}
41
- # \};
42
- # \}
39
+ # parent_name_extractor: "projects/{project}"
40
+ # }
41
+ # };
42
+ # }
43
43
  #
44
44
  # The ResourceDescriptor Yaml config will look like:
45
45
  #
46
46
  # resources:
47
47
  # - type: "pubsub.googleapis.com/Topic"
48
48
  # name_descriptor:
49
- # - pattern: "projects/\\\{project\}/topics/\\\{topic\}"
49
+ # - pattern: "projects/\\{project}/topics/\\{topic}"
50
50
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/\\\{project\}"
51
+ # parent_name_extractor: "projects/\\{project}"
52
52
  #
53
53
  # Sometimes, resources have multiple patterns, typically because they can
54
54
  # live under multiple parents.
55
55
  #
56
56
  # Example:
57
57
  #
58
- # message LogEntry \\\{
59
- # option (google.api.resource) = \\\{
58
+ # message LogEntry {
59
+ # option (google.api.resource) = {
60
60
  # type: "logging.googleapis.com/LogEntry"
61
- # name_descriptor: \\\{
62
- # pattern: "projects/\\\{project\}/logs/\\\{log\}"
61
+ # name_descriptor: {
62
+ # pattern: "projects/{project}/logs/{log}"
63
63
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
64
- # parent_name_extractor: "projects/\\\{project\}"
65
- # \}
66
- # name_descriptor: \\\{
67
- # pattern: "folders/\\\{folder\}/logs/\\\{log\}"
64
+ # parent_name_extractor: "projects/{project}"
65
+ # }
66
+ # name_descriptor: {
67
+ # pattern: "folders/{folder}/logs/{log}"
68
68
  # parent_type: "cloudresourcemanager.googleapis.com/Folder"
69
- # parent_name_extractor: "folders/\\\{folder\}"
70
- # \}
71
- # name_descriptor: \\\{
72
- # pattern: "organizations/\\\{organization\}/logs/\\\{log\}"
69
+ # parent_name_extractor: "folders/{folder}"
70
+ # }
71
+ # name_descriptor: {
72
+ # pattern: "organizations/{organization}/logs/{log}"
73
73
  # parent_type: "cloudresourcemanager.googleapis.com/Organization"
74
- # parent_name_extractor: "organizations/\\\{organization\}"
75
- # \}
76
- # name_descriptor: \\\{
77
- # pattern: "billingAccounts/\\\{billing_account\}/logs/\\\{log\}"
74
+ # parent_name_extractor: "organizations/{organization}"
75
+ # }
76
+ # name_descriptor: {
77
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
78
78
  # parent_type: "billing.googleapis.com/BillingAccount"
79
- # parent_name_extractor: "billingAccounts/\\\{billing_account\}"
80
- # \}
81
- # \};
82
- # \}
79
+ # parent_name_extractor: "billingAccounts/{billing_account}"
80
+ # }
81
+ # };
82
+ # }
83
83
  #
84
84
  # The ResourceDescriptor Yaml config will look like:
85
85
  #
86
86
  # resources:
87
87
  # - type: 'logging.googleapis.com/LogEntry'
88
88
  # name_descriptor:
89
- # - pattern: "projects/\\\{project\}/logs/\\\{log\}"
89
+ # - pattern: "projects/{project}/logs/{log}"
90
90
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
91
- # parent_name_extractor: "projects/\\\{project\}"
92
- # - pattern: "folders/\\\{folder\}/logs/\\\{log\}"
91
+ # parent_name_extractor: "projects/{project}"
92
+ # - pattern: "folders/{folder}/logs/{log}"
93
93
  # parent_type: "cloudresourcemanager.googleapis.com/Folder"
94
- # parent_name_extractor: "folders/\\\{folder\}"
95
- # - pattern: "organizations/\\\{organization\}/logs/\\\{log\}"
94
+ # parent_name_extractor: "folders/{folder}"
95
+ # - pattern: "organizations/{organization}/logs/{log}"
96
96
  # parent_type: "cloudresourcemanager.googleapis.com/Organization"
97
- # parent_name_extractor: "organizations/\\\{organization\}"
98
- # - pattern: "billingAccounts/\\\{billing_account\}/logs/\\\{log\}"
97
+ # parent_name_extractor: "organizations/{organization}"
98
+ # - pattern: "billingAccounts/{billing_account}/logs/{log}"
99
99
  # parent_type: "billing.googleapis.com/BillingAccount"
100
- # parent_name_extractor: "billingAccounts/\\\{billing_account\}"
100
+ # parent_name_extractor: "billingAccounts/{billing_account}"
101
101
  #
102
102
  # For flexible resources, the resource name doesn't contain parent names, but
103
103
  # the resource itself has parents for policy evaluation.
104
104
  #
105
105
  # Example:
106
106
  #
107
- # message Shelf \\\{
108
- # option (google.api.resource) = \\\{
107
+ # message Shelf {
108
+ # option (google.api.resource) = {
109
109
  # type: "library.googleapis.com/Shelf"
110
- # name_descriptor: \\\{
111
- # pattern: "shelves/\\\{shelf\}"
110
+ # name_descriptor: {
111
+ # pattern: "shelves/{shelf}"
112
112
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
113
- # \}
114
- # name_descriptor: \\\{
115
- # pattern: "shelves/\\\{shelf\}"
113
+ # }
114
+ # name_descriptor: {
115
+ # pattern: "shelves/{shelf}"
116
116
  # parent_type: "cloudresourcemanager.googleapis.com/Folder"
117
- # \}
118
- # \};
119
- # \}
117
+ # }
118
+ # };
119
+ # }
120
120
  #
121
121
  # The ResourceDescriptor Yaml config will look like:
122
122
  #
123
123
  # resources:
124
124
  # - type: 'library.googleapis.com/Shelf'
125
125
  # name_descriptor:
126
- # - pattern: "shelves/\\\{shelf\}"
126
+ # - pattern: "shelves/{shelf}"
127
127
  # parent_type: "cloudresourcemanager.googleapis.com/Project"
128
- # - pattern: "shelves/\\\{shelf\}"
128
+ # - pattern: "shelves/{shelf}"
129
129
  # parent_type: "cloudresourcemanager.googleapis.com/Folder"
130
130
  # @!attribute [rw] type
131
131
  # @return [String]
132
132
  # The resource type. It must be in the format of
133
- # \\\{service_name\}/\\\{resource_type_kind\}. The `resource_type_kind` must be
133
+ # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be
134
134
  # singular and must not include version numbers.
135
135
  #
136
136
  # Example: `storage.googleapis.com/Bucket`
@@ -147,14 +147,14 @@ module Google
147
147
  # The path pattern must follow the syntax, which aligns with HTTP binding
148
148
  # syntax:
149
149
  #
150
- # Template = Segment \\\{ "/" Segment \} ;
150
+ # Template = Segment { "/" Segment } ;
151
151
  # Segment = LITERAL | Variable ;
152
- # Variable = "\\\{" LITERAL "\}" ;
152
+ # Variable = "{" LITERAL "}" ;
153
153
  #
154
154
  # Examples:
155
155
  #
156
- # - "projects/\\\{project\}/topics/\\\{topic\}"
157
- # - "projects/\\\{project\}/knowledgeBases/\\\{knowledge_base\}"
156
+ # - "projects/\\{project}/topics/\\{topic}"
157
+ # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}"
158
158
  #
159
159
  # The components in braces correspond to the IDs for each resource in the
160
160
  # hierarchy. It is expected that, if multiple patterns are provided,
@@ -165,26 +165,26 @@ module Google
165
165
  # Optional. The field on the resource that designates the resource name
166
166
  # field. If omitted, this is assumed to be "name".
167
167
  # @!attribute [rw] history
168
- # @return [ENUM(History)]
168
+ # @return [Google::Api::ResourceDescriptor::History]
169
169
  # Optional. The historical or future-looking state of the resource pattern.
170
170
  #
171
171
  # Example:
172
172
  #
173
173
  # // The InspectTemplate message originally only supported resource
174
174
  # // names with organization, and project was added later.
175
- # message InspectTemplate \\\{
176
- # option (google.api.resource) = \\\{
175
+ # message InspectTemplate {
176
+ # option (google.api.resource) = {
177
177
  # type: "dlp.googleapis.com/InspectTemplate"
178
178
  # pattern:
179
- # "organizations/\\\{organization\}/inspectTemplates/\\\{inspect_template\}"
180
- # pattern: "projects/\\\{project\}/inspectTemplates/\\\{inspect_template\}"
179
+ # "organizations/{organization}/inspectTemplates/{inspect_template}"
180
+ # pattern: "projects/{project}/inspectTemplates/{inspect_template}"
181
181
  # history: ORIGINALLY_SINGLE_PATTERN
182
- # \};
183
- # \}
182
+ # };
183
+ # }
184
184
  # @!attribute [rw] plural
185
185
  # @return [String]
186
186
  # The plural name used in the resource name, such as 'projects' for
187
- # the name of 'projects/\\\{project\}'. It is the same concept of the `plural`
187
+ # the name of 'projects/\\{project}'. It is the same concept of the `plural`
188
188
  # field in k8s CRD spec
189
189
  # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
190
190
  # @!attribute [rw] singular
@@ -221,11 +221,11 @@ module Google
221
221
  #
222
222
  # Example:
223
223
  #
224
- # message Subscription \\\{
225
- # string topic = 2 [(google.api.resource_reference) = \\\{
224
+ # message Subscription {
225
+ # string topic = 2 [(google.api.resource_reference) = {
226
226
  # type: "pubsub.googleapis.com/Topic"
227
- # \}];
228
- # \}
227
+ # }];
228
+ # }
229
229
  # @!attribute [rw] child_type
230
230
  # @return [String]
231
231
  # The resource type of a child collection that the annotated field
@@ -234,11 +234,11 @@ module Google
234
234
  #
235
235
  # Example:
236
236
  #
237
- # message ListLogEntriesRequest \\\{
238
- # string parent = 1 [(google.api.resource_reference) = \\\{
237
+ # message ListLogEntriesRequest {
238
+ # string parent = 1 [(google.api.resource_reference) = {
239
239
  # child_type: "logging.googleapis.com/LogEntry"
240
- # \};
241
- # \}
240
+ # };
241
+ # }
242
242
  class ResourceReference
243
243
  include Google::Protobuf::MessageExts
244
244
  extend Google::Protobuf::MessageExts::ClassMethods
@@ -145,18 +145,18 @@ module Google
145
145
  # This is intended to be an exact match per filter. To perform advanced
146
146
  # matching, use path_value_matchers.
147
147
  #
148
- # * Example: \\\{
148
+ # * Example: {
149
149
  # "/versions/*/name" : "it-123"
150
150
  # "/versions/*/targetSize/percent": 20
151
- # \}
152
- # * Example: \\\{
151
+ # }
152
+ # * Example: {
153
153
  # "/bindings/*/role": "roles/admin"
154
154
  # "/bindings/*/condition" : null
155
- # \}
156
- # * Example: \\\{
155
+ # }
156
+ # * Example: {
157
157
  # "/bindings/*/role": "roles/admin"
158
158
  # "/bindings/*/members/*" : ["x@google.com", "y@google.com"]
159
- # \}
159
+ # }
160
160
  # When both path_filters and path_value_matchers are set, an implicit AND
161
161
  # must be performed.
162
162
  # @!attribute [rw] path_value_matchers
@@ -216,7 +216,7 @@ module Google
216
216
 
217
217
  # Contains the impact a recommendation can have for a given category.
218
218
  # @!attribute [rw] category
219
- # @return [ENUM(Category)]
219
+ # @return [Google::Cloud::Recommender::V1::Impact::Category]
220
220
  # Category that is being targeted.
221
221
  # @!attribute [rw] cost_projection
222
222
  # @return [Google::Cloud::Recommender::V1::CostProjection]
@@ -246,7 +246,7 @@ module Google
246
246
 
247
247
  # Information for state. Contains state and metadata.
248
248
  # @!attribute [rw] state
249
- # @return [ENUM(State)]
249
+ # @return [Google::Cloud::Recommender::V1::RecommendationStateInfo::State]
250
250
  # The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED.
251
251
  # @!attribute [rw] state_metadata
252
252
  # @return [Google::Protobuf::Map{String => String}]
@@ -83,8 +83,8 @@ module Google
83
83
  # @return [Google::Protobuf::Map{String => String}]
84
84
  # State properties to include with this state. Overwrites any existing
85
85
  # `state_metadata`.
86
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
87
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
86
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
87
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
88
88
  # @!attribute [rw] etag
89
89
  # @return [String]
90
90
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
@@ -110,8 +110,8 @@ module Google
110
110
  # @return [Google::Protobuf::Map{String => String}]
111
111
  # State properties to include with this state. Overwrites any existing
112
112
  # `state_metadata`.
113
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
114
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
113
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
114
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
115
115
  # @!attribute [rw] etag
116
116
  # @return [String]
117
117
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
@@ -137,8 +137,8 @@ module Google
137
137
  # @return [Google::Protobuf::Map{String => String}]
138
138
  # State properties to include with this state. Overwrites any existing
139
139
  # `state_metadata`.
140
- # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\\{0,62\}$/.
141
- # Values must match the regex /^[a-zA-Z0-9_./-]\\\{0,255\}$/.
140
+ # Keys must match the regex /^[a-z0-9][a-z0-9_.-]\\{0,62}$/.
141
+ # Values must match the regex /^[a-zA-Z0-9_./-]\\{0,255}$/.
142
142
  # @!attribute [rw] etag
143
143
  # @return [String]
144
144
  # Required. Fingerprint of the Recommendation. Provides optimistic locking.
@@ -37,13 +37,13 @@ module Google
37
37
  # duration.seconds = end.seconds - start.seconds;
38
38
  # duration.nanos = end.nanos - start.nanos;
39
39
  #
40
- # if (duration.seconds < 0 && duration.nanos > 0) \\\{
40
+ # if (duration.seconds < 0 && duration.nanos > 0) {
41
41
  # duration.seconds += 1;
42
42
  # duration.nanos -= 1000000000;
43
- # \} else if (durations.seconds > 0 && duration.nanos < 0) \\\{
43
+ # } else if (durations.seconds > 0 && duration.nanos < 0) {
44
44
  # duration.seconds -= 1;
45
45
  # duration.nanos += 1000000000;
46
- # \}
46
+ # }
47
47
  #
48
48
  # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
49
49
  #
@@ -54,13 +54,13 @@ module Google
54
54
  # end.seconds = start.seconds + duration.seconds;
55
55
  # end.nanos = start.nanos + duration.nanos;
56
56
  #
57
- # if (end.nanos < 0) \\\{
57
+ # if (end.nanos < 0) {
58
58
  # end.seconds -= 1;
59
59
  # end.nanos += 1000000000;
60
- # \} else if (end.nanos >= 1000000000) \\\{
60
+ # } else if (end.nanos >= 1000000000) {
61
61
  # end.seconds += 1;
62
62
  # end.nanos -= 1000000000;
63
- # \}
63
+ # }
64
64
  #
65
65
  # Example 3: Compute Duration from datetime.timedelta in Python.
66
66
  #
@@ -51,7 +51,7 @@ module Google
51
51
  #
52
52
  # The JSON representation for `Value` is JSON value.
53
53
  # @!attribute [rw] null_value
54
- # @return [ENUM(NullValue)]
54
+ # @return [Google::Protobuf::NullValue]
55
55
  # Represents a null value.
56
56
  # @!attribute [rw] number_value
57
57
  # @return [Float]
@@ -77,9 +77,9 @@ module Google
77
77
  #
78
78
  # In JSON format, the Timestamp type is encoded as a string in the
79
79
  # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
80
- # format is "\\\{year\}-\\\{month\}-\\\{day\}T\\\{hour\}:\\\{min\}:\\\{sec\}[.\\\{frac_sec\}]Z"
81
- # where \\\{year\} is always expressed using four digits while \\\{month\}, \\\{day\},
82
- # \\\{hour\}, \\\{min\}, and \\\{sec\} are zero-padded to two digits each. The fractional
80
+ # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
81
+ # where \\{year} is always expressed using four digits while \\{month}, \\{day},
82
+ # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
83
83
  # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
84
84
  # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
85
85
  # is required. A proto3 JSON serializer should always use UTC (as indicated by
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.1.1
4
+ version: 0.2.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-02-24 00:00:00.000000000 Z
11
+ date: 2020-03-18 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.1.0
19
+ version: '0.2'
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.1.0
26
+ version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-errors
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '12.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '12.0'
83
83
  - !ruby/object:Gem::Dependency
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.9'
103
+ version: '0.18'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.9'
110
+ version: '0.18'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: yard
113
113
  requirement: !ruby/object:Gem::Requirement