google-cloud-monitoring 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.yardopts +2 -2
- data/README.md +32 -28
- data/lib/google-cloud-monitoring.rb +1 -3
- data/lib/google/cloud/monitoring.rb +188 -0
- data/lib/google/cloud/monitoring/credentials.rb +33 -0
- data/lib/google/cloud/monitoring/v3.rb +187 -3
- data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +1 -1
- data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +11 -11
- data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +4 -4
- data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +21 -21
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +14 -1
- data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +26 -1
- data/lib/google/cloud/monitoring/v3/doc/overview.rb +77 -0
- data/lib/google/cloud/monitoring/v3/group_service_client.rb +97 -85
- data/lib/google/cloud/monitoring/v3/metric_service_client.rb +119 -122
- metadata +41 -10
| @@ -28,6 +28,7 @@ require "pathname" | |
| 28 28 | 
             
            require "google/gax"
         | 
| 29 29 |  | 
| 30 30 | 
             
            require "google/monitoring/v3/metric_service_pb"
         | 
| 31 | 
            +
            require "google/cloud/monitoring/credentials"
         | 
| 31 32 |  | 
| 32 33 | 
             
            module Google
         | 
| 33 34 | 
             
              module Cloud
         | 
| @@ -124,50 +125,24 @@ module Google | |
| 124 125 | 
             
                        )
         | 
| 125 126 | 
             
                      end
         | 
| 126 127 |  | 
| 127 | 
            -
                      #  | 
| 128 | 
            -
                      #  | 
| 129 | 
            -
                      #  | 
| 130 | 
            -
                       | 
| 131 | 
            -
             | 
| 132 | 
            -
                       | 
| 133 | 
            -
             | 
| 134 | 
            -
                      #  | 
| 135 | 
            -
                      #  | 
| 136 | 
            -
                      #  | 
| 137 | 
            -
                       | 
| 138 | 
            -
             | 
| 139 | 
            -
                       | 
| 140 | 
            -
             | 
| 141 | 
            -
                      #  | 
| 142 | 
            -
                      #  | 
| 143 | 
            -
                      #  | 
| 144 | 
            -
                       | 
| 145 | 
            -
                        METRIC_DESCRIPTOR_PATH_TEMPLATE.match(metric_descriptor_name)["metric_descriptor"]
         | 
| 146 | 
            -
                      end
         | 
| 147 | 
            -
             | 
| 148 | 
            -
                      # Parses the project from a monitored_resource_descriptor resource.
         | 
| 149 | 
            -
                      # @param monitored_resource_descriptor_name [String]
         | 
| 150 | 
            -
                      # @return [String]
         | 
| 151 | 
            -
                      def self.match_project_from_monitored_resource_descriptor_name monitored_resource_descriptor_name
         | 
| 152 | 
            -
                        MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE.match(monitored_resource_descriptor_name)["project"]
         | 
| 153 | 
            -
                      end
         | 
| 154 | 
            -
             | 
| 155 | 
            -
                      # Parses the monitored_resource_descriptor from a monitored_resource_descriptor resource.
         | 
| 156 | 
            -
                      # @param monitored_resource_descriptor_name [String]
         | 
| 157 | 
            -
                      # @return [String]
         | 
| 158 | 
            -
                      def self.match_monitored_resource_descriptor_from_monitored_resource_descriptor_name monitored_resource_descriptor_name
         | 
| 159 | 
            -
                        MONITORED_RESOURCE_DESCRIPTOR_PATH_TEMPLATE.match(monitored_resource_descriptor_name)["monitored_resource_descriptor"]
         | 
| 160 | 
            -
                      end
         | 
| 161 | 
            -
             | 
| 162 | 
            -
                      # @param service_path [String]
         | 
| 163 | 
            -
                      #   The domain name of the API remote host.
         | 
| 164 | 
            -
                      # @param port [Integer]
         | 
| 165 | 
            -
                      #   The port on which to connect to the remote host.
         | 
