google-cloud-monitoring 0.38.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -54
  4. data/LICENSE.md +201 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +95 -52
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +286 -442
  9. data/lib/google/cloud/monitoring/dashboard.rb +88 -117
  10. data/lib/google/cloud/monitoring/{v3/doc/google/protobuf/wrappers.rb → dashboard/version.rb} +12 -9
  11. data/lib/google/cloud/monitoring/version.rb +6 -2
  12. metadata +73 -130
  13. data/LICENSE +0 -201
  14. data/lib/google/cloud/monitoring/dashboard/v1.rb +0 -148
  15. data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +0 -46
  16. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +0 -457
  17. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +0 -51
  18. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +0 -394
  19. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +0 -53
  20. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +0 -82
  21. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +0 -71
  22. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +0 -151
  23. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +0 -102
  24. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +0 -43
  25. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +0 -41
  26. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +0 -141
  27. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +0 -29
  29. data/lib/google/cloud/monitoring/v3.rb +0 -532
  30. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +0 -553
  31. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +0 -51
  32. data/lib/google/cloud/monitoring/v3/credentials.rb +0 -44
  33. data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +0 -200
  34. data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +0 -42
  35. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +0 -245
  36. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +0 -108
  37. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +0 -344
  38. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert_service.rb +0 -138
  39. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +0 -449
  40. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +0 -75
  41. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group_service.rb +0 -167
  42. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +0 -85
  43. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +0 -230
  44. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +0 -29
  45. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +0 -156
  46. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification_service.rb +0 -221
  47. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +0 -361
  48. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +0 -197
  49. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +0 -364
  50. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime_service.rb +0 -136
  51. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/any.rb +0 -131
  52. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +0 -91
  53. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/empty.rb +0 -29
  54. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +0 -222
  55. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/struct.rb +0 -74
  56. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/monitoring/v3/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/monitoring/v3/group_service_client.rb +0 -606
  59. data/lib/google/cloud/monitoring/v3/group_service_client_config.json +0 -56
  60. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +0 -750
  61. data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +0 -66
  62. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +0 -811
  63. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +0 -76
  64. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +0 -788
  65. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +0 -76
  66. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +0 -550
  67. data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +0 -56
  68. data/lib/google/monitoring/dashboard/v1/common_pb.rb +0 -95
  69. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +0 -29
  70. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +0 -51
  71. data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +0 -76
  72. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +0 -17
  73. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +0 -41
  74. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +0 -76
  75. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +0 -38
  76. data/lib/google/monitoring/dashboard/v1/service_pb.rb +0 -17
  77. data/lib/google/monitoring/dashboard/v1/text_pb.rb +0 -28
  78. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +0 -32
  79. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +0 -66
  80. data/lib/google/monitoring/v3/alert_pb.rb +0 -87
  81. data/lib/google/monitoring/v3/alert_service_pb.rb +0 -53
  82. data/lib/google/monitoring/v3/alert_service_services_pb.rb +0 -63
  83. data/lib/google/monitoring/v3/common_pb.rb +0 -95
  84. data/lib/google/monitoring/v3/dropped_labels_pb.rb +0 -19
  85. data/lib/google/monitoring/v3/group_pb.rb +0 -24
  86. data/lib/google/monitoring/v3/group_service_pb.rb +0 -73
  87. data/lib/google/monitoring/v3/group_service_services_pb.rb +0 -66
  88. data/lib/google/monitoring/v3/metric_pb.rb +0 -82
  89. data/lib/google/monitoring/v3/metric_service_pb.rb +0 -130
  90. data/lib/google/monitoring/v3/metric_service_services_pb.rb +0 -66
  91. data/lib/google/monitoring/v3/mutation_record_pb.rb +0 -21
  92. data/lib/google/monitoring/v3/notification_pb.rb +0 -47
  93. data/lib/google/monitoring/v3/notification_service_pb.rb +0 -90
  94. data/lib/google/monitoring/v3/notification_service_services_pb.rb +0 -94
  95. data/lib/google/monitoring/v3/service_pb.rb +0 -149
  96. data/lib/google/monitoring/v3/service_service_pb.rb +0 -86
  97. data/lib/google/monitoring/v3/service_service_services_pb.rb +0 -65
  98. data/lib/google/monitoring/v3/span_context_pb.rb +0 -19
  99. data/lib/google/monitoring/v3/uptime_pb.rb +0 -123
  100. data/lib/google/monitoring/v3/uptime_service_pb.rb +0 -63
  101. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +0 -67
