Skip to content

Commit a85d66d

Browse files
committed
feat: add metric, metric_data, metric_example
Signed-off-by: ImMin5 <[email protected]>
1 parent 0933b2c commit a85d66d

File tree

3 files changed

+405
-0
lines changed

3 files changed

+405
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
syntax = "proto3";
2+
3+
package spaceone.api.inventory_v2.v1;
4+
5+
import "google/protobuf/empty.proto";
6+
import "google/protobuf/struct.proto";
7+
import "google/api/annotations.proto";
8+
import "spaceone/api/core/v2/query.proto";
9+
10+
option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/inventory_v2/v1";
11+
12+
service Metric {
13+
rpc create (CreateMetricRequest) returns (MetricInfo) {
14+
option (google.api.http) = {
15+
post: "/inventory-v2/v1/metric/create"
16+
body: "*"
17+
};
18+
}
19+
20+
rpc update (UpdateMetricRequest) returns (MetricInfo) {
21+
option (google.api.http) = {
22+
post: "/inventory-v2/v1/metric/update"
23+
body: "*"
24+
};
25+
}
26+
27+
rpc delete (MetricRequest) returns (google.protobuf.Empty) {
28+
option (google.api.http) = {
29+
post: "/inventory-v2/v1/metric/delete"
30+
body: "*"
31+
};
32+
}
33+
34+
rpc run (MetricRequest) returns (google.protobuf.Empty) {
35+
option (google.api.http) = {
36+
post: "/inventory-v2/v1/metric/run"
37+
body: "*"
38+
};
39+
}
40+
41+
rpc test (MetricTestRequest) returns (google.protobuf.Struct) {
42+
option (google.api.http) = {
43+
post: "/inventory-v2/v1/metric/test"
44+
body: "*"
45+
};
46+
}
47+
48+
rpc get (MetricRequest) returns (MetricInfo) {
49+
option (google.api.http) = {
50+
post: "/inventory-v2/v1/metric/get"
51+
body: "*"
52+
};
53+
}
54+
55+
rpc list (MetricQuery) returns (MetricsInfo) {
56+
option (google.api.http) = {
57+
post: "/inventory-v2/v1/metric/list"
58+
body: "*"
59+
};
60+
}
61+
62+
rpc stat (MetricStatQuery) returns (google.protobuf.Struct) {
63+
option (google.api.http) = {
64+
post: "/inventory-v2/v1/metric/stat"
65+
body: "*"
66+
};
67+
}
68+
}
69+
70+
enum MetricType {
71+
METRIC_TYPE_NONE = 0;
72+
COUNTER = 1;
73+
GAUGE = 2;
74+
}
75+
76+
//{
77+
//
78+
//}
79+
message CreateMetricRequest {
80+
enum ResourceGroup {
81+
RESOURCE_GROUP_NONE = 0;
82+
DOMAIN = 1;
83+
WORKSPACE = 2;
84+
}
85+
86+
// +optional
87+
string metric_id = 1;
88+
string name = 2;
89+
MetricType metric_type = 3;
90+
// +optional
91+
string resource_type = 4;
92+
spaceone.api.core.v2.AnalyzeQuery query_options = 5;
93+
// +optional
94+
string date_field = 6;
95+
// +optional
96+
string unit = 7;
97+
// +optional
98+
google.protobuf.Struct tags = 8;
99+
string namespace_id = 9;
100+
ResourceGroup resource_group = 20;
101+
// +optional
102+
string workspace_id = 21;
103+
}
104+
105+
//{
106+
//
107+
//}
108+
message UpdateMetricRequest {
109+
string metric_id = 1;
110+
// +optional
111+
string name = 2;
112+
// +optional
113+
spaceone.api.core.v2.AnalyzeQuery query_options = 3;
114+
// +optional
115+
string date_field = 4;
116+
// +optional
117+
string unit = 5;
118+
// +optional
119+
google.protobuf.Struct tags = 6;
120+
}
121+
122+
//{
123+
//
124+
//}
125+
message MetricRequest {
126+
string metric_id = 1;
127+
}
128+
129+
//{
130+
//
131+
//}
132+
message MetricTestRequest {
133+
string metric_id = 1;
134+
spaceone.api.core.v2.AnalyzeQuery query_options = 2;
135+
}
136+
137+
//{
138+
//
139+
//}
140+
message MetricQuery {
141+
// +optional
142+
spaceone.api.core.v2.Query query = 1;
143+
// +optional
144+
string metric_id = 2;
145+
// +optional
146+
MetricType metric_type = 3;
147+
// +optional
148+
string resource_type = 4;
149+
// +optional
150+
string is_managed = 5;
151+
// +optional
152+
string namespace_id = 21;
153+
}
154+
155+
//{
156+
//
157+
//}
158+
message MetricInfo {
159+
enum ResourceGroup {
160+
RESOURCE_GROUP_NONE = 0;
161+
DOMAIN = 1;
162+
WORKSPACE = 2;
163+
}
164+
165+
string metric_id = 1;
166+
string name = 2;
167+
MetricType metric_type = 3;
168+
string resource_type = 4;
169+
spaceone.api.core.v2.AnalyzeQuery query_options = 5;
170+
string date_field = 6;
171+
string unit = 7;
172+
google.protobuf.Struct tags = 8;
173+
repeated google.protobuf.Struct labels_info = 9;
174+
bool is_managed = 10;
175+
176+
ResourceGroup resource_group = 20;
177+
string domain_id = 21;
178+
string workspace_id = 22;
179+
string namespace_id = 23;
180+
181+
string created_at = 31;
182+
string updated_at = 32;
183+
}
184+
185+
186+
message MetricsInfo {
187+
repeated MetricInfo results = 1;
188+
int32 total_count = 2;
189+
}
190+
191+
message MetricStatQuery {
192+
spaceone.api.core.v2.StatisticsQuery query = 1;
193+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
syntax = "proto3";
2+
3+
package spaceone.api.inventory.v1;
4+
5+
import "google/protobuf/empty.proto";
6+
import "google/protobuf/struct.proto";
7+
import "google/api/annotations.proto";
8+
import "spaceone/api/core/v2/query.proto";
9+
import "spaceone/api/inventory_v2/v1/metric.proto";
10+
11+
option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/inventory_v2/v1";
12+
13+
service MetricData {
14+
rpc list (MetricDataQuery) returns (MetricDatasInfo) {
15+
option (google.api.http) = {
16+
post: "/inventory-v2/v1/metric-data/list"
17+
body: "*"
18+
};
19+
}
20+
21+
rpc stat (MetricDataStatQuery) returns (google.protobuf.Struct) {
22+
option (google.api.http) = {
23+
post: "/inventory-v2/v1/metric-data/stat"
24+
body: "*"
25+
};
26+
}
27+
28+
rpc analyze (MetricDataAnalyzeQuery) returns (google.protobuf.Struct) {
29+
option (google.api.http) = {
30+
post: "/inventory-v2/v1/metric-data/analyze"
31+
body: "*"
32+
};
33+
}
34+
}
35+
36+
//{
37+
//
38+
//}
39+
message MetricDataQuery {
40+
// +optional
41+
spaceone.api.core.v2.Query query = 1;
42+
string metric_id = 2;
43+
// +optional
44+
string workspace_id = 21;
45+
// +optional
46+
string project_id = 22;
47+
}
48+
49+
50+
//{
51+
//
52+
//}
53+
message MetricDataInfo {
54+
string metric_id = 1;
55+
float value = 2;
56+
string unit = 3;
57+
google.protobuf.Struct labels = 4;
58+
59+
string domain_id = 21;
60+
string workspace_id = 22;
61+
string project_id = 23;
62+
string service_account_id = 24;
63+
string namespace_id = 25;
64+
65+
string created_year = 31;
66+
string created_month = 32;
67+
string created_date = 33;
68+
}
69+
70+
message MetricDatasInfo {
71+
repeated MetricDataInfo results = 1;
72+
int32 total_count = 2;
73+
}
74+
75+
message MetricDataAnalyzeQuery {
76+
spaceone.api.core.v2.TimeSeriesAnalyzeQuery query = 1;
77+
string metric_id = 2;
78+
}
79+
80+
message MetricDataStatQuery {
81+
spaceone.api.core.v2.StatisticsQuery query = 1;
82+
// +optional
83+
string metric_id = 2;
84+
}

0 commit comments

Comments
 (0)