| 166 | 
            -
                      # @param channel [Channel]
         | 
| 167 | 
            -
                      #   A Channel object through which to make calls.
         | 
| 168 | 
            -
                      # @param chan_creds [Grpc::ChannelCredentials]
         | 
| 169 | 
            -
                      #   A ChannelCredentials for the setting up the RPC client.
         | 
| 170 | 
            -
                      # @param client_config[Hash]
         | 
| 128 | 
            +
                      # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
         | 
| 129 | 
            +
                      #   Provides the means for authenticating requests made by the client. This parameter can
         | 
| 130 | 
            +
                      #   be many types.
         | 
| 131 | 
            +
                      #   A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
         | 
| 132 | 
            +
                      #   authenticating requests made by this client.
         | 
| 133 | 
            +
                      #   A `String` will be treated as the path to the keyfile to be used for the construction of
         | 
| 134 | 
            +
                      #   credentials for this client.
         | 
| 135 | 
            +
                      #   A `Hash` will be treated as the contents of a keyfile to be used for the construction of
         | 
| 136 | 
            +
                      #   credentials for this client.
         | 
| 137 | 
            +
                      #   A `GRPC::Core::Channel` will be used to make calls through.
         | 
| 138 | 
            +
                      #   A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
         | 
| 139 | 
            +
                      #   should already be composed with a `GRPC::Core::CallCredentials` object.
         | 
| 140 | 
            +
                      #   A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
         | 
| 141 | 
            +
                      #   metadata for requests, generally, to give OAuth credentials.
         | 
| 142 | 
            +
                      # @param scopes [Array<String>]
         | 
| 143 | 
            +
                      #   The OAuth scopes for this service. This parameter is ignored if
         | 
| 144 | 
            +
                      #   an updater_proc is supplied.
         | 
| 145 | 
            +
                      # @param client_config [Hash]
         | 
| 171 146 | 
             
                      #   A Hash for call options for each method. See
         | 
| 172 147 | 
             
                      #   Google::Gax#construct_settings for the structure of
         | 
| 173 148 | 
             
                      #   this data. Falls back to the default config if not specified
         | 
| @@ -179,11 +154,11 @@ module Google | |
| 179 154 | 
             
                          port: DEFAULT_SERVICE_PORT,
         | 
| 180 155 | 
             
                          channel: nil,
         | 
| 181 156 | 
             
                          chan_creds: nil,
         | 
| 157 | 
            +
                          updater_proc: nil,
         | 
| 158 | 
            +
                          credentials: nil,
         | 
| 182 159 | 
             
                          scopes: ALL_SCOPES,
         | 
| 183 160 | 
             
                          client_config: {},
         | 
| 184 161 | 
             
                          timeout: DEFAULT_TIMEOUT,
         | 
| 185 | 
            -
                          app_name: nil,
         | 
| 186 | 
            -
                          app_version: nil,
         | 
| 187 162 | 
             
                          lib_name: nil,
         | 
| 188 163 | 
             
                          lib_version: ""
         | 
| 189 164 | 
             
                        # These require statements are intentionally placed here to initialize
         | 
| @@ -192,14 +167,38 @@ module Google | |
| 192 167 | 
             
                        require "google/gax/grpc"
         | 
| 193 168 | 
             
                        require "google/monitoring/v3/metric_service_services_pb"
         | 
| 194 169 |  | 
| 170 | 
            +
                        if channel || chan_creds || updater_proc
         | 
| 171 | 
            +
                          warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
         | 
| 172 | 
            +
                            "on 2017/09/08"
         | 
| 173 | 
            +
                          credentials ||= channel
         | 
| 174 | 
            +
                          credentials ||= chan_creds
         | 
| 175 | 
            +
                          credentials ||= updater_proc
         | 
| 176 | 
            +
                        end
         | 
| 177 | 
            +
                        if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
         | 
| 178 | 
            +
                          warn "`service_path` and `port` parameters are deprecated and will be removed"
         | 
