File: create_timeseries.rb

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Fog
  module Google
    class Monitoring
      class Real
        ##
        # Create a timeseries. User-created time series should only be used with custom metrics.
        #
        # @param timeseries [Array<Hash>] Timeseries to create/update.
        #   @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/TimeSeries for expected format.
        # @see https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/create
        #
        def create_timeseries(timeseries: [])
          request = ::Google::Apis::MonitoringV3::CreateTimeSeriesRequest.new(
            time_series: timeseries
          )
          @monitoring.create_project_time_series("projects/#{@project}", request)
        end
      end

      class Mock
        def create_timeseries(_timeseries: [])
          # :no-coverage:
          Fog::Mock.not_implemented
          # :no-coverage:
        end
      end
    end
  end
end