Skip to content

Add ReportAdjustment and ReportAdjustmentPolicy services with corresponding proto definitions #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 6, 2025
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
6 changes: 4 additions & 2 deletions proto/spaceone/api/cost_analysis/v1/cost_report.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ message CostReportInfo {
string report_month = 9;
string workspace_name = 10;
string bank_name = 11;
bool is_adjusted = 12;
string cost_report_config_id = 21;
string workspace_id = 22;
string domain_id = 23;
string project_id = 22;
string workspace_id = 23;
string domain_id = 24;
string created_at = 31;
}

Expand Down
61 changes: 46 additions & 15 deletions proto/spaceone/api/cost_analysis/v1/cost_report_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,32 @@ service CostReportConfig {
}
}

message AdjustmentOptions {
bool enabled = 1;
int32 period = 2;
}

message CreateCostReportConfigRequest {
enum Scope {
SCOPE_NONE = 0;
WORKSPACE = 1;
PROJECT = 2;
}
Scope scope = 1;
// +optional
int32 issue_day = 1;
int32 issue_day = 2;
// +optional
bool is_last_day = 2;
bool is_last_day = 3;
// +optional
string currency = 3;
google.protobuf.Struct recipients = 4;
AdjustmentOptions adjustment_options = 4;
// +optional
google.protobuf.Struct data_source_filter = 5;
string currency = 6;
google.protobuf.Struct recipients = 7;
// +optional
google.protobuf.Struct data_source_filter = 8;
// Default `en`
// +optional
string language = 6;
string language = 9;
}

message UpdateCostReportConfigRequest {
Expand All @@ -105,11 +118,13 @@ message UpdateCostReportConfigRequest {
// +optional
bool is_last_day = 3;
// +optional
string currency = 4;
AdjustmentOptions adjustment_options = 4;
// +optional
google.protobuf.Struct data_source_filter = 5;
string currency = 6;
// +optional
string language = 6;
google.protobuf.Struct data_source_filter = 7;
// +optional
string language = 8;

}

Expand All @@ -130,13 +145,21 @@ message CostReportConfigQuery {
DISABLED = 2;
}

enum Scope {
SCOPE_NONE = 0;
WORKSPACE = 1;
PROJECT = 2;
}

// +optional
spaceone.api.core.v2.Query query = 1;
// The ID of cost report in the Protocol.
// +optional
string cost_report_config_id = 2;
// +optional
State state = 3;
// +optional
Scope scope = 4;
}

message CostReportConfigInfo {
Expand All @@ -147,15 +170,23 @@ message CostReportConfigInfo {
DELETED = 3;
}

enum Scope {
SCOPE_NONE = 0;
WORKSPACE = 1;
PROJECT = 2;
}

// The ID of cost report in the Protocol.
string cost_report_config_id = 1;
State state = 2;
int32 issue_day = 3;
bool is_last_day = 4;
string currency = 6;
google.protobuf.Struct recipients = 7;
google.protobuf.Struct data_source_filter = 8;
string language = 9;
Scope scope = 3;
int32 issue_day = 4;
bool is_last_day = 5;
AdjustmentOptions adjustment_options = 6;
string currency = 8;
google.protobuf.Struct recipients = 9;
google.protobuf.Struct data_source_filter = 10;
string language = 11;
string domain_id = 21;
string created_at = 31;
string updated_at = 32;
Expand Down
20 changes: 11 additions & 9 deletions proto/spaceone/api/cost_analysis/v1/cost_report_data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,21 @@ message CostReportDataInfo {
string report_year = 5;
string report_month = 6;
bool is_confirmed = 7;
string provider = 8;
string product = 9;
string service_account_name = 10;
string data_source_name = 11;
string project_name = 12;
string workspace_name = 13;
bool is_adjusted = 8;
string provider = 9;
string product = 10;
string service_account_name = 11;
string data_source_name = 12;
string project_name = 13;
string workspace_name = 14;
string domain_id = 21;
string workspace_id = 22;
string project_id = 23;
string cost_report_config_id = 24;
string cost_report_id = 25;
string data_source_id = 26;
string service_account_id = 27;
string report_adjustment_policy_id = 25;
string cost_report_id = 26;
string data_source_id = 27;
string service_account_id = 28;
string created_at = 31;
}

Expand Down
148 changes: 148 additions & 0 deletions proto/spaceone/api/cost_analysis/v1/report_adjustment.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
syntax = "proto3";

package spaceone.api.cost_analysis.v1;

option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/cost_analysis/v1";

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
import "spaceone/api/core/v2/query.proto";
import "spaceone/api/cost_analysis/v1/job.proto";

service ReportAdjustment {
rpc create (CreateReportAdjustmentRequest) returns (ReportAdjustmentInfo) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/create",
body: "*"
};
}

rpc update (UpdateReportAdjustmentRequest) returns (ReportAdjustmentInfo) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/update",
body: "*"
};
}

rpc change_order (ChangeOrderReportAdjustmentRequest) returns (ReportAdjustmentInfo) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/change-order",
body: "*"
};
}

rpc delete (ReportAdjustmentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/delete"
body: "*"
};
}

rpc get (ReportAdjustmentRequest) returns (ReportAdjustmentInfo) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/get",
body: "*"
};
}

rpc list (ReportAdjustmentQuery) returns (ReportAdjustmentsInfo) {
option (google.api.http) = {
post: "/cost-analysis/v1/report-adjustment/list",
body: "*"
};
}

}

enum AdjustmentMethod {
METHOD_NONE = 0;
FIXED = 1;
RATE = 2;
}

message CreateReportAdjustmentRequest {
string name = 1;
AdjustmentMethod method = 2;
float value = 3;
// +optional
string description = 4;
// +optional
string provider = 5;
// +optional
string currency = 6;
// +optional
int32 order = 7;
// +optional
google.protobuf.Struct filters = 8;
string report_adjustment_policy_id = 10;
}

message UpdateReportAdjustmentRequest {
string report_adjustment_id = 1;
// +optional
string name = 2;
// +optional
AdjustmentMethod method = 3;
// +optional
float value = 4;
// +optional
string description = 5;
// +optional
string provider = 6;
// +optional
google.protobuf.Struct filters = 7;
}

message ChangeOrderReportAdjustmentRequest {
string report_adjustment_id = 1;
int32 order = 2;
}

message ReportAdjustmentRequest {
string report_adjustment_id = 1;
}

message ReportAdjustmentQuery {
enum State {
NONE = 0;
ENABLED = 1;
DISABLED = 2;
DELETED = 3;
}
// +optional
spaceone.api.core.v2.Query query = 1;
// +optional
string name = 2;
// +optional
State state = 3;
// +optional
string workspace_id = 4;
// +optional
string project_id = 5;
}

message ReportAdjustmentInfo {
string report_adjustment_id = 1;
string name = 2;
AdjustmentMethod method = 3;
float value = 4;
string description = 5;
string provider = 6;
string currency = 7;
int32 order = 8;
google.protobuf.Struct filters = 9;

string created_at = 11;
string updated_at = 12;
string deleted_at = 13;

string cost_report_config_id = 19;
string report_adjustment_policy_id = 20;
string domain_id = 21;
}

message ReportAdjustmentsInfo {
repeated ReportAdjustmentInfo results = 1;
int32 total_count = 2;
}
Loading
Loading