Class: Stigg::Resources::V1::Events
- Inherits:
-
Object
- Object
- Stigg::Resources::V1::Events
- Defined in:
- lib/stigg/resources/v1/events.rb,
lib/stigg/resources/v1/events/beta.rb,
lib/stigg/resources/v1/events/data_export.rb,
lib/stigg/resources/v1/events/beta/customers.rb,
lib/stigg/resources/v1/events/data_export/destinations.rb,
sig/stigg/resources/v1/events.rbs,
sig/stigg/resources/v1/events/beta.rbs,
sig/stigg/resources/v1/events/data_export.rbs,
sig/stigg/resources/v1/events/beta/customers.rbs,
sig/stigg/resources/v1/events/data_export/destinations.rbs
Overview
Operations related to usage & metering
Defined Under Namespace
Classes: Beta, DataExport
Instance Attribute Summary collapse
- #beta ⇒ Stigg::Resources::V1::Events::Beta readonly
- #data_export ⇒ Stigg::Resources::V1::Events::DataExport readonly
Instance Method Summary collapse
-
#estimate_cost(customer_id:, event_name:, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::EventEstimateCostResponse
Some parameter documentations has been truncated, see Models::V1::EventEstimateCostParams for more details.
-
#initialize(client:) ⇒ Events
constructor
private
A new instance of Events.
-
#report(events:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::EventReportResponse
Some parameter documentations has been truncated, see Models::V1::EventReportParams for more details.
Constructor Details
#initialize(client:) ⇒ Events
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Events.
88 89 90 91 92 |
# File 'lib/stigg/resources/v1/events.rb', line 88 def initialize(client:) @client = client @data_export = Stigg::Resources::V1::Events::DataExport.new(client: client) @beta = Stigg::Resources::V1::Events::Beta.new(client: client) end |
Instance Attribute Details
#beta ⇒ Stigg::Resources::V1::Events::Beta (readonly)
12 13 14 |
# File 'lib/stigg/resources/v1/events.rb', line 12 def beta @beta end |
#data_export ⇒ Stigg::Resources::V1::Events::DataExport (readonly)
9 10 11 |
# File 'lib/stigg/resources/v1/events.rb', line 9 def data_export @data_export end |
Instance Method Details
#estimate_cost(customer_id:, event_name:, dimensions: nil, resource_id: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::EventEstimateCostResponse
Some parameter documentations has been truncated, see Models::V1::EventEstimateCostParams for more details.
Estimates the credit cost of a usage event without ingesting it. Returns the estimated cost per credit currency, the current balance, and the balance after the estimated consumption.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/stigg/resources/v1/events.rb', line 40 def estimate_cost(params) parsed, = Stigg::V1::EventEstimateCostParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/events/estimate", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::EventEstimateCostResponse, options: ) end |
#report(events:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::EventReportResponse
Some parameter documentations has been truncated, see Models::V1::EventReportParams for more details.
Reports raw usage events for event-based metering. Events are ingested asynchronously and aggregated into usage totals.
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/stigg/resources/v1/events.rb', line 72 def report(params) parsed, = Stigg::V1::EventReportParams.dump_request(params) header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"} @client.request( method: :post, path: "api/v1/events", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Stigg::Models::V1::EventReportResponse, options: ) end |