| 179 | 
            +
                        end
         | 
| 195 180 |  | 
| 196 | 
            -
                         | 
| 197 | 
            -
             | 
| 181 | 
            +
                        credentials ||= Google::Cloud::Monitoring::Credentials.default
         | 
| 182 | 
            +
             | 
| 183 | 
            +
                        if credentials.is_a?(String) || credentials.is_a?(Hash)
         | 
| 184 | 
            +
                          updater_proc = Google::Cloud::Monitoring::Credentials.new(credentials).updater_proc
         | 
| 185 | 
            +
                        end
         | 
| 186 | 
            +
                        if credentials.is_a?(GRPC::Core::Channel)
         | 
| 187 | 
            +
                          channel = credentials
         | 
| 188 | 
            +
                        end
         | 
| 189 | 
            +
                        if credentials.is_a?(GRPC::Core::ChannelCredentials)
         | 
| 190 | 
            +
                          chan_creds = credentials
         | 
| 191 | 
            +
                        end
         | 
| 192 | 
            +
                        if credentials.is_a?(Proc)
         | 
| 193 | 
            +
                          updater_proc = credentials
         | 
| 194 | 
            +
                        end
         | 
| 195 | 
            +
                        if credentials.is_a?(Google::Auth::Credentials)
         | 
| 196 | 
            +
                          updater_proc = credentials.updater_proc
         | 
| 198 197 | 
             
                        end
         | 
| 199 198 |  | 
| 200 199 | 
             
                        google_api_client = "gl-ruby/#{RUBY_VERSION}"
         | 
| 201 200 | 
             
                        google_api_client << " #{lib_name}/#{lib_version}" if lib_name
         | 
| 202 | 
            -
                        google_api_client << " gapic/0. | 
| 201 | 
            +
                        google_api_client << " gapic/0.1.0 gax/#{Google::Gax::VERSION}"
         | 
| 203 202 | 
             
                        google_api_client << " grpc/#{GRPC::VERSION}"
         | 
| 204 203 | 
             
                        google_api_client.freeze
         | 
| 205 204 |  | 
| @@ -224,6 +223,7 @@ module Google | |
| 224 223 | 
             
                          port,
         | 
| 225 224 | 
             
                          chan_creds: chan_creds,
         | 
| 226 225 | 
             
                          channel: channel,
         | 
| 226 | 
            +
                          updater_proc: updater_proc,
         | 
| 227 227 | 
             
                          scopes: scopes,
         | 
| 228 228 | 
             
                          &Google::Monitoring::V3::MetricService::Stub.method(:new)
         | 
| 229 229 | 
             
                        )
         | 
| @@ -270,7 +270,7 @@ module Google | |
| 270 270 | 
             
                      #   The project on which to execute the request. The format is
         | 
| 271 271 | 
             
                      #   +"projects/{project_id_or_number}"+.
         | 
| 272 272 | 
             
                      # @param filter [String]
         | 
| 273 | 
            -
                      #   An optional  | 
| 273 | 
            +
                      #   An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) describing
         | 
| 274 274 | 
             
                      #   the descriptors to be returned.  The filter can reference
         | 
| 275 275 | 
             
                      #   the descriptor's type and labels. For example, the
         | 
| 276 276 | 
             
                      #   following filter returns only Google Compute Engine descriptors
         | 
| @@ -293,12 +293,10 @@ module Google | |
| 293 293 | 
             
                      #   object.
         | 
| 294 294 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 295 295 | 
             
                      # @example
         | 
| 296 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 297 | 
            -
                      #
         | 
| 298 | 
            -
                      #   MetricServiceClient = Google::Cloud::Monitoring::V3::MetricServiceClient
         | 
| 296 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 299 297 | 
             
                      #
         | 
| 300 | 
            -
                      #   metric_service_client =  | 
| 301 | 
            -
                      #   formatted_name = MetricServiceClient.project_path("[PROJECT]")
         | 