data/README.md CHANGED
@@ -1,68 +1,53 @@
1
- # Ruby Client for Cloud Monitoring API
2
-
3
- [Cloud Monitoring API][Product Documentation]:
4
- Manages your Cloud Monitoring data and configurations. Most projects must
5
- be associated with a Workspace, with a few exceptions as noted on the
6
- individual method pages. The table entries below are presented in
7
- alphabetical order, not in order of common use. For explanations of the
8
- concepts found in the table entries, read the [Cloud Monitoring
9
- documentation](https://cloud.google.com/monitoring/docs).
10
- - [Client Library Documentation][]
11
- - [Product Documentation][]
1
+ # Ruby Client for the Cloud Monitoring API
12
2
 
13
- ## Quick Start
14
- In order to use this library, you first need to go through the following
15
- steps:
3
+ API Client library for the Cloud Monitoring API
16
4
 
17
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
18
- 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
19
- 3. [Enable the Cloud Monitoring API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
20
- 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-monitoring/latest/file.AUTHENTICATION.html)
5
+ Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation.
21
6
 
22
- ### Installation
23
- ```
24
- $ gem install google-cloud-monitoring
25
- ```
7
+ Actual client classes for the various versions of this API are defined in
8
+ _versioned_ client gems, with names of the form `google-cloud-monitoring-v*`.
9
+ The gem `google-cloud-monitoring` is the main client library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients. More information on versioned clients can be found below
12
+ in the section titled *Which client should I use?*.
26
13
 
27
- ### Preview
28
- #### MetricServiceClient
29
- ```rb
30
- require "google/cloud/monitoring"
14
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-monitoring/latest)
15
+ for this library, google-cloud-monitoring, to see the convenience methods for
16
+ constructing client objects. Reference documentation for the client objects
17
+ themselves can be found in the client library documentation for the versioned
18
+ client gems:
19
+ [google-cloud-monitoring-v3](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest).
31
20
 
32
- metric_client = Google::Cloud::Monitoring::Metric.new
33
- formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(project_id)
21
+ See also the [Product Documentation](https://cloud.google.com/monitoring)
22
+ for more usage information.
34
23
 
35
- # Iterate over all results.
36
- metric_client.list_monitored_resource_descriptors(formatted_name).each do |element|
37
- # Process element.
38
- end
24
+ ## Quick Start
39
25
 
40
- # Or iterate over results one page at a time.
41
- metric_client.list_monitored_resource_descriptors(formatted_name).each_page do |page|
42
- # Process each page at a time.
43
- page.each do |element|
44
- # Process element.
45
- end
46
- end
26
+ ```
27
+ $ gem install google-cloud-monitoring
47
28
  ```
48
29
 
49
- ### Next Steps
50
- - Read the [Client Library Documentation][] for Cloud Monitoring API
51
- to see other available methods on the client.
52
- - Read the [Cloud Monitoring API Product documentation][Product Documentation]
53
- to learn more about the product and see How-to Guides.
54
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
55
- to see the full list of Cloud APIs that we cover.
30
+ In order to use this library, you first need to go through the following steps:
56
31
 
57
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-monitoring/latest
58
- [Product Documentation]: https://cloud.google.com/monitoring
32
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
33
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
34
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
35
+ 1. {file:AUTHENTICATION.md Set up authentication.}
36
+
37
+ ## Migrating from 0.x versions
38
+
39
+ The 1.0 release of the google-cloud-monitoring client is a significant upgrade
40
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
41
+ and includes substantial interface changes. Existing code written for earlier
42
+ versions of this library will likely require updates to use this version.
43
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
59
44
 
60
45
  ## Enabling Logging
61
46
 
62
47
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
63
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
48
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
64
49
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
65
- that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
50
+ 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)
66
51
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
67
52
 
68
53
  Configuring a Ruby stdlib logger:
@@ -85,11 +70,69 @@ end
85
70
 
86
71
  ## Supported Ruby Versions
87
72
 
88
- This library is supported on Ruby 2.4+.
73
+ This library is supported on Ruby 2.5+.
89
74
 
90
75
  Google provides official support for Ruby versions that are actively supported
91
76
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
92
- in security maintenance, and not end of life. Currently, this means Ruby 2.4
77
+ in security maintenance, and not end of life. Currently, this means Ruby 2.5
93
78
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
94
79
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
95
80
  about the Ruby support schedule.
81
+
82
+ ## Which client should I use?
83
+
84
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
85
+ client library with a name such as `google-cloud-monitoring`,
86
+ and lower-level _versioned_ client libraries with names such as
87
+ `google-cloud-monitoring-v3`.
88
+ _In most cases, you should install the main client._
89
+
90
+ ### What's the difference between the main client and a versioned client?
91
+
92
+ A _versioned client_ provides a basic set of data types and client classes for
93
+ a _single version_ of a specific service. (That is, for a service with multiple
94
+ versions, there might be a separate versioned client for each service version.)
95
+ Most versioned clients are written and maintained by a code generator.
96
+
97
+ The _main client_ is designed to provide you with the _recommended_ client
98
+ interfaces for the service. There will be only one main client for any given
99
+ service, even a service with multiple versions. The main client includes
100
+ factory methods for constructing the client objects we recommend for most
101
+ users. In some cases, those will be classes provided by an underlying versioned
102
+ client; in other cases, they will be handwritten higher-level client objects
103
+ with additional capabilities, convenience methods, or best practices built in.
104
+ Generally, the main client will default to a recommended service version,
105
+ although in some cases you can override this if you need to talk to a specific
106
+ service version.
107
+
108
+ ### Why would I want to use the main client?
109
+
110
+ We recommend that most users install the main client gem for a service. You can
111
+ identify this gem as the one _without_ a version in its name, e.g.
112
+ `google-cloud-monitoring`.
113
+ The main client is recommended because it will embody the best practices for
114
+ accessing the service, and may also provide more convenient interfaces or
115
+ tighter integration into frameworks and third-party libraries. In addition, the
116
+ documentation and samples published by Google will generally demonstrate use of
117
+ the main client.
118
+
119
+ ### Why would I want to use a versioned client?
120
+
121
+ You can use a versioned client if you are content with a possibly lower-level
122
+ class interface, you explicitly want to avoid features provided by the main
123
+ client, or you want to access a specific service version not be covered by the
124
+ main client. You can identify versioned client gems because the service version
125
+ is part of the name, e.g. `google-cloud-monitoring-v3`.
126
+
127
+ ### What about the google-apis-<name> clients?
128
+
129
+ Client library gems with names that begin with `google-apis-` are based on an
130
+ older code generation technology. They talk to a REST/JSON backend (whereas
131
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
132
+ not offer the same performance, features, and ease of use provided by more
133
+ modern clients.
134
+
135
+ The `google-apis-` clients have wide coverage across Google services, so you
136
+ might need to use one if there is no modern client available for the service.
137
+ However, if a modern client is available, we generally recommend it over the
138
+ older `google-apis-` clients.
@@ -1,4 +1,6 @@
1
- # Copyright 2016 Google LLC
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
4
6
  # you may not use this file except in compliance with the License.
@@ -12,8 +14,7 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
15
18
 
16
- ##
17
- # This file is here to be autorequired by bundler.
18
-
19
- # There is no Google::Cloud integration to add.
19
+ require "google/cloud/monitoring" unless defined? Google::Cloud::Monitoring::VERSION
20
+ require "google/cloud/monitoring/dashboard" unless defined? Google::Cloud::Monitoring::Dashboard::VERSION
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,473 +14,315 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # Require this file early so that the version constant gets defined before
20
+ # requiring "google/cloud". This is because google-cloud-core will load the
21
+ # entrypoint (gem name) file, which in turn re-requires this file (hence
22
+ # causing a require cycle) unless the version constant is already defined.
23
+ require "google/cloud/monitoring/version"
15
24
 
16
- require "google/gax"
17
- require "pathname"
25
+ require "googleauth"
26
+ gem "google-cloud-core"
27
+ require "google/cloud" unless defined? ::Google::Cloud.new
28
+ require "google/cloud/config"
29
+
30
+ # Set the default configuration
31
+ ::Google::Cloud.configure.add_config! :monitoring do |config|
32
+ config.add_field! :endpoint, "monitoring.googleapis.com", match: ::String
33
+ config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
34
+ config.add_field! :scope, nil, match: [::Array, ::String]
35
+ config.add_field! :lib_name, nil, match: ::String
36
+ config.add_field! :lib_version, nil, match: ::String
37
+ config.add_field! :interceptors, nil, match: ::Array
38
+ config.add_field! :timeout, nil, match: ::Numeric
39
+ config.add_field! :metadata, nil, match: ::Hash
40
+ config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
41
+ config.add_field! :quota_project, nil, match: ::String
42
+ end
18
43
 
19
44
  module Google
20
45
  module Cloud
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Cloud Monitoring API
25
- #
26
- # [Cloud Monitoring API][Product Documentation]:
27
- # Manages your Cloud Monitoring data and configurations. Most projects must
28
- # be associated with a Workspace, with a few exceptions as noted on the
29
- # individual method pages. The table entries below are presented in
30
- # alphabetical order, not in order of common use. For explanations of the
31
- # concepts found in the table entries, read the [Cloud Monitoring
32
- # documentation](https://cloud.google.com/monitoring/docs).
33
- # - [Product Documentation][]
34
- #
35
- # ## Quick Start
36
- # In order to use this library, you first need to go through the following
37
- # steps:
38
- #
39
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
40
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
41
- # 3. [Enable the Cloud Monitoring API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
42
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-monitoring/latest/file.AUTHENTICATION.html)
43
- #
44
- # ### Installation
45
- # ```
46
- # $ gem install google-cloud-monitoring
47
- # ```
48
- #
49
- # ### Preview
50
- # #### MetricServiceClient
51
- # ```rb
52
- # require "google/cloud/monitoring"
53
- #
54
- # metric_client = Google::Cloud::Monitoring::Metric.new
55
- # formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(project_id)
56
- #
57
- # # Iterate over all results.
58
- # metric_client.list_monitored_resource_descriptors(formatted_name).each do |element|
59
- # # Process element.
60
- # end
61
- #
62
- # # Or iterate over results one page at a time.
63
- # metric_client.list_monitored_resource_descriptors(formatted_name).each_page do |page|
64
- # # Process each page at a time.
65
- # page.each do |element|
66
- # # Process element.
67
- # end
68
- # end
69
- # ```
70
- #
71
- # ### Next Steps
72
- # - Read the [Cloud Monitoring API Product documentation][Product Documentation]
73
- # to learn more about the product and see How-to Guides.
74
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
75
- # to see the full list of Cloud APIs that we cover.
76
- #
77
- # [Product Documentation]: https://cloud.google.com/monitoring
78
- #
79
- # ## Enabling Logging
80
- #
81
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
82
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
83
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
84
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
85
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
86
- #
87
- # Configuring a Ruby stdlib logger:
88
- #
89
- # ```ruby
90
- # require "logger"
91
- #
92
- # module MyLogger
93
- # LOGGER = Logger.new $stderr, level: Logger::WARN
94
- # def logger
95
- # LOGGER
96
- # end
97
- # end
98
- #
99
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
100
- # module GRPC
101
- # extend MyLogger
102
- # end
103
- # ```
104
- #
105
46
  module Monitoring
106
- # rubocop:enable LineLength
47
+ ##
48
+ # Create a new client object for AlertPolicyService.
49
+ #
50
+ # By default, this returns an instance of
51
+ # [Google::Cloud::Monitoring::V3::AlertPolicyService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/AlertPolicyService/Client.html)
52
+ # for version V3 of the API.
53
+ # However, you can specify specify a different API version by passing it in the
54
+ # `version` parameter. If the AlertPolicyService service is
55
+ # supported by that API version, and the corresponding gem is available, the
56
+ # appropriate versioned client will be returned.
57
+ #
58
+ # ## About AlertPolicyService
59
+ #
60
+ # The AlertPolicyService API is used to manage (list, create, delete,
61
+ # edit) alert policies in Stackdriver Monitoring. An alerting policy is
62
+ # a description of the conditions under which some aspect of your
63
+ # system is considered to be "unhealthy" and the ways to notify
64
+ # people or services about this state. In addition to using this API, alert
65
+ # policies can also be managed through
66
+ # [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/),
67
+ # which can be reached by clicking the "Monitoring" tab in
68
+ # [Cloud Console](https://console.cloud.google.com/).
69
+ #
70
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
71
+ # Defaults to `:v3`.
72
+ # @return [AlertPolicyService::Client] A client object for the specified version.
73
+ #
74
+ def self.alert_policy_service version: :v3, &block
75
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
107
76
 
108
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("monitoring"))
77
+ package_name = Google::Cloud::Monitoring
78
+ .constants
79
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
80
+ .first
81
+ package_module = Google::Cloud::Monitoring.const_get package_name
82
+ package_module.const_get(:AlertPolicyService).const_get(:Client).new(&block)
83
+ end
84
+
85
+ ##
86
+ # Create a new client object for GroupService.
87
+ #
88
+ # By default, this returns an instance of
89
+ # [Google::Cloud::Monitoring::V3::GroupService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/GroupService/Client.html)
90
+ # for version V3 of the API.
91
+ # However, you can specify specify a different API version by passing it in the
92
+ # `version` parameter. If the GroupService service is
93
+ # supported by that API version, and the corresponding gem is available, the
94
+ # appropriate versioned client will be returned.
95
+ #
96
+ # ## About GroupService
97
+ #
98
+ # The Group API lets you inspect and manage your
99
+ # [groups](#google.monitoring.v3.Group).
100
+ #
101
+ # A group is a named filter that is used to identify
102
+ # a collection of monitored resources. Groups are typically used to
103
+ # mirror the physical and/or logical topology of the environment.
104
+ # Because group membership is computed dynamically, monitored
105
+ # resources that are started in the future are automatically placed
106
+ # in matching groups. By using a group to name monitored resources in,
107
+ # for example, an alert policy, the target of that alert policy is
108
+ # updated automatically as monitored resources are added and removed
109
+ # from the infrastructure.
110
+ #
111
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
112
+ # Defaults to `:v3`.
113
+ # @return [GroupService::Client] A client object for the specified version.
114
+ #
115
+ def self.group_service version: :v3, &block
116
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
109
117
 
