From a85d66d11be7b02772684de16b0691dac02cc211 Mon Sep 17 00:00:00 2001 From: ImMin5 Date: Sat, 30 Nov 2024 00:44:28 +0900 Subject: [PATCH] feat: add metric, metric_data, metric_example Signed-off-by: ImMin5 --- .../spaceone/api/inventory_v2/v1/metric.proto | 193 ++++++++++++++++++ .../api/inventory_v2/v1/metric_data.proto | 84 ++++++++ .../api/inventory_v2/v1/metric_example.proto | 128 ++++++++++++ 3 files changed, 405 insertions(+) create mode 100644 proto/spaceone/api/inventory_v2/v1/metric.proto create mode 100644 proto/spaceone/api/inventory_v2/v1/metric_data.proto create mode 100644 proto/spaceone/api/inventory_v2/v1/metric_example.proto diff --git a/proto/spaceone/api/inventory_v2/v1/metric.proto b/proto/spaceone/api/inventory_v2/v1/metric.proto new file mode 100644 index 00000000..b8bac7ff --- /dev/null +++ b/proto/spaceone/api/inventory_v2/v1/metric.proto @@ -0,0 +1,193 @@ +syntax = "proto3"; + +package spaceone.api.inventory_v2.v1; + +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; +import "spaceone/api/core/v2/query.proto"; + +option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/inventory_v2/v1"; + +service Metric { + rpc create (CreateMetricRequest) returns (MetricInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/create" + body: "*" + }; + } + + rpc update (UpdateMetricRequest) returns (MetricInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/update" + body: "*" + }; + } + + rpc delete (MetricRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/delete" + body: "*" + }; + } + + rpc run (MetricRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/run" + body: "*" + }; + } + + rpc test (MetricTestRequest) returns (google.protobuf.Struct) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/test" + body: "*" + }; + } + + rpc get (MetricRequest) returns (MetricInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/get" + body: "*" + }; + } + + rpc list (MetricQuery) returns (MetricsInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/list" + body: "*" + }; + } + + rpc stat (MetricStatQuery) returns (google.protobuf.Struct) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric/stat" + body: "*" + }; + } +} + +enum MetricType { + METRIC_TYPE_NONE = 0; + COUNTER = 1; + GAUGE = 2; +} + +//{ +// +//} +message CreateMetricRequest { + enum ResourceGroup { + RESOURCE_GROUP_NONE = 0; + DOMAIN = 1; + WORKSPACE = 2; + } + + // +optional + string metric_id = 1; + string name = 2; + MetricType metric_type = 3; + // +optional + string resource_type = 4; + spaceone.api.core.v2.AnalyzeQuery query_options = 5; + // +optional + string date_field = 6; + // +optional + string unit = 7; + // +optional + google.protobuf.Struct tags = 8; + string namespace_id = 9; + ResourceGroup resource_group = 20; + // +optional + string workspace_id = 21; +} + +//{ +// +//} +message UpdateMetricRequest { + string metric_id = 1; + // +optional + string name = 2; + // +optional + spaceone.api.core.v2.AnalyzeQuery query_options = 3; + // +optional + string date_field = 4; + // +optional + string unit = 5; + // +optional + google.protobuf.Struct tags = 6; +} + +//{ +// +//} +message MetricRequest { + string metric_id = 1; +} + +//{ +// +//} +message MetricTestRequest { + string metric_id = 1; + spaceone.api.core.v2.AnalyzeQuery query_options = 2; +} + +//{ +// +//} +message MetricQuery { + // +optional + spaceone.api.core.v2.Query query = 1; + // +optional + string metric_id = 2; + // +optional + MetricType metric_type = 3; + // +optional + string resource_type = 4; + // +optional + string is_managed = 5; + // +optional + string namespace_id = 21; +} + +//{ +// +//} +message MetricInfo { + enum ResourceGroup { + RESOURCE_GROUP_NONE = 0; + DOMAIN = 1; + WORKSPACE = 2; + } + + string metric_id = 1; + string name = 2; + MetricType metric_type = 3; + string resource_type = 4; + spaceone.api.core.v2.AnalyzeQuery query_options = 5; + string date_field = 6; + string unit = 7; + google.protobuf.Struct tags = 8; + repeated google.protobuf.Struct labels_info = 9; + bool is_managed = 10; + + ResourceGroup resource_group = 20; + string domain_id = 21; + string workspace_id = 22; + string namespace_id = 23; + + string created_at = 31; + string updated_at = 32; +} + + +message MetricsInfo { + repeated MetricInfo results = 1; + int32 total_count = 2; +} + +message MetricStatQuery { + spaceone.api.core.v2.StatisticsQuery query = 1; +} \ No newline at end of file diff --git a/proto/spaceone/api/inventory_v2/v1/metric_data.proto b/proto/spaceone/api/inventory_v2/v1/metric_data.proto new file mode 100644 index 00000000..4e443e8d --- /dev/null +++ b/proto/spaceone/api/inventory_v2/v1/metric_data.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package spaceone.api.inventory.v1; + +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; +import "spaceone/api/core/v2/query.proto"; +import "spaceone/api/inventory_v2/v1/metric.proto"; + +option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/inventory_v2/v1"; + +service MetricData { + rpc list (MetricDataQuery) returns (MetricDatasInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-data/list" + body: "*" + }; + } + + rpc stat (MetricDataStatQuery) returns (google.protobuf.Struct) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-data/stat" + body: "*" + }; + } + + rpc analyze (MetricDataAnalyzeQuery) returns (google.protobuf.Struct) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-data/analyze" + body: "*" + }; + } +} + +//{ +// +//} +message MetricDataQuery { + // +optional + spaceone.api.core.v2.Query query = 1; + string metric_id = 2; + // +optional + string workspace_id = 21; + // +optional + string project_id = 22; +} + + +//{ +// +//} +message MetricDataInfo { + string metric_id = 1; + float value = 2; + string unit = 3; + google.protobuf.Struct labels = 4; + + string domain_id = 21; + string workspace_id = 22; + string project_id = 23; + string service_account_id = 24; + string namespace_id = 25; + + string created_year = 31; + string created_month = 32; + string created_date = 33; +} + +message MetricDatasInfo { + repeated MetricDataInfo results = 1; + int32 total_count = 2; +} + +message MetricDataAnalyzeQuery { + spaceone.api.core.v2.TimeSeriesAnalyzeQuery query = 1; + string metric_id = 2; +} + +message MetricDataStatQuery { + spaceone.api.core.v2.StatisticsQuery query = 1; + // +optional + string metric_id = 2; +} \ No newline at end of file diff --git a/proto/spaceone/api/inventory_v2/v1/metric_example.proto b/proto/spaceone/api/inventory_v2/v1/metric_example.proto new file mode 100644 index 00000000..0708e307 --- /dev/null +++ b/proto/spaceone/api/inventory_v2/v1/metric_example.proto @@ -0,0 +1,128 @@ +syntax = "proto3"; + +package spaceone.api.inventory_v2.v1; + +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; +import "spaceone/api/core/v2/query.proto"; + +option go_package = "github.com/cloudforet-io/api/dist/go/spaceone/api/inventory_v2/v1"; + +service MetricExample { + rpc create (CreateMetricExampleRequest) returns (MetricExampleInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/create" + body: "*" + }; + } + + rpc update (UpdateMetricExampleRequest) returns (MetricExampleInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/update" + body: "*" + }; + } + + rpc delete (MetricExampleRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/delete" + body: "*" + }; + } + + rpc get (MetricExampleRequest) returns (MetricExampleInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/get" + body: "*" + }; + } + + rpc list (MetricExampleQuery) returns (MetricExamplesInfo) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/list" + body: "*" + }; + } + + rpc stat (MetricExampleStatQuery) returns (google.protobuf.Struct) { + option (google.api.http) = { + post: "/inventory-v2/v1/metric-example/stat" + body: "*" + }; + } +} + +//{ +// +//} +message CreateMetricExampleRequest { + string metric_id = 1; + string name = 2; + google.protobuf.Struct options = 3; + // +optional + google.protobuf.Struct tags = 4; +} + +//{ +// +//} +message UpdateMetricExampleRequest { + string example_id = 1; + // +optional + string name = 2; + // +optional + google.protobuf.Struct options = 3; + // +optional + google.protobuf.Struct tags = 4; +} + +//{ +// +//} +message MetricExampleRequest { + string example_id = 1; +} + +//{ +// +//} +message MetricExampleQuery { + // +optional + spaceone.api.core.v2.Query query = 1; + // +optional + string example_id = 2; + // +optional + string name = 3; + // +optional + string metric_id = 4; + // +optional + string namespace_id = 5; +} + +//{ +// +//} +message MetricExampleInfo { + string example_id = 1; + string name = 2; + google.protobuf.Struct options = 3; + google.protobuf.Struct tags = 4; + + string domain_id = 21; + string user_id = 22; + string metric_id = 23; + string namespace_id = 24; + + string created_at = 31; + string updated_at = 32; +} + +message MetricExamplesInfo { + repeated MetricExampleInfo results = 1; + int32 total_count = 2; +} + +message MetricExampleStatQuery { + spaceone.api.core.v2.StatisticsQuery query = 1; +} \ No newline at end of file