| 298 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 299 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
         | 
| 302 300 | 
             
                      #
         | 
| 303 301 | 
             
                      #   # Iterate over all results.
         | 
| 304 302 | 
             
                      #   metric_service_client.list_monitored_resource_descriptors(formatted_name).each do |element|
         | 
| @@ -318,11 +316,12 @@ module Google | |
| 318 316 | 
             
                          filter: nil,
         | 
| 319 317 | 
             
                          page_size: nil,
         | 
| 320 318 | 
             
                          options: nil
         | 
| 321 | 
            -
                        req =  | 
| 319 | 
            +
                        req = {
         | 
| 322 320 | 
             
                          name: name,
         | 
| 323 321 | 
             
                          filter: filter,
         | 
| 324 322 | 
             
                          page_size: page_size
         | 
| 325 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 323 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 324 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListMonitoredResourceDescriptorsRequest)
         | 
| 326 325 | 
             
                        @list_monitored_resource_descriptors.call(req, options)
         | 
| 327 326 | 
             
                      end
         | 
| 328 327 |  | 
| @@ -339,20 +338,19 @@ module Google | |
| 339 338 | 
             
                      # @return [Google::Api::MonitoredResourceDescriptor]
         | 
| 340 339 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 341 340 | 
             
                      # @example
         | 
| 342 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 341 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 343 342 | 
             
                      #
         | 
| 344 | 
            -
                      #    | 
| 345 | 
            -
                      #
         | 
| 346 | 
            -
                      #   metric_service_client = MetricServiceClient.new
         | 
| 347 | 
            -
                      #   formatted_name = MetricServiceClient.monitored_resource_descriptor_path("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]")
         | 
| 343 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 344 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.monitored_resource_descriptor_path("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]")
         | 
| 348 345 | 
             
                      #   response = metric_service_client.get_monitored_resource_descriptor(formatted_name)
         | 
| 349 346 |  | 
| 350 347 | 
             
                      def get_monitored_resource_descriptor \
         | 
| 351 348 | 
             
                          name,
         | 
| 352 349 | 
             
                          options: nil
         | 
| 353 | 
            -
                        req =  | 
| 350 | 
            +
                        req = {
         | 
| 354 351 | 
             
                          name: name
         | 
| 355 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 352 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 353 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetMonitoredResourceDescriptorRequest)
         | 
| 356 354 | 
             
                        @get_monitored_resource_descriptor.call(req, options)
         | 
| 357 355 | 
             
                      end
         | 
| 358 356 |  | 
| @@ -364,10 +362,10 @@ module Google | |
| 364 362 | 
             
                      # @param filter [String]
         | 
| 365 363 | 
             
                      #   If this field is empty, all custom and
         | 
| 366 364 | 
             
                      #   system-defined metric descriptors are returned.
         | 
| 367 | 
            -
                      #   Otherwise, the  | 
| 365 | 
            +
                      #   Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
         | 
| 368 366 | 
             
                      #   specifies which metric descriptors are to be
         | 
| 369 367 | 
             
                      #   returned. For example, the following filter matches all
         | 
| 370 | 
            -
                      #    | 
| 368 | 
            +
                      #   [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
         | 
| 371 369 | 
             
                      #
         | 
| 372 370 | 
             
                      #       metric.type = starts_with("custom.googleapis.com/")
         | 
| 373 371 | 
             
                      # @param page_size [Integer]
         | 
| @@ -386,12 +384,10 @@ module Google | |
| 386 384 | 
             
                      #   object.
         | 
| 387 385 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 388 386 | 
             
                      # @example
         | 
| 389 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 390 | 
            -
                      #
         | 
| 391 | 
            -
                      #   MetricServiceClient = Google::Cloud::Monitoring::V3::MetricServiceClient
         | 
| 387 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 392 388 | 
             
                      #
         | 
| 393 | 
            -
                      #   metric_service_client =  | 