110
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
111
- .select { |file| File.directory?(file) }
112
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
113
- .select { |dir| File.exist?(dir + ".rb") }
114
- .map { |dir| File.basename(dir) }
118
+ package_name = Google::Cloud::Monitoring
119
+ .constants
120
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
121
+ .first
122
+ package_module = Google::Cloud::Monitoring.const_get package_name
123
+ package_module.const_get(:GroupService).const_get(:Client).new(&block)
124
+ end
115
125
 
116
- module AlertPolicy
117
- ##
118
- # The AlertPolicyService API is used to manage (list, create, delete,
119
- # edit) alert policies in Stackdriver Monitoring. An alerting policy is
120
- # a description of the conditions under which some aspect of your
121
- # system is considered to be "unhealthy" and the ways to notify
122
- # people or services about this state. In addition to using this API, alert
123
- # policies can also be managed through
124
- # [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/),
125
- # which can be reached by clicking the "Monitoring" tab in
126
- # [Cloud Console](https://console.cloud.google.com/).
127
- #
128
- # @param version [Symbol, String]
129
- # The major version of the service to be used. By default :v3
130
- # is used.
131
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
132
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
133
- # Provides the means for authenticating requests made by the client. This parameter can
134
- # be many types.
135
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
136
- # authenticating requests made by this client.
137
- # A `String` will be treated as the path to the keyfile to be used for the construction of
138
- # credentials for this client.
139
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
140
- # credentials for this client.
141
- # A `GRPC::Core::Channel` will be used to make calls through.
142
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
143
- # should already be composed with a `GRPC::Core::CallCredentials` object.
144
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
145
- # metadata for requests, generally, to give OAuth credentials.
146
- # @param scopes [Array<String>]
147
- # The OAuth scopes for this service. This parameter is ignored if
148
- # an updater_proc is supplied.
149
- # @param client_config [Hash]
150
- # A Hash for call options for each method. See
151
- # Google::Gax#construct_settings for the structure of
152
- # this data. Falls back to the default config if not specified
153
- # or the specified config is missing data points.
154
- # @param timeout [Numeric]
155
- # The default timeout, in seconds, for calls made through this client.
156
- # @param metadata [Hash]
157
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
158
- # @param service_address [String]
159
- # Override for the service hostname, or `nil` to leave as the default.
160
- # @param service_port [Integer]
161
- # Override for the service port, or `nil` to leave as the default.
162
- # @param exception_transformer [Proc]
163
- # An optional proc that intercepts any exceptions raised during an API call to inject
164
- # custom error handling.
165
- def self.new(*args, version: :v3, **kwargs)
166
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
167
- raise "The version: #{version} is not available. The available versions " \
168
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
169
- end
126
+ ##
127
+ # Create a new client object for MetricService.
128
+ #
129
+ # By default, this returns an instance of
130
+ # [Google::Cloud::Monitoring::V3::MetricService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/MetricService/Client.html)
131
+ # for version V3 of the API.
132
+ # However, you can specify specify a different API version by passing it in the
133
+ # `version` parameter. If the MetricService service is
134
+ # supported by that API version, and the corresponding gem is available, the
135
+ # appropriate versioned client will be returned.
136
+ #
137
+ # ## About MetricService
138
+ #
139
+ # Manages metric descriptors, monitored resource descriptors, and
140
+ # time series data.
141
+ #
142
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
143
+ # Defaults to `:v3`.
144
+ # @return [MetricService::Client] A client object for the specified version.
145
+ #
146
+ def self.metric_service version: :v3, &block
147
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
170
148
 
