Skip to content

Commit 8e8f921

Browse files
authored
revert(cockpit): set back external enum (scaleway#2322)
1 parent 6ef6751 commit 8e8f921

File tree

1 file changed

+3
-46
lines changed

1 file changed

+3
-46
lines changed

api/cockpit/v1/cockpit_sdk.go

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const (
4747
// Data source managed by Scaleway, used to store and query metrics and logs from Scaleway resources.
4848
DataSourceOriginScaleway = DataSourceOrigin("scaleway")
4949
// Data source created by the user, used to store and query metrics, logs and traces from user's custom resources.
50+
DataSourceOriginExternal = DataSourceOrigin("external")
51+
// Data source created by the user, used to store and query metrics, logs and traces from user's custom resources.
5052
DataSourceOriginCustom = DataSourceOrigin("custom")
5153
)
5254

@@ -62,6 +64,7 @@ func (enum DataSourceOrigin) Values() []DataSourceOrigin {
6264
return []DataSourceOrigin{
6365
"unknown_origin",
6466
"scaleway",
67+
"external",
6568
"custom",
6669
}
6770
}
@@ -725,11 +728,6 @@ type AlertManager struct {
725728
Region scw.Region `json:"region"`
726729
}
727730

728-
// CockpitMetrics: cockpit metrics.
729-
type CockpitMetrics struct {
730-
Timeseries []*scw.TimeSeries `json:"timeseries"`
731-
}
732-
733731
// GetConfigResponse: Cockpit configuration.
734732
type GetConfigResponse struct {
735733
// CustomMetricsRetention: custom metrics retention configuration.
@@ -1190,17 +1188,6 @@ type RegionalAPIGetAlertManagerRequest struct {
11901188
ProjectID string `json:"project_id"`
11911189
}
11921190

1193-
// RegionalAPIGetCockpitMetricsRequest: regional api get cockpit metrics request.
1194-
type RegionalAPIGetCockpitMetricsRequest struct {
1195-
ProjectID string `json:"-"`
1196-
1197-
StartDate *time.Time `json:"-"`
1198-
1199-
EndDate *time.Time `json:"-"`
1200-
1201-
Query string `json:"-"`
1202-
}
1203-
12041191
// RegionalAPIGetConfigRequest: Get Cockpit configuration.
12051192
type RegionalAPIGetConfigRequest struct {
12061193
// Region: region to target. If none is passed will use default region from the config.
@@ -2487,33 +2474,3 @@ func (s *RegionalAPI) TriggerTestAlert(req *RegionalAPITriggerTestAlertRequest,
24872474
}
24882475
return nil
24892476
}
2490-
2491-
// GetCockpitMetrics:
2492-
func (s *RegionalAPI) GetCockpitMetrics(req *RegionalAPIGetCockpitMetricsRequest, opts ...scw.RequestOption) (*CockpitMetrics, error) {
2493-
var err error
2494-
2495-
if req.ProjectID == "" {
2496-
defaultProjectID, _ := s.client.GetDefaultProjectID()
2497-
req.ProjectID = defaultProjectID
2498-
}
2499-
2500-
query := url.Values{}
2501-
parameter.AddToQuery(query, "project_id", req.ProjectID)
2502-
parameter.AddToQuery(query, "start_date", req.StartDate)
2503-
parameter.AddToQuery(query, "end_date", req.EndDate)
2504-
parameter.AddToQuery(query, "query", req.Query)
2505-
2506-
scwReq := &scw.ScalewayRequest{
2507-
Method: "GET",
2508-
Path: "/cockpit/v1beta1/cockpit/metrics",
2509-
Query: query,
2510-
}
2511-
2512-
var resp CockpitMetrics
2513-
2514-
err = s.client.Do(scwReq, &resp, opts...)
2515-
if err != nil {
2516-
return nil, err
2517-
}
2518-
return &resp, nil
2519-
}

0 commit comments

Comments
 (0)