| 394 | 
            -
                      #   formatted_name = MetricServiceClient.project_path("[PROJECT]")
         | 
| 389 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 390 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
         | 
| 395 391 | 
             
                      #
         | 
| 396 392 | 
             
                      #   # Iterate over all results.
         | 
| 397 393 | 
             
                      #   metric_service_client.list_metric_descriptors(formatted_name).each do |element|
         | 
| @@ -411,11 +407,12 @@ module Google | |
| 411 407 | 
             
                          filter: nil,
         | 
| 412 408 | 
             
                          page_size: nil,
         | 
| 413 409 | 
             
                          options: nil
         | 
| 414 | 
            -
                        req =  | 
| 410 | 
            +
                        req = {
         | 
| 415 411 | 
             
                          name: name,
         | 
| 416 412 | 
             
                          filter: filter,
         | 
| 417 413 | 
             
                          page_size: page_size
         | 
| 418 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 414 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 415 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListMetricDescriptorsRequest)
         | 
| 419 416 | 
             
                        @list_metric_descriptors.call(req, options)
         | 
| 420 417 | 
             
                      end
         | 
| 421 418 |  | 
| @@ -432,62 +429,61 @@ module Google | |
| 432 429 | 
             
                      # @return [Google::Api::MetricDescriptor]
         | 
| 433 430 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 434 431 | 
             
                      # @example
         | 
| 435 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 432 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 436 433 | 
             
                      #
         | 
| 437 | 
            -
                      #    | 
| 438 | 
            -
                      #
         | 
| 439 | 
            -
                      #   metric_service_client = MetricServiceClient.new
         | 
| 440 | 
            -
                      #   formatted_name = MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
         | 
| 434 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 435 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
         | 
| 441 436 | 
             
                      #   response = metric_service_client.get_metric_descriptor(formatted_name)
         | 
| 442 437 |  | 
| 443 438 | 
             
                      def get_metric_descriptor \
         | 
| 444 439 | 
             
                          name,
         | 
| 445 440 | 
             
                          options: nil
         | 
| 446 | 
            -
                        req =  | 
| 441 | 
            +
                        req = {
         | 
| 447 442 | 
             
                          name: name
         | 
| 448 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 443 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 444 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetMetricDescriptorRequest)
         | 
| 449 445 | 
             
                        @get_metric_descriptor.call(req, options)
         | 
| 450 446 | 
             
                      end
         | 
| 451 447 |  | 
| 452 448 | 
             
                      # Creates a new metric descriptor.
         | 
| 453 449 | 
             
                      # User-created metric descriptors define
         | 
| 454 | 
            -
                      #  | 
| 450 | 
            +
                      # [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
         | 
| 455 451 | 
             
                      #
         | 
| 456 452 | 
             
                      # @param name [String]
         | 
| 457 453 | 
             
                      #   The project on which to execute the request. The format is
         | 
| 458 454 | 
             
                      #   +"projects/{project_id_or_number}"+.
         | 
| 459 | 
            -
                      # @param metric_descriptor [Google::Api::MetricDescriptor]
         | 
| 460 | 
            -
                      #   The new  | 
| 455 | 
            +
                      # @param metric_descriptor [Google::Api::MetricDescriptor | Hash]
         | 
| 456 | 
            +
                      #   The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
         | 
| 461 457 | 
             
                      #   descriptor.
         | 
| 458 | 
            +
                      #   A hash of the same form as `Google::Api::MetricDescriptor`
         | 
| 459 | 
            +
                      #   can also be provided.
         | 
| 462 460 | 
             
                      # @param options [Google::Gax::CallOptions]
         | 
| 463 461 | 
             
                      #   Overrides the default settings for this call, e.g, timeout,
         | 
| 464 462 | 
             
                      #   retries, etc.
         | 
| 465 463 | 
             
                      # @return [Google::Api::MetricDescriptor]
         | 
| 466 464 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 467 465 | 
             
                      # @example
         | 