171
- require "#{FILE_DIR}/#{version.to_s.downcase}"
172
- version_module = Google::Cloud::Monitoring
173
- .constants
174
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
175
- .first
176
- Google::Cloud::Monitoring.const_get(version_module)::AlertPolicy.new(*args, **kwargs)
177
- end
149
+ package_name = Google::Cloud::Monitoring
150
+ .constants
151
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
152
+ .first
153
+ package_module = Google::Cloud::Monitoring.const_get package_name
154
+ package_module.const_get(:MetricService).const_get(:Client).new(&block)
178
155
  end
179
156
 
180
- module Group
181
- ##
182
- # The Group API lets you inspect and manage your
183
- # [groups](https://cloud.google.com#google.monitoring.v3.Group).
184
- #
185
- # A group is a named filter that is used to identify
186
- # a collection of monitored resources. Groups are typically used to
187
- # mirror the physical and/or logical topology of the environment.
188
- # Because group membership is computed dynamically, monitored
189
- # resources that are started in the future are automatically placed
190
- # in matching groups. By using a group to name monitored resources in,
191
- # for example, an alert policy, the target of that alert policy is
192
- # updated automatically as monitored resources are added and removed
193
- # from the infrastructure.
194
- #
195
- # @param version [Symbol, String]
196
- # The major version of the service to be used. By default :v3
197
- # is used.
198
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
199
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
200
- # Provides the means for authenticating requests made by the client. This parameter can
201
- # be many types.
202
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
203
- # authenticating requests made by this client.
204
- # A `String` will be treated as the path to the keyfile to be used for the construction of
205
- # credentials for this client.
206
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
207
- # credentials for this client.
208
- # A `GRPC::Core::Channel` will be used to make calls through.
209
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
210
- # should already be composed with a `GRPC::Core::CallCredentials` object.
211
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
212
- # metadata for requests, generally, to give OAuth credentials.
213
- # @param scopes [Array<String>]
214
- # The OAuth scopes for this service. This parameter is ignored if
215
- # an updater_proc is supplied.
216
- # @param client_config [Hash]
217
- # A Hash for call options for each method. See
218
- # Google::Gax#construct_settings for the structure of
219
- # this data. Falls back to the default config if not specified
220
- # or the specified config is missing data points.
221
- # @param timeout [Numeric]
222
- # The default timeout, in seconds, for calls made through this client.
223
- # @param metadata [Hash]
224
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
225
- # @param service_address [String]
226
- # Override for the service hostname, or `nil` to leave as the default.
227
- # @param service_port [Integer]
228
- # Override for the service port, or `nil` to leave as the default.
229
- # @param exception_transformer [Proc]
230
- # An optional proc that intercepts any exceptions raised during an API call to inject
231
- # custom error handling.
232
- def self.new(*args, version: :v3, **kwargs)
233
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
234
- raise "The version: #{version} is not available. The available versions " \
235
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
236
- end
157
+ ##
158
+ # Create a new client object for NotificationChannelService.
159
+ #
160
+ # By default, this returns an instance of
161
+ # [Google::Cloud::Monitoring::V3::NotificationChannelService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/NotificationChannelService/Client.html)
162
+ # for version V3 of the API.
163
+ # However, you can specify specify a different API version by passing it in the
164
+ # `version` parameter. If the NotificationChannelService service is
165
+ # supported by that API version, and the corresponding gem is available, the
166
+ # appropriate versioned client will be returned.
167
+ #
168
+ # ## About NotificationChannelService
169
+ #
170
+ # The Notification Channel API provides access to configuration that
171
+ # controls how messages related to incidents are sent.
172
+ #
173
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
174
+ # Defaults to `:v3`.
175
+ # @return [NotificationChannelService::Client] A client object for the specified version.
176
+ #
177
+ def self.notification_channel_service version: :v3, &block
178
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
237
179
 
