forked from grafana/jsonnet-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simpler API for Grizzly resources (grafana#635)
* Simpler API for Grizzly resources * lint, and add necessary resource.libsonnet
- Loading branch information
1 parent
0d13e5b
commit 763787b
Showing
5 changed files
with
67 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,7 @@ | ||
local resource = import 'resource.libsonnet'; | ||
{ | ||
new(type, name, check):: | ||
resource.new('SyntheticMonitoringCheck', name) | ||
+ resource.addMetadata('type', type) | ||
+ resource.withSpec(check), | ||
} |
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
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
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
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,22 @@ | ||
{ | ||
defaultApiVersion:: 'grizzly.grafana.com/v1alpha1', | ||
new(kind, name):: { | ||
apiVersion: $.defaultApiVersion, | ||
kind: kind, | ||
metadata: { | ||
name: name, | ||
}, | ||
}, | ||
withApiVersion(apiVersion):: { | ||
defaultApiVersion:: apiVersion, | ||
apiVersion: apiVersion, | ||
}, | ||
addMetadata(name, value):: { | ||
metadata+: { | ||
[name]: value, | ||
}, | ||
}, | ||
withSpec(spec):: { | ||
spec: spec, | ||
}, | ||
} |