| 468 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 469 | 
            -
                      #
         | 
| 470 | 
            -
                      #   MetricDescriptor = Google::Api::MetricDescriptor
         | 
| 471 | 
            -
                      #   MetricServiceClient = Google::Cloud::Monitoring::V3::MetricServiceClient
         | 
| 466 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 472 467 | 
             
                      #
         | 
| 473 | 
            -
                      #   metric_service_client =  | 
| 474 | 
            -
                      #   formatted_name = MetricServiceClient.project_path("[PROJECT]")
         | 
| 475 | 
            -
                      #   metric_descriptor =  | 
| 468 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 469 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
         | 
| 470 | 
            +
                      #   metric_descriptor = {}
         | 
| 476 471 | 
             
                      #   response = metric_service_client.create_metric_descriptor(formatted_name, metric_descriptor)
         | 
| 477 472 |  | 
| 478 473 | 
             
                      def create_metric_descriptor \
         | 
| 479 474 | 
             
                          name,
         | 
| 480 475 | 
             
                          metric_descriptor,
         | 
| 481 476 | 
             
                          options: nil
         | 
| 482 | 
            -
                        req =  | 
| 477 | 
            +
                        req = {
         | 
| 483 478 | 
             
                          name: name,
         | 
| 484 479 | 
             
                          metric_descriptor: metric_descriptor
         | 
| 485 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 480 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 481 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateMetricDescriptorRequest)
         | 
| 486 482 | 
             
                        @create_metric_descriptor.call(req, options)
         | 
| 487 483 | 
             
                      end
         | 
| 488 484 |  | 
| 489 485 | 
             
                      # Deletes a metric descriptor. Only user-created
         | 
| 490 | 
            -
                      #  | 
| 486 | 
            +
                      # [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be deleted.
         | 
| 491 487 | 
             
                      #
         | 
| 492 488 | 
             
                      # @param name [String]
         | 
| 493 489 | 
             
                      #   The metric descriptor on which to execute the request. The format is
         | 
| @@ -499,20 +495,19 @@ module Google | |
| 499 495 | 
             
                      #   retries, etc.
         | 
| 500 496 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 501 497 | 
             
                      # @example
         | 
| 502 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 498 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 503 499 | 
             
                      #
         | 
| 504 | 
            -
                      #    | 
| 505 | 
            -
                      #
         | 
| 506 | 
            -
                      #   metric_service_client = MetricServiceClient.new
         | 
| 507 | 
            -
                      #   formatted_name = MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
         | 
| 500 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 501 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.metric_descriptor_path("[PROJECT]", "[METRIC_DESCRIPTOR]")
         | 
| 508 502 | 
             
                      #   metric_service_client.delete_metric_descriptor(formatted_name)
         | 
| 509 503 |  | 
| 510 504 | 
             
                      def delete_metric_descriptor \
         | 
| 511 505 | 
             
                          name,
         | 
| 512 506 | 
             
                          options: nil
         | 
| 513 | 
            -
                        req =  | 
| 507 | 
            +
                        req = {
         | 
| 514 508 | 
             
                          name: name
         | 
| 515 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 509 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 510 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteMetricDescriptorRequest)
         | 
| 516 511 | 
             
                        @delete_metric_descriptor.call(req, options)
         | 
| 517 512 | 
             
                        nil
         | 
| 518 513 | 
             
                      end
         | 
| @@ -523,23 +518,27 @@ module Google | |
| 523 518 | 
             
                      #   The project on which to execute the request. The format is
         | 
| 524 519 | 
             
                      #   "projects/{project_id_or_number}".
         | 
| 525 520 | 
             
                      # @param filter [String]
         | 
| 526 | 
            -
                      #   A  | 
| 521 | 
            +
                      #   A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time
         | 
| 527 522 | 
             
                      #   series should be returned.  The filter must specify a single metric type,
         | 
| 528 523 | 
             
                      #   and can additionally specify metric labels and other information. For
         | 