238
- require "#{FILE_DIR}/#{version.to_s.downcase}"
239
- version_module = Google::Cloud::Monitoring
240
- .constants
241
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
242
- .first
243
- Google::Cloud::Monitoring.const_get(version_module)::Group.new(*args, **kwargs)
244
- end
180
+ package_name = Google::Cloud::Monitoring
181
+ .constants
182
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
183
+ .first
184
+ package_module = Google::Cloud::Monitoring.const_get package_name
185
+ package_module.const_get(:NotificationChannelService).const_get(:Client).new(&block)
245
186
  end
246
187
 
247
- module Metric
248
- ##
249
- # Manages metric descriptors, monitored resource descriptors, and
250
- # time series data.
251
- #
252
- # @param version [Symbol, String]
253
- # The major version of the service to be used. By default :v3
254
- # is used.
255
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
256
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
257
- # Provides the means for authenticating requests made by the client. This parameter can
258
- # be many types.
259
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
260
- # authenticating requests made by this client.
261
- # A `String` will be treated as the path to the keyfile to be used for the construction of
262
- # credentials for this client.
263
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
264
- # credentials for this client.
265
- # A `GRPC::Core::Channel` will be used to make calls through.
266
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
267
- # should already be composed with a `GRPC::Core::CallCredentials` object.
268
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
269
- # metadata for requests, generally, to give OAuth credentials.
270
- # @param scopes [Array<String>]
271
- # The OAuth scopes for this service. This parameter is ignored if
272
- # an updater_proc is supplied.
273
- # @param client_config [Hash]
274
- # A Hash for call options for each method. See
275
- # Google::Gax#construct_settings for the structure of
276
- # this data. Falls back to the default config if not specified
277
- # or the specified config is missing data points.
278
- # @param timeout [Numeric]
279
- # The default timeout, in seconds, for calls made through this client.
280
- # @param metadata [Hash]
281
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
282
- # @param service_address [String]
283
- # Override for the service hostname, or `nil` to leave as the default.
284
- # @param service_port [Integer]
285
- # Override for the service port, or `nil` to leave as the default.
286
- # @param exception_transformer [Proc]
287
- # An optional proc that intercepts any exceptions raised during an API call to inject
288
- # custom error handling.
289
- def self.new(*args, version: :v3, **kwargs)
290
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
291
- raise "The version: #{version} is not available. The available versions " \
292
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
293
- end
188
+ ##
189
+ # Create a new client object for QueryService.
190
+ #
191
+ # By default, this returns an instance of
192
+ # [Google::Cloud::Monitoring::V3::QueryService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/QueryService/Client.html)
193
+ # for version V3 of the API.
194
+ # However, you can specify specify a different API version by passing it in the
195
+ # `version` parameter. If the QueryService service is
196
+ # supported by that API version, and the corresponding gem is available, the
197
+ # appropriate versioned client will be returned.
198
+ #
199
+ # ## About QueryService
200
+ #
201
+ # The QueryService API is used to manage time series data in Stackdriver
202
+ # Monitoring. Time series data is a collection of data points that describes
203
+ # the time-varying values of a metric.
204
+ #
205
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
206
+ # Defaults to `:v3`.
207
+ # @return [QueryService::Client] A client object for the specified version.
208
+ #
209
+ def self.query_service version: :v3, &block
210
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
294
211
 
