Skip to content
Merged
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.

15 changes: 15 additions & 0 deletions proto/sentry_protos/billing/v1/common/v1/seat_object.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package sentry_protos.billing.v1.common.v1;

import "sentry_protos/billing/v1/seat_category.proto";

// A seat object representing a billable product entity (monitor, uptime
// detector, seer contributor) within an organization.
message SeatObject {
uint64 organization_id = 1;
uint64 project_id = 2;
sentry_protos.billing.v1.SeatCategory seat_category = 3;
string external_product_display_name = 4;
string external_product_identifier = 5;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";
import "sentry_protos/billing/v1/services/seats/v1/seat_outcome.proto";

message AssignSeatRequest {
sentry_protos.billing.v1.common.v1.SeatObject seat_object = 1;
}

message AssignSeatResponse {
SeatOutcome outcome = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";
import "sentry_protos/billing/v1/services/seats/v1/seat_outcome.proto";

message CheckAssignSeatsRequest {
repeated sentry_protos.billing.v1.common.v1.SeatObject seat_objects = 1;

// When omitted the service resolves the organization's current contract.
optional uint64 contract_id = 2;
}

message CheckAssignSeatsResponse {
SeatOutcome outcome = 1;
string reason = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";

message DisableSeatRequest {
sentry_protos.billing.v1.common.v1.SeatObject seat_object = 1;

// When omitted the service resolves the organization's current contract.
optional uint64 contract_id = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/services/usage/v1/endpoint_usage.proto";

// Seat usage for a single project.
message ProjectSeatUsage {
uint64 project_id = 1;
repeated sentry_protos.billing.v1.services.usage.v1.DailySeatUsage seat_days = 2;
}

message GetDailySeatUsageByProjectResponse {
repeated ProjectSeatUsage projects = 1;
Comment thread
volokluev marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";

// The status of a seat object from the perspective of the external product
// that owns it (monitor, uptime detector, seer contributor).
enum ExternalProductSeatStatus {
EXTERNAL_PRODUCT_SEAT_STATUS_UNSPECIFIED = 0;

// Does not exist, either because it was removed or it was never created.
EXTERNAL_PRODUCT_SEAT_STATUS_DNE = 1;

// Alive and well.
EXTERNAL_PRODUCT_SEAT_STATUS_ACTIVE = 2;

// The billing platform deems this seat object unusable for billing reasons.
EXTERNAL_PRODUCT_SEAT_STATUS_DISABLED = 3;
}

message GetSeatStatusForExternalProductRequest {
sentry_protos.billing.v1.common.v1.SeatObject seat_object = 1;
}

message GetSeatStatusForExternalProductResponse {
ExternalProductSeatStatus status = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";

message RemoveSeatRequest {
sentry_protos.billing.v1.common.v1.SeatObject seat_object = 1;

// When omitted the service resolves the organization's current contract.
optional uint64 contract_id = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

message RolloverSeatsToNewContractRequest {
uint64 prev_contract_id = 1;
uint64 new_contract_id = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

import "sentry_protos/billing/v1/common/v1/seat_object.proto";

message UpdateSeatIdentifierRequest {
sentry_protos.billing.v1.common.v1.SeatObject seat_object = 1;
string new_identifier = 2;

// When omitted the service resolves the organization's current contract.
optional uint64 contract_id = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";

package sentry_protos.billing.v1.services.seats.v1;

// The outcome of a seat assignment check.
enum SeatOutcome {
// Default / unspecified.
SEAT_OUTCOME_UNSPECIFIED = 0;
// The seat(s) can be assigned — budget is available.
SEAT_OUTCOME_ACCEPTED = 1;
// The seat category is not available on the current plan.
SEAT_OUTCOME_INVALID = 2;
// The plan includes the category but all budget is exhausted.
SEAT_OUTCOME_RATE_LIMITED = 3;
}
5 changes: 5 additions & 0 deletions rust/src/_include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ pub mod sentry_protos {
include!("sentry_protos.billing.v1.services.rate_card.v1.rs");
}
}
pub mod seats {
pub mod v1 {
include!("sentry_protos.billing.v1.services.seats.v1.rs");
}
}
pub mod trial {
pub mod v1 {
include!("sentry_protos.billing.v1.services.trial.v1.rs");
Expand Down
15 changes: 15 additions & 0 deletions rust/src/sentry_protos.billing.v1.common.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,21 @@ pub struct DataCategoryRetention {
#[prost(message, optional, tag = "2")]
pub settings: ::core::option::Option<RetentionSettings>,
}
/// A seat object representing a billable product entity (monitor, uptime
/// detector, seer contributor) within an organization.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SeatObject {
#[prost(uint64, tag = "1")]
pub organization_id: u64,
#[prost(uint64, tag = "2")]
pub project_id: u64,
#[prost(enumeration = "super::super::SeatCategory", tag = "3")]
pub seat_category: i32,
#[prost(string, tag = "4")]
pub external_product_display_name: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub external_product_identifier: ::prost::alloc::string::String,
}
/// Card payment method details.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Card {
Expand Down
158 changes: 158 additions & 0 deletions rust/src/sentry_protos.billing.v1.services.seats.v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// This file is @generated by prost-build.
/// The outcome of a seat assignment check.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SeatOutcome {
/// Default / unspecified.
Unspecified = 0,
/// The seat(s) can be assigned — budget is available.
Accepted = 1,
/// The seat category is not available on the current plan.
Invalid = 2,
/// The plan includes the category but all budget is exhausted.
RateLimited = 3,
}
impl SeatOutcome {
/// 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 => "SEAT_OUTCOME_UNSPECIFIED",
Self::Accepted => "SEAT_OUTCOME_ACCEPTED",
Self::Invalid => "SEAT_OUTCOME_INVALID",
Self::RateLimited => "SEAT_OUTCOME_RATE_LIMITED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SEAT_OUTCOME_UNSPECIFIED" => Some(Self::Unspecified),
"SEAT_OUTCOME_ACCEPTED" => Some(Self::Accepted),
"SEAT_OUTCOME_INVALID" => Some(Self::Invalid),
"SEAT_OUTCOME_RATE_LIMITED" => Some(Self::RateLimited),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AssignSeatRequest {
#[prost(message, optional, tag = "1")]
pub seat_object: ::core::option::Option<super::super::super::common::v1::SeatObject>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AssignSeatResponse {
#[prost(enumeration = "SeatOutcome", tag = "1")]
pub outcome: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckAssignSeatsRequest {
#[prost(message, repeated, tag = "1")]
pub seat_objects: ::prost::alloc::vec::Vec<
super::super::super::common::v1::SeatObject,
>,
/// When omitted the service resolves the organization's current contract.
#[prost(uint64, optional, tag = "2")]
pub contract_id: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CheckAssignSeatsResponse {
#[prost(enumeration = "SeatOutcome", tag = "1")]
pub outcome: i32,
#[prost(string, tag = "2")]
pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DisableSeatRequest {
#[prost(message, optional, tag = "1")]
pub seat_object: ::core::option::Option<super::super::super::common::v1::SeatObject>,
/// When omitted the service resolves the organization's current contract.
#[prost(uint64, optional, tag = "2")]
pub contract_id: ::core::option::Option<u64>,
}
/// Seat usage for a single project.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectSeatUsage {
#[prost(uint64, tag = "1")]
pub project_id: u64,
#[prost(message, repeated, tag = "2")]
pub seat_days: ::prost::alloc::vec::Vec<super::super::usage::v1::DailySeatUsage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDailySeatUsageByProjectResponse {
#[prost(message, repeated, tag = "1")]
pub projects: ::prost::alloc::vec::Vec<ProjectSeatUsage>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSeatStatusForExternalProductRequest {
#[prost(message, optional, tag = "1")]
pub seat_object: ::core::option::Option<super::super::super::common::v1::SeatObject>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSeatStatusForExternalProductResponse {
#[prost(enumeration = "ExternalProductSeatStatus", tag = "1")]
pub status: i32,
}
/// The status of a seat object from the perspective of the external product
/// that owns it (monitor, uptime detector, seer contributor).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ExternalProductSeatStatus {
Unspecified = 0,
/// Does not exist, either because it was removed or it was never created.
Dne = 1,
/// Alive and well.
Active = 2,
/// The billing platform deems this seat object unusable for billing reasons.
Disabled = 3,
}
impl ExternalProductSeatStatus {
/// 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 => "EXTERNAL_PRODUCT_SEAT_STATUS_UNSPECIFIED",
Self::Dne => "EXTERNAL_PRODUCT_SEAT_STATUS_DNE",
Self::Active => "EXTERNAL_PRODUCT_SEAT_STATUS_ACTIVE",
Self::Disabled => "EXTERNAL_PRODUCT_SEAT_STATUS_DISABLED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EXTERNAL_PRODUCT_SEAT_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"EXTERNAL_PRODUCT_SEAT_STATUS_DNE" => Some(Self::Dne),
"EXTERNAL_PRODUCT_SEAT_STATUS_ACTIVE" => Some(Self::Active),
"EXTERNAL_PRODUCT_SEAT_STATUS_DISABLED" => Some(Self::Disabled),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RemoveSeatRequest {
#[prost(message, optional, tag = "1")]
pub seat_object: ::core::option::Option<super::super::super::common::v1::SeatObject>,
/// When omitted the service resolves the organization's current contract.
#[prost(uint64, optional, tag = "2")]
pub contract_id: ::core::option::Option<u64>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RolloverSeatsToNewContractRequest {
#[prost(uint64, tag = "1")]
pub prev_contract_id: u64,
#[prost(uint64, tag = "2")]
pub new_contract_id: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpdateSeatIdentifierRequest {
#[prost(message, optional, tag = "1")]
pub seat_object: ::core::option::Option<super::super::super::common::v1::SeatObject>,
#[prost(string, tag = "2")]
pub new_identifier: ::prost::alloc::string::String,
/// When omitted the service resolves the organization's current contract.
#[prost(uint64, optional, tag = "3")]
pub contract_id: ::core::option::Option<u64>,
}
Loading
Loading