| 529 524 | 
             
                      #   example:
         | 
| 530 525 | 
             
                      #
         | 
| 531 526 | 
             
                      #       metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
         | 
| 532 527 | 
             
                      #           metric.label.instance_name = "my-instance-name"
         | 
| 533 | 
            -
                      # @param interval [Google::Monitoring::V3::TimeInterval]
         | 
| 528 | 
            +
                      # @param interval [Google::Monitoring::V3::TimeInterval | Hash]
         | 
| 534 529 | 
             
                      #   The time interval for which results should be returned. Only time series
         | 
| 535 530 | 
             
                      #   that contain data points in the specified interval are included
         | 
| 536 531 | 
             
                      #   in the response.
         | 
| 532 | 
            +
                      #   A hash of the same form as `Google::Monitoring::V3::TimeInterval`
         | 
| 533 | 
            +
                      #   can also be provided.
         | 
| 537 534 | 
             
                      # @param view [Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView]
         | 
| 538 535 | 
             
                      #   Specifies which information is returned about the time series.
         | 
| 539 | 
            -
                      # @param aggregation [Google::Monitoring::V3::Aggregation]
         | 
| 536 | 
            +
                      # @param aggregation [Google::Monitoring::V3::Aggregation | Hash]
         | 
| 540 537 | 
             
                      #   By default, the raw time series data is returned.
         | 
| 541 538 | 
             
                      #   Use this field to combine multiple time series for different
         | 
| 542 539 | 
             
                      #   views of the data.
         | 
| 540 | 
            +
                      #   A hash of the same form as `Google::Monitoring::V3::Aggregation`
         | 
| 541 | 
            +
                      #   can also be provided.
         | 
| 543 542 | 
             
                      # @param order_by [String]
         | 
| 544 543 | 
             
                      #   Specifies the order in which the points of the time series should
         | 
| 545 544 | 
             
                      #   be returned.  By default, results are not ordered.  Currently,
         | 
| @@ -560,17 +559,13 @@ module Google | |
| 560 559 | 
             
                      #   object.
         | 
| 561 560 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 562 561 | 
             
                      # @example
         | 
| 563 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 564 | 
            -
                      #
         | 
| 565 | 
            -
                      #   MetricServiceClient = Google::Cloud::Monitoring::V3::MetricServiceClient
         | 
| 566 | 
            -
                      #   TimeInterval = Google::Monitoring::V3::TimeInterval
         | 
| 567 | 
            -
                      #   TimeSeriesView = Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView
         | 
| 562 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 568 563 | 
             
                      #
         | 
| 569 | 
            -
                      #   metric_service_client =  | 
| 570 | 
            -
                      #   formatted_name = MetricServiceClient.project_path("[PROJECT]")
         | 
| 564 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 565 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
         | 
| 571 566 | 
             
                      #   filter = ''
         | 
| 572 | 
            -
                      #   interval =  | 
| 573 | 
            -
                      #   view =  | 
| 567 | 
            +
                      #   interval = {}
         | 
| 568 | 
            +
                      #   view = :FULL
         | 
| 574 569 | 
             
                      #
         | 
| 575 570 | 
             
                      #   # Iterate over all results.
         | 
| 576 571 | 
             
                      #   metric_service_client.list_time_series(formatted_name, filter, interval, view).each do |element|
         | 
| @@ -594,7 +589,7 @@ module Google | |
| 594 589 | 
             
                          order_by: nil,
         | 
| 595 590 | 
             
                          page_size: nil,
         | 
| 596 591 | 
             
                          options: nil
         | 
| 597 | 
            -
                        req =  | 
| 592 | 
            +
                        req = {
         | 
| 598 593 | 
             
                          name: name,
         | 
| 599 594 | 
             
                          filter: filter,
         | 
| 600 595 | 
             
                          interval: interval,
         | 
| @@ -602,7 +597,8 @@ module Google | |
| 602 597 | 
             
                          aggregation: aggregation,
         | 
| 603 598 | 
             
                          order_by: order_by,
         | 
| 604 599 | 
             
                          page_size: page_size
         | 
| 605 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 600 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 601 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListTimeSeriesRequest)
         | 
