-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #20 Signed-off-by: Michael Gasch <mgasch@vmware.com>
- Loading branch information
Michael Gasch
committed
Jun 14, 2021
1 parent
17a7ba3
commit e52c778
Showing
5 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package v1alpha1 | ||
|
||
#apiVersion: string | ||
#kind: string | ||
#metadata: { | ||
// TODO: fix regex - requires at least two chars | ||
name: =~"^[a-z0-9][a-z0-9_]{1,61}[a-z0-9]$" & string | ||
// optional | ||
displayName?: string | ||
// map[string]string, optional | ||
labels?: [string]: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Generated by cue.", | ||
"version": "no version" | ||
}, | ||
"paths": {}, | ||
"components": { | ||
"schemas": { | ||
"apiVersion": { | ||
"type": "string" | ||
}, | ||
"indicator": { | ||
"type": "object" | ||
}, | ||
"kind": { | ||
"type": "string" | ||
}, | ||
"metadata": { | ||
"type": "object", | ||
"required": [ | ||
"name" | ||
], | ||
"properties": { | ||
"name": { | ||
"description": "TODO: fix regex - requires at least two chars", | ||
"type": "string", | ||
"pattern": "^[a-z0-9][a-z0-9_]{1,61}[a-z0-9]$" | ||
}, | ||
"displayName": { | ||
"description": "optional", | ||
"type": "string" | ||
}, | ||
"labels": { | ||
"description": "map[string]string, optional", | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"spec": { | ||
"type": "object", | ||
"required": [ | ||
"service", | ||
"timeWindow", | ||
"budgetingMethod" | ||
], | ||
"properties": { | ||
"service": { | ||
"description": "list?", | ||
"type": "string" | ||
}, | ||
"description": { | ||
"description": "optional\nTODO: 1050 exceeds go regex limit (1000)", | ||
"type": "string" | ||
}, | ||
"timeWindow": { | ||
"description": "object oneOf", | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/components/schemas/timeWindowSecond" | ||
}, | ||
{ | ||
"$ref": "#/components/schemas/timeWindowCalendar" | ||
} | ||
] | ||
}, | ||
"budgetingMethod": { | ||
"description": "objectives:\nindicator:", | ||
"type": "string", | ||
"enum": [ | ||
"Occurrences", | ||
"Timeslices" | ||
] | ||
} | ||
} | ||
}, | ||
"thresholdMetric": { | ||
"type": "object", | ||
"required": [ | ||
"source", | ||
"queryType", | ||
"query" | ||
], | ||
"properties": { | ||
"source": { | ||
"type": "string" | ||
}, | ||
"queryType": { | ||
"type": "string" | ||
}, | ||
"query": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"timeWindow": { | ||
"type": "object", | ||
"required": [ | ||
"unit", | ||
"count", | ||
"isRolling" | ||
], | ||
"properties": { | ||
"unit": { | ||
"type": "string" | ||
}, | ||
"count": { | ||
"type": "string" | ||
}, | ||
"isRolling": { | ||
"type": "boolean" | ||
} | ||
} | ||
}, | ||
"timeWindowCalendar": { | ||
"type": "object", | ||
"properties": { | ||
"unit": { | ||
"type": "string", | ||
"enum": [ | ||
"Year", | ||
"Quarter", | ||
"Month", | ||
"Week", | ||
"Day" | ||
] | ||
}, | ||
"count": { | ||
"type": "string", | ||
"enum": [ | ||
"numeric" | ||
] | ||
}, | ||
"calendar": { | ||
"type": "object", | ||
"required": [ | ||
"startTime" | ||
], | ||
"properties": { | ||
"startTime": { | ||
"description": "note: leap-seconds not supported", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/timeWindow" | ||
}, | ||
{ | ||
"required": [ | ||
"unit", | ||
"count" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"calendar" | ||
] | ||
} | ||
] | ||
}, | ||
"timeWindowSecond": { | ||
"type": "object", | ||
"properties": { | ||
"unit": { | ||
"type": "string", | ||
"enum": [ | ||
"Second" | ||
] | ||
}, | ||
"count": { | ||
"type": "string", | ||
"enum": [ | ||
"numeric" | ||
] | ||
} | ||
}, | ||
"allOf": [ | ||
{ | ||
"$ref": "#/components/schemas/timeWindow" | ||
}, | ||
{ | ||
"required": [ | ||
"unit", | ||
"count" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: openslo/v1alpha1 | ||
kind: SLO | ||
metadata: | ||
name: "a_name" | ||
displayName: "a display name" | ||
spec: | ||
service: "name" | ||
description: "1234567890" | ||
timeWindow: | ||
unit: "Day" | ||
count: numeric | ||
isRolling: true | ||
calendar: | ||
startTime: "2009-11-10T23:00:00Z" | ||
budgetingMethod: Occurrences |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package v1alpha1 | ||
|
||
apiVersion: "openslo/v1alpha1" & #apiVersion | ||
kind: "SLO" & #kind | ||
metadata: #metadata | ||
spec: #spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package v1alpha1 | ||
|
||
import "time" | ||
|
||
#spec: { | ||
// list? | ||
service: string | ||
// optional | ||
// TODO: 1050 exceeds go regex limit (1000) | ||
description?: string | ||
// object oneOf | ||
timeWindow: #timeWindowSecond | #timeWindowCalendar | ||
budgetingMethod: "Occurrences" | "Timeslices" | ||
// objectives: | ||
// indicator: | ||
} | ||
|
||
#indicator: { | ||
|
||
} | ||
|
||
#thresholdMetric: { | ||
source: string | ||
queryType: string | ||
query: string | ||
} | ||
|
||
#timeWindow: { | ||
unit: string | ||
count: string | ||
isRolling: bool | ||
} | ||
|
||
#timeWindowSecond: { | ||
#timeWindow & { | ||
unit: "Second" | ||
count: "numeric" | ||
} | ||
} | ||
|
||
#timeWindowCalendar: { | ||
#timeWindow & { | ||
unit: "Year" | "Quarter" | "Month" | "Week" | "Day" | ||
count: "numeric" | ||
} | ||
calendar: { | ||
// note: leap-seconds not supported | ||
startTime: time.Format(time.RFC3339) | ||
} | ||
} |