295
- require "#{FILE_DIR}/#{version.to_s.downcase}"
296
- version_module = Google::Cloud::Monitoring
297
- .constants
298
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
299
- .first
300
- Google::Cloud::Monitoring.const_get(version_module)::Metric.new(*args, **kwargs)
301
- end
212
+ package_name = Google::Cloud::Monitoring
213
+ .constants
214
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
215
+ .first
216
+ package_module = Google::Cloud::Monitoring.const_get package_name
217
+ package_module.const_get(:QueryService).const_get(:Client).new(&block)
302
218
  end
303
219
 
304
- module NotificationChannel
305
- ##
306
- # The Notification Channel API provides access to configuration that
307
- # controls how messages related to incidents are sent.
308
- #
309
- # @param version [Symbol, String]
310
- # The major version of the service to be used. By default :v3
311
- # is used.
312
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
313
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
314
- # Provides the means for authenticating requests made by the client. This parameter can
315
- # be many types.
316
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
317
- # authenticating requests made by this client.
318
- # A `String` will be treated as the path to the keyfile to be used for the construction of
319
- # credentials for this client.
320
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
321
- # credentials for this client.
322
- # A `GRPC::Core::Channel` will be used to make calls through.
323
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
324
- # should already be composed with a `GRPC::Core::CallCredentials` object.
325
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
326
- # metadata for requests, generally, to give OAuth credentials.
327
- # @param scopes [Array<String>]
328
- # The OAuth scopes for this service. This parameter is ignored if
329
- # an updater_proc is supplied.
330
- # @param client_config [Hash]
331
- # A Hash for call options for each method. See
332
- # Google::Gax#construct_settings for the structure of
333
- # this data. Falls back to the default config if not specified
334
- # or the specified config is missing data points.
335
- # @param timeout [Numeric]
336
- # The default timeout, in seconds, for calls made through this client.
337
- # @param metadata [Hash]
338
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
339
- # @param service_address [String]
340
- # Override for the service hostname, or `nil` to leave as the default.
341
- # @param service_port [Integer]
342
- # Override for the service port, or `nil` to leave as the default.
343
- # @param exception_transformer [Proc]
344
- # An optional proc that intercepts any exceptions raised during an API call to inject
345
- # custom error handling.
346
- def self.new(*args, version: :v3, **kwargs)
347
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
348
- raise "The version: #{version} is not available. The available versions " \
349
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
350
- end
220
+ ##
221
+ # Create a new client object for ServiceMonitoringService.
222
+ #
223
+ # By default, this returns an instance of
224
+ # [Google::Cloud::Monitoring::V3::ServiceMonitoringService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/ServiceMonitoringService/Client.html)
225
+ # for version V3 of the API.
226
+ # However, you can specify specify a different API version by passing it in the
227
+ # `version` parameter. If the ServiceMonitoringService service is
228
+ # supported by that API version, and the corresponding gem is available, the
229
+ # appropriate versioned client will be returned.
230
+ #
231
+ # ## About ServiceMonitoringService
232
+ #
233
+ # The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
234
+ # managing and querying aspects of a workspace's services. These include the
235
+ # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
236
+ # of categorized Health Metrics.
237
+ #
238
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
239
+ # Defaults to `:v3`.
240
+ # @return [ServiceMonitoringService::Client] A client object for the specified version.
241
+ #
242
+ def self.service_monitoring_service version: :v3, &block
243
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
351
244
 
