lib/google/cloud/monitoring.rb in google-cloud-monitoring-0.33.1 vs lib/google/cloud/monitoring.rb in google-cloud-monitoring-0.34.0

- old
+ new

@@ -24,11 +24,14 @@ # # Ruby Client for Stackdriver Monitoring API ([Beta](https://github.com/googleapis/google-cloud-ruby#versioning)) # # [Stackdriver Monitoring API][Product Documentation]: # Manages your Stackdriver Monitoring data and configurations. Most projects # must be associated with a Stackdriver account, with a few exceptions as - # noted on the individual method pages. + # noted on the individual method pages. The table entries below are + # presented in alphabetical order, not in order of common use. For + # explanations of the concepts found in the table entries, read the + # [Stackdriver Monitoring documentation](/monitoring/docs). # - [Product Documentation][] # # ## Quick Start # In order to use this library, you first need to go through the following # steps: @@ -350,9 +353,68 @@ version_module = Google::Cloud::Monitoring .constants .select {|sym| sym.to_s.downcase == version.to_s.downcase} .first Google::Cloud::Monitoring.const_get(version_module)::NotificationChannel.new(*args, **kwargs) + end + end + + module ServiceMonitoring + ## + # The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for + # managing and querying aspects of a workspace's services. These include the + # `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy + # of categorized Health Metrics. + # + # @param version [Symbol, String] + # The major version of the service to be used. By default :v3 + # is used. + # @overload new(version:, credentials:, scopes:, client_config:, timeout:) + # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc] + # Provides the means for authenticating requests made by the client. This parameter can + # be many types. + # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for + # authenticating requests made by this client. + # A `String` will be treated as the path to the keyfile to be used for the construction of + # credentials for this client. + # A `Hash` will be treated as the contents of a keyfile to be used for the construction of + # credentials for this client. + # A `GRPC::Core::Channel` will be used to make calls through. + # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials + # should already be composed with a `GRPC::Core::CallCredentials` object. + # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the + # metadata for requests, generally, to give OAuth credentials. + # @param scopes [Array<String>] + # The OAuth scopes for this service. This parameter is ignored if + # an updater_proc is supplied. + # @param client_config [Hash] + # A Hash for call options for each method. See + # Google::Gax#construct_settings for the structure of + # this data. Falls back to the default config if not specified + # or the specified config is missing data points. + # @param timeout [Numeric] + # The default timeout, in seconds, for calls made through this client. + # @param metadata [Hash] + # Default metadata to be sent with each request. This can be overridden on a per call basis. + # @param service_address [String] + # Override for the service hostname, or `nil` to leave as the default. + # @param service_port [Integer] + # Override for the service port, or `nil` to leave as the default. + # @param exception_transformer [Proc] + # An optional proc that intercepts any exceptions raised during an API call to inject + # custom error handling. + def self.new(*args, version: :v3, **kwargs) + unless AVAILABLE_VERSIONS.include?(version.to_s.downcase) + raise "The version: #{version} is not available. The available versions " \ + "are: [#{AVAILABLE_VERSIONS.join(", ")}]" + end + + require "#{FILE_DIR}/#{version.to_s.downcase}" + version_module = Google::Cloud::Monitoring + .constants + .select {|sym| sym.to_s.downcase == version.to_s.downcase} + .first + Google::Cloud::Monitoring.const_get(version_module)::ServiceMonitoring.new(*args, **kwargs) end end module UptimeCheck ##