| 606 602 | 
             
                        @list_time_series.call(req, options)
         | 
| 607 603 | 
             
                      end
         | 
| 608 604 |  | 
| @@ -614,23 +610,23 @@ module Google | |
| 614 610 | 
             
                      # @param name [String]
         | 
| 615 611 | 
             
                      #   The project on which to execute the request. The format is
         | 
| 616 612 | 
             
                      #   +"projects/{project_id_or_number}"+.
         | 
| 617 | 
            -
                      # @param time_series [Array<Google::Monitoring::V3::TimeSeries>]
         | 
| 613 | 
            +
                      # @param time_series [Array<Google::Monitoring::V3::TimeSeries | Hash>]
         | 
| 618 614 | 
             
                      #   The new data to be added to a list of time series.
         | 
| 619 615 | 
             
                      #   Adds at most one data point to each of several time series.  The new data
         | 
| 620 616 | 
             
                      #   point must be more recent than any other point in its time series.  Each
         | 
| 621 617 | 
             
                      #   +TimeSeries+ value must fully specify a unique time series by supplying
         | 
| 622 618 | 
             
                      #   all label values for the metric and the monitored resource.
         | 
| 619 | 
            +
                      #   A hash of the same form as `Google::Monitoring::V3::TimeSeries`
         | 
| 620 | 
            +
                      #   can also be provided.
         | 
| 623 621 | 
             
                      # @param options [Google::Gax::CallOptions]
         | 
| 624 622 | 
             
                      #   Overrides the default settings for this call, e.g, timeout,
         | 
| 625 623 | 
             
                      #   retries, etc.
         | 
| 626 624 | 
             
                      # @raise [Google::Gax::GaxError] if the RPC is aborted.
         | 
| 627 625 | 
             
                      # @example
         | 
| 628 | 
            -
                      #   require "google/cloud/monitoring/v3 | 
| 629 | 
            -
                      #
         | 
| 630 | 
            -
                      #   MetricServiceClient = Google::Cloud::Monitoring::V3::MetricServiceClient
         | 
| 626 | 
            +
                      #   require "google/cloud/monitoring/v3"
         | 
| 631 627 | 
             
                      #
         | 
| 632 | 
            -
                      #   metric_service_client =  | 
| 633 | 
            -
                      #   formatted_name = MetricServiceClient.project_path("[PROJECT]")
         | 
| 628 | 
            +
                      #   metric_service_client = Google::Cloud::Monitoring::V3::Metric.new
         | 
| 629 | 
            +
                      #   formatted_name = Google::Cloud::Monitoring::V3::MetricServiceClient.project_path("[PROJECT]")
         | 
| 634 630 | 
             
                      #   time_series = []
         | 
| 635 631 | 
             
                      #   metric_service_client.create_time_series(formatted_name, time_series)
         | 
| 636 632 |  | 
| @@ -638,10 +634,11 @@ module Google | |
| 638 634 | 
             
                          name,
         | 
| 639 635 | 
             
                          time_series,
         | 
| 640 636 | 
             
                          options: nil
         | 
| 641 | 
            -
                        req =  | 
| 637 | 
            +
                        req = {
         | 
| 642 638 | 
             
                          name: name,
         | 
| 643 639 | 
             
                          time_series: time_series
         | 
| 644 | 
            -
                        }.delete_if { |_, v| v.nil? } | 
| 640 | 
            +
                        }.delete_if { |_, v| v.nil? }
         | 
| 641 | 
            +
                        req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateTimeSeriesRequest)
         | 
| 645 642 | 
             
                        @create_time_series.call(req, options)
         | 
| 646 643 | 
             
                        nil
         | 
| 647 644 | 
             
                      end
         |