352
- require "#{FILE_DIR}/#{version.to_s.downcase}"
353
- version_module = Google::Cloud::Monitoring
354
- .constants
355
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
356
- .first
357
- Google::Cloud::Monitoring.const_get(version_module)::NotificationChannel.new(*args, **kwargs)
358
- end
245
+ package_name = Google::Cloud::Monitoring
246
+ .constants
247
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
248
+ .first
249
+ package_module = Google::Cloud::Monitoring.const_get package_name
250
+ package_module.const_get(:ServiceMonitoringService).const_get(:Client).new(&block)
359
251
  end
360
252
 
361
- module ServiceMonitoring
362
- ##
363
- # The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
364
- # managing and querying aspects of a workspace's services. These include the
365
- # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
366
- # of categorized Health Metrics.
367
- #
368
- # @param version [Symbol, String]
369
- # The major version of the service to be used. By default :v3
370
- # is used.
371
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
372
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
373
- # Provides the means for authenticating requests made by the client. This parameter can
374
- # be many types.
375
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
376
- # authenticating requests made by this client.
377
- # A `String` will be treated as the path to the keyfile to be used for the construction of
378
- # credentials for this client.
379
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
380
- # credentials for this client.
381
- # A `GRPC::Core::Channel` will be used to make calls through.
382
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
383
- # should already be composed with a `GRPC::Core::CallCredentials` object.
384
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
385
- # metadata for requests, generally, to give OAuth credentials.
386
- # @param scopes [Array<String>]
387
- # The OAuth scopes for this service. This parameter is ignored if
388
- # an updater_proc is supplied.
389
- # @param client_config [Hash]
390
- # A Hash for call options for each method. See
391
- # Google::Gax#construct_settings for the structure of
392
- # this data. Falls back to the default config if not specified
393
- # or the specified config is missing data points.
394
- # @param timeout [Numeric]
395
- # The default timeout, in seconds, for calls made through this client.
396
- # @param metadata [Hash]
397
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
398
- # @param service_address [String]
399
- # Override for the service hostname, or `nil` to leave as the default.
400
- # @param service_port [Integer]
401
- # Override for the service port, or `nil` to leave as the default.
402
- # @param exception_transformer [Proc]
403
- # An optional proc that intercepts any exceptions raised during an API call to inject
404
- # custom error handling.
405
- def self.new(*args, version: :v3, **kwargs)
406
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
407
- raise "The version: #{version} is not available. The available versions " \
408
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
409
- end
253
+ ##
254
+ # Create a new client object for UptimeCheckService.
255
+ #
256
+ # By default, this returns an instance of
257
+ # [Google::Cloud::Monitoring::V3::UptimeCheckService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/UptimeCheckService/Client.html)
258
+ # for version V3 of the API.
259
+ # However, you can specify specify a different API version by passing it in the
260
+ # `version` parameter. If the UptimeCheckService service is
261
+ # supported by that API version, and the corresponding gem is available, the
262
+ # appropriate versioned client will be returned.
263
+ #
264
+ # ## About UptimeCheckService
265
+ #
266
+ # The UptimeCheckService API is used to manage (list, create, delete, edit)
267
+ # Uptime check configurations in the Stackdriver Monitoring product. An Uptime
268
+ # check is a piece of configuration that determines which resources and
269
+ # services to monitor for availability. These configurations can also be
270
+ # configured interactively by navigating to the [Cloud Console]
271
+ # (http://console.cloud.google.com), selecting the appropriate project,
272
+ # clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
273
+ # and then clicking on "Uptime".
274
+ #
275
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
276
+ # Defaults to `:v3`.
277
+ # @return [UptimeCheckService::Client] A client object for the specified version.
278
+ #
279
+ def self.uptime_check_service version: :v3, &block
280
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
410
281
 
