Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/sentry_protos/billing/v1/date.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ message Date {
uint32 year = 1;
uint32 month = 2;
uint32 day = 3;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.sgm.v1;

import "google/protobuf/timestamp.proto";
import "sentry_protos/billing/v1/data_category.proto";

enum EnforcementType {
ENFORCEMENT_TYPE_UNSPECIFIED = 0;
ENFORCEMENT_TYPE_RATE_LIMIT = 1;
ENFORCEMENT_TYPE_SAMPLE = 2;
}

message EnforcementDecision {
uint64 contract_id = 1;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add project id

uint64 organization_id = 2;
EnforcementType enforcement_type = 3;
string explanation = 4;
// Even though we bill for SKUs, relay ingests data categories, so enforcement
// decisions are on a per-datacategory basis
DataCategory data_category = 5;
google.protobuf.Timestamp decision_time = 6;
google.protobuf.Timestamp expiration_time = 7;
}
19 changes: 19 additions & 0 deletions proto/sentry_protos/billing/v1/services/sgm/v1/priced_usage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.sgm.v1;

import "sentry_protos/billing/v1/services/contract/v1/sku.proto";

message PricedSKUUsage {
sentry_protos.billing.v1.services.contract.v1.SKU sku = 1;
uint64 current_used_cents = 2;
}

message PricedUsage {
// the contract contains all the information about the
// organization's budget(s)
uint64 contract_id = 1;
// The amount of money used up for a specific SKU in the current
// billing period. Credits have already been applied to this calculation
repeated PricedSKUUsage priced_sku_usage = 2;
}
6 changes: 6 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ pub mod sentry {
}
}

pub mod sgm {
pub mod v1 {
include!("sentry_protos.billing.v1.services.sgm.v1.rs");
}
}

pub mod snuba {
pub mod v1 {
include!("sentry_protos.snuba.v1.rs");
Expand Down
67 changes: 67 additions & 0 deletions rust/src/sentry_protos.billing.v1.services.sgm.v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EnforcementDecision {
#[prost(uint64, tag = "1")]
pub contract_id: u64,
#[prost(uint64, tag = "2")]
pub organization_id: u64,
#[prost(enumeration = "EnforcementType", tag = "3")]
pub enforcement_type: i32,
#[prost(string, tag = "4")]
pub explanation: ::prost::alloc::string::String,
/// Even though we bill for SKUs, relay ingests data categories, so enforcement
/// decisions are on a per-datacategory basis
#[prost(enumeration = "super::super::super::DataCategory", tag = "5")]
pub data_category: i32,
#[prost(message, optional, tag = "6")]
pub decision_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "7")]
pub expiration_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EnforcementType {
Unspecified = 0,
RateLimit = 1,
Sample = 2,
}
impl EnforcementType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "ENFORCEMENT_TYPE_UNSPECIFIED",
Self::RateLimit => "ENFORCEMENT_TYPE_RATE_LIMIT",
Self::Sample => "ENFORCEMENT_TYPE_SAMPLE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ENFORCEMENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"ENFORCEMENT_TYPE_RATE_LIMIT" => Some(Self::RateLimit),
"ENFORCEMENT_TYPE_SAMPLE" => Some(Self::Sample),
_ => None,
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PricedSkuUsage {
#[prost(enumeration = "super::super::contract::v1::Sku", tag = "1")]
pub sku: i32,
#[prost(uint64, tag = "2")]
pub current_used_cents: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PricedUsage {
/// the contract contains all the information about the
/// organization's budget(s)
#[prost(uint64, tag = "1")]
pub contract_id: u64,
/// The amount of money used up for a specific SKU in the current
/// billing period. Credits have already been applied to this calculation
#[prost(message, repeated, tag = "2")]
pub priced_sku_usage: ::prost::alloc::vec::Vec<PricedSkuUsage>,
}
Loading