google-cloud-monitoring 0.37.0 → 1.0.1

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 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +34 -50
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +255 -443
  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 +72 -129
  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 -345
  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 -461
  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 -326
  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 -109
  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,52 @@
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](/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 a convenience wrapper library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients.
26
12
 
27
- ### Preview
28
- #### MetricServiceClient
29
- ```rb
30
- require "google/cloud/monitoring"
13
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-monitoring/latest)
14
+ for this library, google-cloud-monitoring, to see the convenience methods for
15
+ constructing client objects. Reference documentation for the client objects
16
+ themselves can be found in the client library documentation for the versioned
17
+ client gems:
18
+ [google-cloud-monitoring-v3](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest).
31
19
 
32
- metric_client = Google::Cloud::Monitoring::Metric.new
33
- formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path(project_id)
20
+ See also the [Product Documentation](https://cloud.google.com/monitoring)
21
+ for more usage information.
34
22
 
35
- # Iterate over all results.
36
- metric_client.list_monitored_resource_descriptors(formatted_name).each do |element|
37
- # Process element.
38
- end
23
+ ## Quick Start
39
24
 
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
47
25
  ```
26
+ $ gem install google-cloud-monitoring
27
+ ```
28
+
29
+ In order to use this library, you first need to go through the following steps:
30
+
31
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
32
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
33
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/monitoring.googleapis.com)
34
+ 1. {file:AUTHENTICATION.md Set up authentication.}
48
35
 
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.
36
+ ## Migrating from 0.x versions
56
37
 
57
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-monitoring/latest
58
- [Product Documentation]: https://cloud.google.com/monitoring
38
+ The 1.0 release of the google-cloud-monitoring client is a significant upgrade
39
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
40
+ and includes substantial interface changes. Existing code written for earlier
41
+ versions of this library will likely require updates to use this version.
42
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
59
43
 
60
44
  ## Enabling Logging
61
45
 
62
46
  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,
47
+ 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
48
  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)
49
+ 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
50
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
67
51
 
68
52
  Configuring a Ruby stdlib logger:
@@ -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,283 @@
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](/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
107
-
108
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("monitoring"))
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}"
109
76
 
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) }
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
115
84
 
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
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}"
170
117
 
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
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)
178
124
  end
179
125
 
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
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}"
237
148
 
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
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)
245
155
  end
246
156
 
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
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}"
294
179
 
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
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)
302
186
  end
303
187
 
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
188
+ ##
189
+ # Create a new client object for ServiceMonitoringService.
190
+ #
191
+ # By default, this returns an instance of
192
+ # [Google::Cloud::Monitoring::V3::ServiceMonitoringService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/ServiceMonitoringService/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 ServiceMonitoringService 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 ServiceMonitoringService
200
+ #
201
+ # The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
202
+ # managing and querying aspects of a workspace's services. These include the
203
+ # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy
204
+ # of categorized Health Metrics.
205
+ #
206
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
207
+ # Defaults to `:v3`.
208
+ # @return [ServiceMonitoringService::Client] A client object for the specified version.
209
+ #
210
+ def self.service_monitoring_service version: :v3, &block
211
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
351
212
 
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
213
+ package_name = Google::Cloud::Monitoring
214
+ .constants
215
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
216
+ .first
217
+ package_module = Google::Cloud::Monitoring.const_get package_name
218
+ package_module.const_get(:ServiceMonitoringService).const_get(:Client).new(&block)
359
219
  end
360
220
 
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
221
+ ##
222
+ # Create a new client object for UptimeCheckService.
223
+ #
224
+ # By default, this returns an instance of
225
+ # [Google::Cloud::Monitoring::V3::UptimeCheckService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/UptimeCheckService/Client.html)
226
+ # for version V3 of the API.
227
+ # However, you can specify specify a different API version by passing it in the
228
+ # `version` parameter. If the UptimeCheckService service is
229
+ # supported by that API version, and the corresponding gem is available, the
230
+ # appropriate versioned client will be returned.
231
+ #
232
+ # ## About UptimeCheckService
233
+ #
234
+ # The UptimeCheckService API is used to manage (list, create, delete, edit)
235
+ # Uptime check configurations in the Stackdriver Monitoring product. An Uptime
236
+ # check is a piece of configuration that determines which resources and
237
+ # services to monitor for availability. These configurations can also be
238
+ # configured interactively by navigating to the [Cloud Console]
239
+ # (http://console.cloud.google.com), selecting the appropriate project,
240
+ # clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
241
+ # and then clicking on "Uptime".
242
+ #
243
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
244
+ # Defaults to `:v3`.
245
+ # @return [UptimeCheckService::Client] A client object for the specified version.
246
+ #
247
+ def self.uptime_check_service version: :v3, &block
248
+ require "google/cloud/monitoring/#{version.to_s.downcase}"
410
249
 
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
250
+ package_name = Google::Cloud::Monitoring
251
+ .constants
252
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
253
+ .first
254
+ package_module = Google::Cloud::Monitoring.const_get package_name
255
+ package_module.const_get(:UptimeCheckService).const_get(:Client).new(&block)
418
256
  end
419
257
 
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
258
+ ##
259
+ # Configure the google-cloud-monitoring library.
260
+ #
261
+ # The following configuration parameters are supported:
262
+ #
263
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
264
+ # The path to the keyfile as a String, the contents of the keyfile as a
265
+ # Hash, or a Google::Auth::Credentials object.
266
+ # * `lib_name` (*type:* `String`) -
267
+ # The library name as recorded in instrumentation and logging.
268
+ # * `lib_version` (*type:* `String`) -
269
+ # The library version as recorded in instrumentation and logging.
270
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
271
+ # An array of interceptors that are run before calls are executed.
272
+ # * `timeout` (*type:* `Numeric`) -
273
+ # Default timeout in seconds.
274
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
275
+ # Additional gRPC headers to be sent with the call.
276
+ # * `retry_policy` (*type:* `Hash`) -
277
+ # The retry policy. The value is a hash with the following keys:
278
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
279
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
280
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
281
+ # * `:retry_codes` (*type:* `Array<String>`) -
282
+ # The error codes that should trigger a retry.
283
+ #
284
+ # @return [::Google::Cloud::Config] The default configuration used by this library
285
+ #
286
+ def self.configure
287
+ yield ::Google::Cloud.configure.monitoring if block_given?
473
288
 
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
289
+ ::Google::Cloud.configure.monitoring
481
290
  end
482
291
  end
483
292
  end
484
293
  end
294
+
295
+ helper_path = ::File.join __dir__, "monitoring", "helpers.rb"
296
+ require "google/cloud/monitoring/helpers" if ::File.file? helper_path