411
- require "#{FILE_DIR}/#{version.to_s.downcase}"
412
- version_module = Google::Cloud::Monitoring
413
- .constants
414
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
415
- .first
416
- Google::Cloud::Monitoring.const_get(version_module)::ServiceMonitoring.new(*args, **kwargs)
417
- end
282
+ package_name = Google::Cloud::Monitoring
283
+ .constants
284
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
285
+ .first
286
+ package_module = Google::Cloud::Monitoring.const_get package_name
287
+ package_module.const_get(:UptimeCheckService).const_get(:Client).new(&block)
418
288
  end
419
289
 
420
- module UptimeCheck
421
- ##
422
- # The UptimeCheckService API is used to manage (list, create, delete, edit)
423
- # Uptime check configurations in the Stackdriver Monitoring product. An Uptime
424
- # check is a piece of configuration that determines which resources and
425
- # services to monitor for availability. These configurations can also be
426
- # configured interactively by navigating to the [Cloud Console]
427
- # (http://console.cloud.google.com), selecting the appropriate project,
428
- # clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
429
- # and then clicking on "Uptime".
430
- #
431
- # @param version [Symbol, String]
432
- # The major version of the service to be used. By default :v3
433
- # is used.
434
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
435
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
436
- # Provides the means for authenticating requests made by the client. This parameter can
437
- # be many types.
438
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
439
- # authenticating requests made by this client.
440
- # A `String` will be treated as the path to the keyfile to be used for the construction of
441
- # credentials for this client.
442
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
443
- # credentials for this client.
444
- # A `GRPC::Core::Channel` will be used to make calls through.
445
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
446
- # should already be composed with a `GRPC::Core::CallCredentials` object.
447
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
448
- # metadata for requests, generally, to give OAuth credentials.
449
- # @param scopes [Array<String>]
450
- # The OAuth scopes for this service. This parameter is ignored if
451
- # an updater_proc is supplied.
452
- # @param client_config [Hash]
453
- # A Hash for call options for each method. See
454
- # Google::Gax#construct_settings for the structure of
455
- # this data. Falls back to the default config if not specified
456
- # or the specified config is missing data points.
457
- # @param timeout [Numeric]
458
- # The default timeout, in seconds, for calls made through this client.
459
- # @param metadata [Hash]
460
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
461
- # @param service_address [String]
462
- # Override for the service hostname, or `nil` to leave as the default.
463
- # @param service_port [Integer]
464
- # Override for the service port, or `nil` to leave as the default.
465
- # @param exception_transformer [Proc]
466
- # An optional proc that intercepts any exceptions raised during an API call to inject
467
- # custom error handling.
468
- def self.new(*args, version: :v3, **kwargs)
469
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
470
- raise "The version: #{version} is not available. The available versions " \
471
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
472
- end
290
+ ##
291
+ # Configure the google-cloud-monitoring library.
292
+ #
293
+ # The following configuration parameters are supported:
294
+ #
295
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
296
+ # The path to the keyfile as a String, the contents of the keyfile as a
297
+ # Hash, or a Google::Auth::Credentials object.
298
+ # * `lib_name` (*type:* `String`) -
299
+ # The library name as recorded in instrumentation and logging.
300
+ # * `lib_version` (*type:* `String`) -
301
+ # The library version as recorded in instrumentation and logging.
302
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
303
+ # An array of interceptors that are run before calls are executed.
304
+ # * `timeout` (*type:* `Numeric`) -
305
+ # Default timeout in seconds.
306
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
307
+ # Additional gRPC headers to be sent with the call.
308
+ # * `retry_policy` (*type:* `Hash`) -
309
+ # The retry policy. The value is a hash with the following keys:
310
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
311
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
312
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
313
+ # * `:retry_codes` (*type:* `Array<String>`) -
314
+ # The error codes that should trigger a retry.
315
+ #
316
+ # @return [::Google::Cloud::Config] The default configuration used by this library
317
+ #
318
+ def self.configure
319
+ yield ::Google::Cloud.configure.monitoring if block_given?
473
320
 
474
- require "#{FILE_DIR}/#{version.to_s.downcase}"
475
- version_module = Google::Cloud::Monitoring
476
- .constants
477
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
478
- .first
479
- Google::Cloud::Monitoring.const_get(version_module)::UptimeCheck.new(*args, **kwargs)
480
- end
321
+ ::Google::Cloud.configure.monitoring
481
322
  end
482
323
  end
483
324
  end
484
325
  end
326
+
327
+ helper_path = ::File.join __dir__, "monitoring", "helpers.rb"
328
+ require "google/cloud/monitoring/helpers" if ::File.file? helper_path