Class: InfluxDB2::DeleteApi

Inherits:
DefaultApi show all
Defined in:
lib/influxdb2/client/delete_api.rb

Overview

Delete time series data from InfluxDB

Constant Summary

Constants inherited from DefaultApi

InfluxDB2::DefaultApi::DEFAULT_REDIRECT_COUNT, InfluxDB2::DefaultApi::DEFAULT_TIMEOUT, InfluxDB2::DefaultApi::HEADER_CONTENT_TYPE

Instance Method Summary collapse

Methods inherited from DefaultApi

create_logger, #log

Constructor Details

#initialize(options:) ⇒ DeleteApi

Returns a new instance of DeleteApi.

Parameters:

  • options (Hash)

    The options to be used by the client.



28
29
30
# File 'lib/influxdb2/client/delete_api.rb', line 28

def initialize(options:)
  super(options: options)
end

Instance Method Details

#delete(start, stop, predicate: nil, bucket: nil, org: nil) ⇒ Object

Delete time series data from InfluxDB.

delete(‘2019-02-03T04:05:06+07:00’, ‘2019-04-03T04:05:06+07:00’,

predicate: 'key1="value1" AND key2="value"', bucket: 'my-bucket', org: 'my-org')

delete(DateTime.rfc3339(‘2019-02-03T04:05:06+07:00’), DateTime.rfc3339(‘2019-03-03T04:05:06+07:00’),

predicate: 'key1="value1" AND key2="value"', bucket: 'my-bucket', org: 'my-org')

Parameters:

  • start (Object)

    Start time of interval to delete data. The start could be represent by [Time], [DateTime] or [String] formatted as RFC3339.

  • stop (Object)

    Stop time of interval to delete data The stop could be represent by [Time], [DateTime] or [String] formatted as RFC3339.

  • predicate (String) (defaults to: nil)

    InfluxQL-like predicate Stop time of interval to delete data

  • bucket (String) (defaults to: nil)

    specifies the bucket to remove data from

  • org (String) (defaults to: nil)

    specifies the organization to remove data from



49
50
51
52
53
54
# File 'lib/influxdb2/client/delete_api.rb', line 49

def delete(start, stop, predicate: nil, bucket: nil, org: nil)
  delete_request = InfluxDB2::DeletePredicateRequest.new(start: _to_rfc3339(start), stop: _to_rfc3339(stop),
                                                         predicate: predicate)

  _delete(delete_request, bucket: bucket, org: org)
end