lib/google/cloud/monitoring.rb in google-cloud-monitoring-1.4.1 vs lib/google/cloud/monitoring.rb in google-cloud-monitoring-1.5.0

- old
+ new

@@ -47,12 +47,12 @@ ## # Create a new client object for AlertPolicyService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::AlertPolicyService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/AlertPolicyService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the AlertPolicyService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About AlertPolicyService @@ -67,30 +67,30 @@ # which can be reached by clicking the "Monitoring" tab in # [Cloud console](https://console.cloud.google.com/). # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [AlertPolicyService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.alert_policy_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:AlertPolicyService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:AlertPolicyService) + service_module.const_get(:Client).new(&block) end ## # Create a new client object for GroupService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::GroupService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/GroupService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the GroupService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About GroupService @@ -108,30 +108,30 @@ # updated automatically as monitored resources are added and removed # from the infrastructure. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [GroupService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.group_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:GroupService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:GroupService) + service_module.const_get(:Client).new(&block) end ## # Create a new client object for MetricService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::MetricService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/MetricService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the MetricService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About MetricService @@ -139,30 +139,30 @@ # Manages metric descriptors, monitored resource descriptors, and # time series data. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [MetricService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.metric_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:MetricService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:MetricService) + service_module.const_get(:Client).new(&block) end ## # Create a new client object for NotificationChannelService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::NotificationChannelService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/NotificationChannelService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the NotificationChannelService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About NotificationChannelService @@ -170,30 +170,30 @@ # The Notification Channel API provides access to configuration that # controls how messages related to incidents are sent. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [NotificationChannelService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.notification_channel_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:NotificationChannelService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:NotificationChannelService) + service_module.const_get(:Client).new(&block) end ## # Create a new client object for QueryService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::QueryService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/QueryService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the QueryService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About QueryService @@ -202,30 +202,30 @@ # Monitoring. Time series data is a collection of data points that describes # the time-varying values of a metric. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [QueryService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.query_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:QueryService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:QueryService) + service_module.const_get(:Client).new(&block) end ## # Create a new client object for ServiceMonitoringService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::ServiceMonitoringService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/ServiceMonitoringService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the ServiceMonitoringService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About ServiceMonitoringService @@ -235,30 +235,62 @@ # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy # of categorized Health Metrics. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [ServiceMonitoringService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.service_monitoring_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:ServiceMonitoringService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:ServiceMonitoringService) + service_module.const_get(:Client).new(&block) end ## + # Create a new client object for SnoozeService. + # + # By default, this returns an instance of + # [Google::Cloud::Monitoring::V3::SnoozeService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/SnoozeService/Client.html) + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the + # `version` parameter. If the SnoozeService service is + # supported by that API version, and the corresponding gem is available, the + # appropriate versioned client will be returned. + # + # ## About SnoozeService + # + # The SnoozeService API is used to temporarily prevent an alert policy from + # generating alerts. A Snooze is a description of the criteria under which one + # or more alert policies should not fire alerts for the specified duration. + # + # @param version [::String, ::Symbol] The API version to connect to. Optional. + # Defaults to `:v3`. + # @return [::Object] A client object for the specified version. + # + def self.snooze_service version: :v3, &block + require "google/cloud/monitoring/#{version.to_s.downcase}" + + package_name = Google::Cloud::Monitoring + .constants + .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } + .first + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:SnoozeService) + service_module.const_get(:Client).new(&block) + end + + ## # Create a new client object for UptimeCheckService. # # By default, this returns an instance of # [Google::Cloud::Monitoring::V3::UptimeCheckService::Client](https://googleapis.dev/ruby/google-cloud-monitoring-v3/latest/Google/Cloud/Monitoring/V3/UptimeCheckService/Client.html) - # for version V3 of the API. - # However, you can specify specify a different API version by passing it in the + # for a gRPC client for version V3 of the API. + # However, you can specify a different API version by passing it in the # `version` parameter. If the UptimeCheckService service is # supported by that API version, and the corresponding gem is available, the # appropriate versioned client will be returned. # # ## About UptimeCheckService @@ -272,21 +304,21 @@ # clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, # and then clicking on "Uptime". # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v3`. - # @return [UptimeCheckService::Client] A client object for the specified version. + # @return [::Object] A client object for the specified version. # def self.uptime_check_service version: :v3, &block require "google/cloud/monitoring/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first - package_module = Google::Cloud::Monitoring.const_get package_name - package_module.const_get(:UptimeCheckService).const_get(:Client).new(&block) + service_module = Google::Cloud::Monitoring.const_get(package_name).const_get(:UptimeCheckService) + service_module.const_get(:Client).new(&block) end ## # Configure the google-cloud-monitoring library. # @@ -302,10 +334,10 @@ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) - # An array of interceptors that are run before calls are executed. # * `timeout` (*type:* `Numeric`) - # Default timeout in seconds. # * `metadata` (*type:* `Hash{Symbol=>String}`) - - # Additional gRPC headers to be sent with the call. + # Additional headers to be sent with the call. # * `retry_policy` (*type:* `Hash`) - # The retry policy. The value is a hash with the following keys: # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.