diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 887be3290ce..0314cdf07a0 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -473,7 +473,6 @@ lerna.json @grafana/frontend-ops
/scripts/trigger_docker_build.sh @grafana/grafana-delivery
/scripts/trigger_grafana_packer.sh @grafana/grafana-delivery
/scripts/trigger_windows_build.sh @grafana/grafana-delivery
-/scripts/validate-devenv-dashboards.sh @grafana/grafana-delivery
/scripts/verify-repo-update/ @grafana/grafana-delivery
/scripts/webpack/ @grafana/frontend-ops
diff --git a/docs/sources/developers/kinds/core/dashboard/schema-reference.md b/docs/sources/developers/kinds/core/dashboard/schema-reference.md
index ed150b04d41..43bb5161711 100644
--- a/docs/sources/developers/kinds/core/dashboard/schema-reference.md
+++ b/docs/sources/developers/kinds/core/dashboard/schema-reference.md
@@ -13,6 +13,57 @@ title: Dashboard kind
A Grafana dashboard.
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|------------------------|---------------------------------------------|----------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editable` | boolean | **Yes** | `true` | Whether a dashboard is editable or not. |
@@ -608,4 +659,34 @@ TODO this appears to be spread all over in the frontend. Concepts will likely ne
| `refresh_intervals` | string[] | **Yes** | `[5s 10s 30s 1m 5m 15m 30m 1h 2h 1d]` | Selectable intervals for auto-refresh. |
| `time_options` | string[] | **Yes** | `[5m 15m 1h 6h 12h 24h 2d 7d 30d]` | TODO docs |
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/developers/kinds/core/librarypanel/schema-reference.md b/docs/sources/developers/kinds/core/librarypanel/schema-reference.md
index 090c0ab163b..b0e7fa8b078 100644
--- a/docs/sources/developers/kinds/core/librarypanel/schema-reference.md
+++ b/docs/sources/developers/kinds/core/librarypanel/schema-reference.md
@@ -13,6 +13,57 @@ title: LibraryPanel kind
A standalone panel
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|-----------------|-------------------------------------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------|
| `model` | [object](#model) | **Yes** | | TODO: should be the same panel schema defined in dashboard
Typescript: Omit; |
@@ -53,4 +104,34 @@ Typescript: Omit;
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/developers/kinds/core/playlist/schema-reference.md b/docs/sources/developers/kinds/core/playlist/schema-reference.md
index a58544c41c8..06285751bef 100644
--- a/docs/sources/developers/kinds/core/playlist/schema-reference.md
+++ b/docs/sources/developers/kinds/core/playlist/schema-reference.md
@@ -13,6 +13,57 @@ title: Playlist kind
A playlist is a series of dashboards that is automatically rotated in the browser, on a configurable interval.
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|------------|---------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interval` | string | **Yes** | `5m` | Interval sets the time between switching views in a playlist.
FIXME: Is this based on a standardized format or what options are available? Can datemath be used? |
@@ -28,4 +79,34 @@ A playlist is a series of dashboards that is automatically rotated in the browse
| `value` | string | **Yes** | | Value depends on type and describes the playlist item.
- dashboard_by_id: The value is an internal numerical identifier set by Grafana. This
is not portable as the numerical identifier is non-deterministic between different instances.
Will be replaced by dashboard_by_uid in the future. (deprecated)
- dashboard_by_tag: The value is a tag which is set on any number of dashboards. All
dashboards behind the tag will be added to the playlist.
- dashboard_by_uid: The value is the dashboard UID |
| `title` | string | No | | Title is an unused property -- it will be removed in the future |
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/developers/kinds/core/preferences/schema-reference.md b/docs/sources/developers/kinds/core/preferences/schema-reference.md
index 1f487e05207..54254a08232 100644
--- a/docs/sources/developers/kinds/core/preferences/schema-reference.md
+++ b/docs/sources/developers/kinds/core/preferences/schema-reference.md
@@ -13,6 +13,57 @@ title: Preferences kind
The user or team frontend preferences
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|--------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------|
| `homeDashboardUID` | string | No | | UID for the home dashboard |
@@ -28,4 +79,34 @@ The user or team frontend preferences
|-----------|--------|----------|---------|---------------------------------------------|
| `homeTab` | string | No | | one of: '' | 'query' | 'starred'; |
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/developers/kinds/core/publicdashboard/schema-reference.md b/docs/sources/developers/kinds/core/publicdashboard/schema-reference.md
index 27134952937..1539db4cf20 100644
--- a/docs/sources/developers/kinds/core/publicdashboard/schema-reference.md
+++ b/docs/sources/developers/kinds/core/publicdashboard/schema-reference.md
@@ -13,6 +13,57 @@ title: PublicDashboard kind
Public dashboard configuration
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|------------------------|---------|----------|---------|-----------------------------------------------------------------|
| `annotationsEnabled` | boolean | **Yes** | | Flag that indicates if annotations are enabled |
@@ -22,4 +73,34 @@ Public dashboard configuration
| `uid` | string | **Yes** | | Unique public dashboard identifier |
| `accessToken` | string | No | | Unique public access token |
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/developers/kinds/core/serviceaccount/schema-reference.md b/docs/sources/developers/kinds/core/serviceaccount/schema-reference.md
index 4d220d5513e..dd9a9942187 100644
--- a/docs/sources/developers/kinds/core/serviceaccount/schema-reference.md
+++ b/docs/sources/developers/kinds/core/serviceaccount/schema-reference.md
@@ -13,6 +13,57 @@ title: ServiceAccount kind
system account
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|-----------------|--------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `avatarUrl` | string | **Yes** | | AvatarUrl is the service account's avatar URL. It allows the frontend to display a picture in front
of the service account. |
@@ -24,8 +75,36 @@ system account
| `role` | string | **Yes** | | OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.
Possible values are: `Admin`, `Editor`, `Viewer`. |
| `tokens` | integer | **Yes** | | Tokens is the number of active tokens for the service account.
Tokens are used to authenticate the service account against Grafana. |
| `accessControl` | map[string]boolean | No | | AccessControl metadata associated with a given resource. |
-| `created` | string | No | | Created indicates when the service account was created. |
| `teams` | string[] | No | | Teams is a list of teams the service account belongs to. |
-| `updated` | string | No | | Updated indicates when the service account was updated. |
+
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
diff --git a/docs/sources/developers/kinds/core/team/schema-reference.md b/docs/sources/developers/kinds/core/team/schema-reference.md
index 85543c78700..8950ac81b88 100644
--- a/docs/sources/developers/kinds/core/team/schema-reference.md
+++ b/docs/sources/developers/kinds/core/team/schema-reference.md
@@ -13,16 +13,95 @@ title: Team kind
A team is a named grouping of Grafana users to which access control rules may be assigned.
+| Property | Type | Required | Default | Description |
+|------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. |
+| `spec` | [object](#spec) | **Yes** | | |
+| `status` | [object](#status) | **Yes** | | |
+
+### Metadata
+
+metadata contains embedded CommonMetadata and can be extended with custom string fields
+TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
+without external reference as using the CommonMetadata reference breaks thema codegen.
+
+It extends [_kubeObjectMetadata](#_kubeobjectmetadata).
+
+| Property | Type | Required | Default | Description |
+|---------------------|------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
+| `createdBy` | string | **Yes** | | |
+| `creationTimestamp` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `extraFields` | [object](#extrafields) | **Yes** | | extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata |
+| `finalizers` | string[] | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `labels` | map[string]string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `resourceVersion` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `uid` | string | **Yes** | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+| `updateTimestamp` | string | **Yes** | | |
+| `updatedBy` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | *(Inherited from [_kubeObjectMetadata](#_kubeobjectmetadata))* |
+
+### _kubeObjectMetadata
+
+_kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+As it is also intended to be generic enough to function with any API Server.
+
+| Property | Type | Required | Default | Description |
+|---------------------|-------------------|----------|---------|-------------|
+| `creationTimestamp` | string | **Yes** | | |
+| `finalizers` | string[] | **Yes** | | |
+| `labels` | map[string]string | **Yes** | | |
+| `resourceVersion` | string | **Yes** | | |
+| `uid` | string | **Yes** | | |
+| `deletionTimestamp` | string | No | | |
+
+### ExtraFields
+
+extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### Spec
+
| Property | Type | Required | Default | Description |
|-----------------|--------------------|----------|---------|----------------------------------------------------------|
-| `created` | string | **Yes** | | Created indicates when the team was created. |
| `memberCount` | integer | **Yes** | | MemberCount is the number of the team members. |
| `name` | string | **Yes** | | Name of the team. |
| `orgId` | integer | **Yes** | | OrgId is the ID of an organisation the team belongs to. |
| `permission` | integer | **Yes** | | Possible values are: `0`, `1`, `2`, `4`. |
-| `updated` | string | **Yes** | | Updated indicates when the team was updated. |
| `accessControl` | map[string]boolean | No | | AccessControl metadata associated with a given resource. |
| `avatarUrl` | string | No | | AvatarUrl is the team's avatar URL. |
| `email` | string | No | | Email of the team. |
+### Status
+
+| Property | Type | Required | Default | Description |
+|--------------------|----------------------------------------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `additionalFields` | [object](#additionalfields) | **Yes** | | additionalFields is reserved for future use |
+| `operatorStates` | map[string][joinSchema.status.#OperatorState](#joinschema.status.#operatorstate) | No | | operatorStates is a map of operator ID to operator state evaluations.
Any operator which consumes this kind SHOULD add its state evaluation information to this field. |
+
+### AdditionalFields
+
+additionalFields is reserved for future use
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
+### JoinSchema.Status.#OperatorState
+
+| Property | Type | Required | Default | Description |
+|--------------------|--------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `lastEvaluation` | string | **Yes** | | lastEvaluation is the ResourceVersion last evaluated |
+| `state` | string | **Yes** | | state describes the state of the lastEvaluation.
It is limited to three possible states for machine evaluation.
Possible values are: `success`, `in_progress`, `failed`. |
+| `descriptiveState` | string | No | | descriptiveState is an optional more descriptive state field which has no requirements on format |
+| `details` | [object](#details) | No | | details contains any extra information that is operator-specific |
+
+### Details
+
+details contains any extra information that is operator-specific
+
+| Property | Type | Required | Default | Description |
+|----------|------|----------|---------|-------------|
+
diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
index 92915e4f6ac..bc03c5b2b41 100644
--- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
+++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
@@ -61,8 +61,6 @@ Some stable features are enabled by default. You can disable a stable feature by
| `renderAuthJWT` | Uses JWT-based auth for rendering instead of relying on remote cache |
| `enableElasticsearchBackendQuerying` | Enable the processing of queries and responses in the Elasticsearch data source through backend |
| `enableDatagridEditing` | Enables the edit functionality in the datagrid panel |
-| `publicDashboards` | Enables public access to dashboards |
-| `publicDashboardsEmailSharing` | Enables public dashboard sharing to be restricted to only allowed emails |
## Alpha feature toggles
@@ -73,6 +71,8 @@ Alpha features might be changed or removed without prior notice.
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `live-service-web-worker` | This will use a webworker thread to processes events rather than the main thread |
| `queryOverLive` | Use Grafana Live WebSocket to execute backend queries |
+| `publicDashboards` | Enables public access to dashboards |
+| `publicDashboardsEmailSharing` | Enables public dashboard sharing to be restricted to only allowed emails |
| `lokiLive` | Support WebSocket streaming for loki (early prototype) |
| `storage` | Configurable storage for dashboards, datasources, and resources |
| `newTraceViewHeader` | Shows the new trace view header |
diff --git a/go.mod b/go.mod
index 043f4e97785..108e86c82bd 100644
--- a/go.mod
+++ b/go.mod
@@ -22,10 +22,7 @@ replace github.com/deepmap/oapi-codegen => github.com/spinillos/oapi-codegen v1.
// hoist a replace statement.
replace k8s.io/client-go => k8s.io/client-go v0.25.3
-require (
- k8s.io/apiextensions-apiserver v0.26.2 // indirect
- k8s.io/apimachinery v0.26.2
-)
+require k8s.io/apimachinery v0.26.2
require (
cloud.google.com/go/storage v1.28.1
@@ -266,7 +263,7 @@ require (
github.com/grafana/dataplane/examples v0.0.0-20230404174214-4d6fd58a18ad
github.com/grafana/dataplane/sdata v0.0.6
github.com/grafana/go-mssqldb v0.9.1
- github.com/grafana/kindsys v0.0.0-20230414093523-5df3e256ebc0
+ github.com/grafana/kindsys v0.0.0-20230427152021-bb328815be7a
github.com/grafana/thema v0.0.0-20230417103609-99b482c479fe
github.com/redis/go-redis/v9 v9.0.2
github.com/weaveworks/common v0.0.0-20230208133027-16871410fca4
@@ -297,8 +294,10 @@ require (
github.com/drone/drone-go v1.7.1 // indirect
github.com/drone/envsubst v1.0.3 // indirect
github.com/drone/runner-go v1.12.0 // indirect
+ github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/envoyproxy/go-control-plane v0.10.3 // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.13 // indirect
+ github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
@@ -337,11 +336,8 @@ require (
go.opentelemetry.io/otel/metric v0.37.0 // indirect
go.starlark.net v0.0.0-20221020143700-22309ac47eac // indirect
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
- gopkg.in/inf.v0 v0.9.1 // indirect
- k8s.io/klog/v2 v2.80.1 // indirect
+ k8s.io/api v0.26.2 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
- sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
- sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
require (
diff --git a/go.sum b/go.sum
index d5b00783ff0..ac6805e8220 100644
--- a/go.sum
+++ b/go.sum
@@ -739,10 +739,10 @@ github.com/elazarl/goproxy v0.0.0-20220115173737-adb46da277ac/go.mod h1:Ro8st/El
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
github.com/elazarl/goproxy/ext v0.0.0-20220115173737-adb46da277ac h1:9yrT5tmn9Zc0ytWPASlaPwQfQMQYnRf0RSDe1XvHw0Q=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
-github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE=
+github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/emicklei/proto v1.10.0 h1:pDGyFRVV5RvV+nkBK9iy3q67FBy9Xa7vwrOTE+g5aGw=
github.com/emicklei/proto v1.10.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
@@ -786,6 +786,7 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
+github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
@@ -1268,8 +1269,6 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/grafana/alerting v0.0.0-20230418161049-5f374e58cb32 h1:LdPoVBj+CA5oHLeUejDzqy8/c4Fa0UfTtCcOHka0Jws=
-github.com/grafana/alerting v0.0.0-20230418161049-5f374e58cb32/go.mod h1:nHfrSTdV7/l74N5/ezqlQ+JwSvIChhN3G5+PjCfwG/E=
github.com/grafana/alerting v0.0.0-20230426173942-011a41e1fbe2 h1:teRmmE08bSnvyh3e+adfv/6RA1ZZdhTCmNL9Ckfm1Rk=
github.com/grafana/alerting v0.0.0-20230426173942-011a41e1fbe2/go.mod h1:nHfrSTdV7/l74N5/ezqlQ+JwSvIChhN3G5+PjCfwG/E=
github.com/grafana/codejen v0.0.3 h1:tAWxoTUuhgmEqxJPOLtJoxlPBbMULFwKFOcRsPRPXDw=
@@ -1296,8 +1295,8 @@ github.com/grafana/grafana-plugin-sdk-go v0.94.0/go.mod h1:3VXz4nCv6wH5SfgB3mlW3
github.com/grafana/grafana-plugin-sdk-go v0.114.0/go.mod h1:D7x3ah+1d4phNXpbnOaxa/osSaZlwh9/ZUnGGzegRbk=
github.com/grafana/grafana-plugin-sdk-go v0.159.0 h1:tjqzTe/wz+1zzaeHpOJvBvSvZFx/bJUSHj6WA8HJqhE=
github.com/grafana/grafana-plugin-sdk-go v0.159.0/go.mod h1:7/F3lL/w3MGuZTwu0jam5oL/4zNOQmhs2k8WZ9VlzhI=
-github.com/grafana/kindsys v0.0.0-20230414093523-5df3e256ebc0 h1:Or8DllkxKq3+kLXAS/tkr5K2Yv745c6K2rRvslGWGd4=
-github.com/grafana/kindsys v0.0.0-20230414093523-5df3e256ebc0/go.mod h1:GNcfpy5+SY6RVbNGQW264gC0r336Dm+0zgQ5vt6+M8Y=
+github.com/grafana/kindsys v0.0.0-20230427152021-bb328815be7a h1:i2YhC6eTyDp+7Ftv5c6VZDUQskmKX4oIPGf38qfiZiU=
+github.com/grafana/kindsys v0.0.0-20230427152021-bb328815be7a/go.mod h1:GNcfpy5+SY6RVbNGQW264gC0r336Dm+0zgQ5vt6+M8Y=
github.com/grafana/phlare/api v0.1.4-0.20230426005640-f90edba05413 h1:bBzCezZNRyYlJpXTkyZdY4fpPxHZUdyeyRWzhtw/P6I=
github.com/grafana/phlare/api v0.1.4-0.20230426005640-f90edba05413/go.mod h1:IvwuGG9xa/h96UH/exgvsfy3zE+ZpctkNT9o5aaGdrU=
github.com/grafana/prometheus-alertmanager v0.25.1-0.20230308154952-78fedf89728b h1:VQOGGGJ2lKcVPANyzIESKYhSeA0QIvUQwfA3CbrkDfA=
@@ -1642,15 +1641,8 @@ github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W
github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc=
github.com/lestrrat-go/jwx v1.2.25/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
-github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
-github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/linkedin/goavro/v2 v2.10.0 h1:eTBIRoInBM88gITGXYtUSqqxLTFXfOsJBiX8ZMW0o4U=
@@ -2935,6 +2927,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -3271,8 +3264,7 @@ k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s=
k8s.io/api v0.22.4/go.mod h1:Rgs+9gIGYC5laXQSZZ9JqT5NevNgoGiOdVWi1BAB3qk=
k8s.io/api v0.25.3/go.mod h1:o42gKscFrEVjHdQnyRenACrMtbuJsVdP+WVjqejfzmI=
k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ=
-k8s.io/apiextensions-apiserver v0.26.2 h1:/yTG2B9jGY2Q70iGskMf41qTLhL9XeNN2KhI0uDgwko=
-k8s.io/apiextensions-apiserver v0.26.2/go.mod h1:Y7UPgch8nph8mGCuVk0SK83LnS8Esf3n6fUBgew8SH8=
+k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU=
k8s.io/apimachinery v0.0.0-20190809020650-423f5d784010/go.mod h1:Waf/xTS2FGRrgXCkO5FP3XxTOWh0qLf2QhL1qFZZ/R8=
k8s.io/apimachinery v0.17.5/go.mod h1:ioIo1G/a+uONV7Tv+ZmCbMG1/a3kVw5YcDdncd8ugQ0=
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
@@ -3302,6 +3294,7 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUc
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
+k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
@@ -3311,7 +3304,6 @@ k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
k8s.io/klog/v2 v2.20.0/go.mod h1:Gm8eSIfQN6457haJuPaMxZw4wyP5k+ykPFlrhQDvhvw=
k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
-k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4=
k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6/go.mod h1:RZvgC8MSN6DjiMV6oIfEE9pDL9CYXokkfaCKZeHm3nc=
k8s.io/kube-openapi v0.0.0-20200316234421-82d701f24f9d/go.mod h1:F+5wygcW0wmRTnM3cOgIqGivxkwSWIWT5YdsDbeAOaU=
@@ -3337,6 +3329,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyz
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
+sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e h1:4Z09Hglb792X0kfOBBJUPFEyvVfQWrYT/l8h5EKA6JQ=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/structured-merge-diff/v2 v2.0.1/go.mod h1:Wb7vfKAodbKgf6tn1Kl0VvGj7mRH6DGaRcixXEJXTsE=
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
diff --git a/kinds/dashboard/dashboard_kind.cue b/kinds/dashboard/dashboard_kind.cue
index 65349ace538..6711c0deb61 100644
--- a/kinds/dashboard/dashboard_kind.cue
+++ b/kinds/dashboard/dashboard_kind.cue
@@ -16,91 +16,83 @@ lineage: seqs: [
schemas: [
// 0.0
{
- @grafana(TSVeneer="type")
-
- // Unique numeric identifier for the dashboard.
- // TODO must isolate or remove identifiers local to a Grafana instance...?
- id?: int64
- // Unique dashboard identifier that can be generated by anyone. string (8-40)
- uid?: string
- // Title of dashboard.
- title?: string
- // Description of dashboard.
- description?: string
- // This property should only be used in dashboards defined by plugins. It is a quick check
- // to see if the version has changed since the last time. Unclear why using the version property
- // is insufficient.
- revision?: int64 @grafanamaturity(NeedsExpertReview)
- // For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
- gnetId?: string @grafanamaturity(NeedsExpertReview)
- // Tags associated with dashboard.
- tags?: [...string] @grafanamaturity(NeedsExpertReview)
- // Theme of dashboard.
- style: "light" | *"dark" @grafanamaturity(NeedsExpertReview)
- // Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
- timezone?: string | *"browser"
- // Whether a dashboard is editable or not.
- editable: bool | *true
- // Configuration of dashboard cursor sync behavior.
- graphTooltip: #DashboardCursorSync
- // Time range for dashboard, e.g. last 6 hours, last 7 days, etc
- time?: {
- from: string | *"now-6h"
- to: string | *"now"
- } @grafanamaturity(NeedsExpertReview)
+ spec: {
+ // Unique numeric identifier for the dashboard.
+ // TODO must isolate or remove identifiers local to a Grafana instance...?
+ id?: int64
+ // Unique dashboard identifier that can be generated by anyone. string (8-40)
+ uid?: string
+ // Title of dashboard.
+ title?: string
+ // Description of dashboard.
+ description?: string
+ // This property should only be used in dashboards defined by plugins. It is a quick check
+ // to see if the version has changed since the last time. Unclear why using the version property
+ // is insufficient.
+ revision?: int64 @grafanamaturity(NeedsExpertReview)
+ // For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
+ gnetId?: string @grafanamaturity(NeedsExpertReview)
+ // Tags associated with dashboard.
+ tags?: [...string] @grafanamaturity(NeedsExpertReview)
+ // Theme of dashboard.
+ style: "light" | *"dark" @grafanamaturity(NeedsExpertReview)
+ // Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
+ timezone?: string | *"browser"
+ // Whether a dashboard is editable or not.
+ editable: bool | *true
+ // Configuration of dashboard cursor sync behavior.
+ graphTooltip: #DashboardCursorSync
+ // Time range for dashboard, e.g. last 6 hours, last 7 days, etc
+ time?: {
+ from: string | *"now-6h"
+ to: string | *"now"
+ } @grafanamaturity(NeedsExpertReview)
- // TODO docs
- // TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
- timepicker?: {
- // Whether timepicker is collapsed or not.
- collapse: bool | *false
- // Whether timepicker is enabled or not.
- enable: bool | *true
- // Whether timepicker is visible or not.
- hidden: bool | *false
- // Selectable intervals for auto-refresh.
- refresh_intervals: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
// TODO docs
- time_options: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
- } @grafanamaturity(NeedsExpertReview)
- // The month that the fiscal year starts on. 0 = January, 11 = December
- fiscalYearStartMonth?: uint8 & <12 | *0
- // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
- // This will keep data "moving left" regardless of the query refresh rate. This setting helps
- // avoid dashboards presenting stale live data
- liveNow?: bool @grafanamaturity(NeedsExpertReview)
- // TODO docs
- weekStart?: string @grafanamaturity(NeedsExpertReview)
-
- // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
- refresh?: string | false
- // Version of the JSON schema, incremented each time a Grafana update brings
- // changes to said schema.
- // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
- schemaVersion: uint16 | *36
- // Version of the dashboard, incremented each time the dashboard is updated.
- version?: uint32 @grafanamaturity(NeedsExpertReview)
- panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)
- // TODO docs
- templating?: {
- list?: [...#VariableModel] @grafanamaturity(NeedsExpertReview)
- }
-
- // TODO -- should not be a public interface on its own, but required for Veneer
- #AnnotationContainer: {
- // annoying... but required so that the list is defined using the nested Veneer
- @grafana(TSVeneer="type")
-
- list?: [...#AnnotationQuery] @grafanamaturity(NeedsExpertReview)
- } @cuetsy(kind="interface")
+ // TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
+ timepicker?: {
+ // Whether timepicker is collapsed or not.
+ collapse: bool | *false
+ // Whether timepicker is enabled or not.
+ enable: bool | *true
+ // Whether timepicker is visible or not.
+ hidden: bool | *false
+ // Selectable intervals for auto-refresh.
+ refresh_intervals: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
+ // TODO docs
+ time_options: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
+ } @grafanamaturity(NeedsExpertReview)
+ // The month that the fiscal year starts on. 0 = January, 11 = December
+ fiscalYearStartMonth?: uint8 & <12 | *0
+ // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
+ // This will keep data "moving left" regardless of the query refresh rate. This setting helps
+ // avoid dashboards presenting stale live data
+ liveNow?: bool @grafanamaturity(NeedsExpertReview)
+ // TODO docs
+ weekStart?: string @grafanamaturity(NeedsExpertReview)
+
+ // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
+ refresh?: string | false
+ // Version of the JSON schema, incremented each time a Grafana update brings
+ // changes to said schema.
+ // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
+ schemaVersion: uint16 | *36
+ // Version of the dashboard, incremented each time the dashboard is updated.
+ version?: uint32 @grafanamaturity(NeedsExpertReview)
+ panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)
+ // TODO docs
+ templating?: {
+ list?: [...#VariableModel] @grafanamaturity(NeedsExpertReview)
+ }
- // TODO docs
- annotations?: #AnnotationContainer
+ // TODO docs
+ annotations?: #AnnotationContainer
- // TODO docs
- links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
+ // TODO docs
+ links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
- snapshot?: #Snapshot @grafanamaturity(NeedsExpertReview)
+ snapshot?: #Snapshot @grafanamaturity(NeedsExpertReview)
+ } @cuetsy(kind="interface") @grafana(TSVeneer="type")
///////////////////////////////////////
// Definitions (referenced above) are declared below
@@ -131,6 +123,14 @@ lineage: seqs: [
ids: [...uint8]
} @cuetsy(kind="interface")
+ // TODO -- should not be a public interface on its own, but required for Veneer
+ #AnnotationContainer: {
+ // annoying... but required so that the list is defined using the nested Veneer
+ @grafana(TSVeneer="type")
+
+ list?: [...#AnnotationQuery] @grafanamaturity(NeedsExpertReview)
+ } @cuetsy(kind="interface")
+
// TODO docs
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
#AnnotationQuery: {
diff --git a/kinds/gen.go b/kinds/gen.go
index ade2ff9fc01..00225af2b31 100644
--- a/kinds/gen.go
+++ b/kinds/gen.go
@@ -38,10 +38,14 @@ func main() {
// All the jennies that comprise the core kinds generator pipeline
coreKindsGen.Append(
- codegen.LatestJenny(cuectx.GoCoreKindParentPath, codegen.GoTypesJenny{}),
+ &codegen.ResourceGoTypesJenny{},
+ &codegen.SubresourceGoTypesJenny{},
codegen.CoreKindJenny(cuectx.GoCoreKindParentPath, nil),
codegen.BaseCoreRegistryJenny(filepath.Join("pkg", "registry", "corekind"), cuectx.GoCoreKindParentPath),
- codegen.LatestMajorsOrXJenny(cuectx.TSCoreKindParentPath, codegen.TSTypesJenny{}),
+ codegen.LatestMajorsOrXJenny(
+ cuectx.TSCoreKindParentPath,
+ true, // forcing group so that we ignore the top level resource (for now)
+ codegen.TSResourceJenny{}),
codegen.TSVeneerIndexJenny(filepath.Join("packages", "grafana-schema", "src")),
codegen.DocsJenny(filepath.Join("docs", "sources", "developers", "kinds", "core")),
)
diff --git a/kinds/librarypanel/librarypanel_kind.cue b/kinds/librarypanel/librarypanel_kind.cue
index 82870b812d3..3b7b187a9df 100644
--- a/kinds/librarypanel/librarypanel_kind.cue
+++ b/kinds/librarypanel/librarypanel_kind.cue
@@ -14,35 +14,35 @@ lineage: seqs: [
schemas: [
// 0.0
{
- @grafana(TSVeneer="type")
+ spec: {
+ // Folder UID
+ folderUid?: string @grafanamaturity(ToMetadata="sys")
- // Folder UID
- folderUid?: string @grafanamaturity(ToMetadata="sys")
+ // Library element UID
+ uid: string
- // Library element UID
- uid: string
+ // Panel name (also saved in the model)
+ name: string & strings.MinRunes(1)
- // Panel name (also saved in the model)
- name: string & strings.MinRunes(1)
+ // Panel description
+ description?: string
- // Panel description
- description?: string
+ // The panel type (from inside the model)
+ type: string & strings.MinRunes(1)
- // The panel type (from inside the model)
- type: string & strings.MinRunes(1)
+ // Dashboard version when this was saved (zero if unknown)
+ schemaVersion?: uint16
- // Dashboard version when this was saved (zero if unknown)
- schemaVersion?: uint16
+ // panel version, incremented each time the dashboard is updated.
+ version: int64 @grafanamaturity(NeedsExpertReview)
- // panel version, incremented each time the dashboard is updated.
- version: int64 @grafanamaturity(NeedsExpertReview)
+ // TODO: should be the same panel schema defined in dashboard
+ // Typescript: Omit;
+ model: {...}
- // TODO: should be the same panel schema defined in dashboard
- // Typescript: Omit;
- model: {...}
-
- // Object storage metadata
- meta?: #LibraryElementDTOMeta @grafanamaturity(ToMetadata="sys")
+ // Object storage metadata
+ meta?: #LibraryElementDTOMeta @grafanamaturity(ToMetadata="sys")
+ } @cuetsy(kind="interface") @grafana(TSVeneer="type")
#LibraryElementDTOMetaUser: {
id: int64
diff --git a/kinds/playlist/playlist_kind.cue b/kinds/playlist/playlist_kind.cue
index 0bf700d3a66..6200ca52149 100644
--- a/kinds/playlist/playlist_kind.cue
+++ b/kinds/playlist/playlist_kind.cue
@@ -9,20 +9,22 @@ lineage: seqs: [
schemas: [
//0.0
{
- // Unique playlist identifier. Generated on creation, either by the
- // creator of the playlist of by the application.
- uid: string
+ spec: {
+ // Unique playlist identifier. Generated on creation, either by the
+ // creator of the playlist of by the application.
+ uid: string
- // Name of the playlist.
- name: string
+ // Name of the playlist.
+ name: string
- // Interval sets the time between switching views in a playlist.
- // FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
- interval: string | *"5m"
+ // Interval sets the time between switching views in a playlist.
+ // FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
+ interval: string | *"5m"
- // The ordered list of items that the playlist will iterate over.
- // FIXME! This should not be optional, but changing it makes the godegen awkward
- items?: [...#PlaylistItem]
+ // The ordered list of items that the playlist will iterate over.
+ // FIXME! This should not be optional, but changing it makes the godegen awkward
+ items?: [...#PlaylistItem]
+ } @cuetsy(kind="interface")
///////////////////////////////////////
// Definitions (referenced above) are declared below
diff --git a/kinds/preferences/preferences_kind.cue b/kinds/preferences/preferences_kind.cue
index 1e140035e66..2ab47fa6559 100644
--- a/kinds/preferences/preferences_kind.cue
+++ b/kinds/preferences/preferences_kind.cue
@@ -8,29 +8,31 @@ lineage: seqs: [
{
schemas: [
{
- // UID for the home dashboard
- homeDashboardUID?: string
+ spec: {
+ // UID for the home dashboard
+ homeDashboardUID?: string
- // The timezone selection
- // TODO: this should use the timezone defined in common
- timezone?: string
+ // The timezone selection
+ // TODO: this should use the timezone defined in common
+ timezone?: string
- // day of the week (sunday, monday, etc)
- weekStart?: string
+ // day of the week (sunday, monday, etc)
+ weekStart?: string
- // light, dark, empty is default
- theme?: string
+ // light, dark, empty is default
+ theme?: string
- // Selected language (beta)
- language?: string
+ // Selected language (beta)
+ language?: string
- // Explore query history preferences
- queryHistory?: #QueryHistoryPreference
+ // Explore query history preferences
+ queryHistory?: #QueryHistoryPreference
+ } @cuetsy(kind="interface")
#QueryHistoryPreference: {
- // one of: '' | 'query' | 'starred';
- homeTab?: string
- } @cuetsy(kind="interface") //0.0
+ // one of: '' | 'query' | 'starred';
+ homeTab?: string
+ } @cuetsy(kind="interface")
},
]
},
diff --git a/kinds/publicdashboard/public_dashboard_kind.cue b/kinds/publicdashboard/public_dashboard_kind.cue
index 71f2494fc46..b78295fdb29 100644
--- a/kinds/publicdashboard/public_dashboard_kind.cue
+++ b/kinds/publicdashboard/public_dashboard_kind.cue
@@ -9,18 +9,20 @@ lineage: seqs: [
schemas: [
// 0.0
{
- // Unique public dashboard identifier
- uid: string
- // Dashboard unique identifier referenced by this public dashboard
- dashboardUid: string
- // Unique public access token
- accessToken?: string
- // Flag that indicates if the public dashboard is enabled
- isEnabled: bool
- // Flag that indicates if annotations are enabled
- annotationsEnabled: bool
- // Flag that indicates if the time range picker is enabled
- timeSelectionEnabled: bool
+ spec: {
+ // Unique public dashboard identifier
+ uid: string
+ // Dashboard unique identifier referenced by this public dashboard
+ dashboardUid: string
+ // Unique public access token
+ accessToken?: string
+ // Flag that indicates if the public dashboard is enabled
+ isEnabled: bool
+ // Flag that indicates if annotations are enabled
+ annotationsEnabled: bool
+ // Flag that indicates if the time range picker is enabled
+ timeSelectionEnabled: bool
+ } @cuetsy(kind="interface")
},
]
},
diff --git a/kinds/serviceaccount/serviceaccount_kind.cue b/kinds/serviceaccount/serviceaccount_kind.cue
index 27f54a17db7..ff2ac9682ce 100644
--- a/kinds/serviceaccount/serviceaccount_kind.cue
+++ b/kinds/serviceaccount/serviceaccount_kind.cue
@@ -1,7 +1,5 @@
package kind
-import "time"
-
name: "ServiceAccount"
maturity: "merged"
description: "system account"
@@ -11,35 +9,33 @@ lineage: seqs: [
schemas: [
// v0.0
{
- // ID is the unique identifier of the service account in the database.
- id: int64 @grafanamaturity(ToMetadata="sys")
- // OrgId is the ID of an organisation the service account belongs to.
- orgId: int64 @grafanamaturity(ToMetadata="sys")
- // Name of the service account.
- name: string
- // Login of the service account.
- login: string
- // IsDisabled indicates if the service account is disabled.
- isDisabled: bool
- // Role is the Grafana organization role of the service account which can be 'Viewer', 'Editor', 'Admin'.
- role: #OrgRole @grafanamaturity(ToMetadata="kind")
- // Tokens is the number of active tokens for the service account.
- // Tokens are used to authenticate the service account against Grafana.
- tokens: int64 @grafanamaturity(ToMetadata="kind")
- // AvatarUrl is the service account's avatar URL. It allows the frontend to display a picture in front
- // of the service account.
- avatarUrl: string @grafanamaturity(ToMetadata="kind")
- // AccessControl metadata associated with a given resource.
- accessControl?: {
- [string]: bool @grafanamaturity(ToMetadata="sys")
- }
+ spec: {
+ // ID is the unique identifier of the service account in the database.
+ id: int64 @grafanamaturity(ToMetadata="sys")
+ // OrgId is the ID of an organisation the service account belongs to.
+ orgId: int64 @grafanamaturity(ToMetadata="sys")
+ // Name of the service account.
+ name: string
+ // Login of the service account.
+ login: string
+ // IsDisabled indicates if the service account is disabled.
+ isDisabled: bool
+ // Role is the Grafana organization role of the service account which can be 'Viewer', 'Editor', 'Admin'.
+ role: #OrgRole @grafanamaturity(ToMetadata="kind")
+ // Tokens is the number of active tokens for the service account.
+ // Tokens are used to authenticate the service account against Grafana.
+ tokens: int64 @grafanamaturity(ToMetadata="kind")
+ // AvatarUrl is the service account's avatar URL. It allows the frontend to display a picture in front
+ // of the service account.
+ avatarUrl: string @grafanamaturity(ToMetadata="kind")
+ // AccessControl metadata associated with a given resource.
+ accessControl?: {
+ [string]: bool @grafanamaturity(ToMetadata="sys")
+ }
- // Teams is a list of teams the service account belongs to.
- teams?: [...string] @grafanamaturity(ToMetadata="sys")
- // Created indicates when the service account was created.
- created?: string & time.Time
- // Updated indicates when the service account was updated.
- updated?: string & time.Time
+ // Teams is a list of teams the service account belongs to.
+ teams?: [...string] @grafanamaturity(ToMetadata="sys")
+ } @cuetsy(kind="interface")
// OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.
#OrgRole: "Admin" | "Editor" | "Viewer" @cuetsy(kind="type")
diff --git a/kinds/team/team_kind.cue b/kinds/team/team_kind.cue
index 58d285fa93c..d692dac8173 100644
--- a/kinds/team/team_kind.cue
+++ b/kinds/team/team_kind.cue
@@ -1,7 +1,5 @@
package kind
-import "time"
-
name: "Team"
maturity: "merged"
description: "A team is a named grouping of Grafana users to which access control rules may be assigned."
@@ -11,26 +9,24 @@ lineage: seqs: [
schemas: [
// v0.0
{
- // OrgId is the ID of an organisation the team belongs to.
- orgId: int64 @grafanamaturity(ToMetadata="sys")
- // Name of the team.
- name: string
- // Email of the team.
- email?: string
- // AvatarUrl is the team's avatar URL.
- avatarUrl?: string @grafanamaturity(MaybeRemove)
- // MemberCount is the number of the team members.
- memberCount: int64 @grafanamaturity(ToMetadata="kind")
- // TODO - it seems it's a team_member.permission, unlikely it should belong to the team kind
- permission: #Permission @grafanamaturity(ToMetadata="kind", MaybeRemove)
- // AccessControl metadata associated with a given resource.
- accessControl?: {
- [string]: bool @grafanamaturity(ToMetadata="sys")
- }
- // Created indicates when the team was created.
- created: string & time.Time
- // Updated indicates when the team was updated.
- updated: string & time.Time
+ spec: {
+ // OrgId is the ID of an organisation the team belongs to.
+ orgId: int64 @grafanamaturity(ToMetadata="sys")
+ // Name of the team.
+ name: string
+ // Email of the team.
+ email?: string
+ // AvatarUrl is the team's avatar URL.
+ avatarUrl?: string @grafanamaturity(MaybeRemove)
+ // MemberCount is the number of the team members.
+ memberCount: int64 @grafanamaturity(ToMetadata="kind")
+ // TODO - it seems it's a team_member.permission, unlikely it should belong to the team kind
+ permission: #Permission @grafanamaturity(ToMetadata="kind", MaybeRemove)
+ // AccessControl metadata associated with a given resource.
+ accessControl?: {
+ [string]: bool @grafanamaturity(ToMetadata="sys")
+ }
+ } @cuetsy(kind="interface")
#Permission: 0 | 1 | 2 | 4 @cuetsy(kind="enum",memberNames="Member|Viewer|Editor|Admin")
},
diff --git a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts
index 32b7b5d1bf2..144f939eee2 100644
--- a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts
+++ b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts
@@ -3,22 +3,11 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
-/**
- * TODO -- should not be a public interface on its own, but required for Veneer
- */
-export interface AnnotationContainer {
- list?: Array;
-}
-
-export const defaultAnnotationContainer: Partial = {
- list: [],
-};
-
/**
* TODO: this should be a regular DataQuery that depends on the selected dashboard
* these match the properties of the "grafana" datasouce that is default in most dashboards
@@ -66,6 +55,17 @@ export const defaultAnnotationPanelFilter: Partial = {
ids: [],
};
+/**
+ * TODO -- should not be a public interface on its own, but required for Veneer
+ */
+export interface AnnotationContainer {
+ list?: Array;
+}
+
+export const defaultAnnotationContainer: Partial = {
+ list: [],
+};
+
/**
* TODO docs
* FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
diff --git a/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts b/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts
index 97cba2a5c5e..d3b967e7a76 100644
--- a/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts
+++ b/packages/grafana-schema/src/raw/librarypanel/x/librarypanel_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
diff --git a/packages/grafana-schema/src/raw/playlist/x/playlist_types.gen.ts b/packages/grafana-schema/src/raw/playlist/x/playlist_types.gen.ts
index 03c1c69cce7..4f98abe19bf 100644
--- a/packages/grafana-schema/src/raw/playlist/x/playlist_types.gen.ts
+++ b/packages/grafana-schema/src/raw/playlist/x/playlist_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
diff --git a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts
index 06f775ad878..8921226ac94 100644
--- a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts
+++ b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -13,7 +13,7 @@ export interface QueryHistoryPreference {
* one of: '' | 'query' | 'starred';
*/
homeTab?: string;
-} // 0.0
+}
export interface Preferences {
/**
diff --git a/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts b/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts
index b94e4baefe3..9a1ae8596fd 100644
--- a/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts
+++ b/packages/grafana-schema/src/raw/publicdashboard/x/publicdashboard_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
diff --git a/packages/grafana-schema/src/raw/serviceaccount/x/serviceaccount_types.gen.ts b/packages/grafana-schema/src/raw/serviceaccount/x/serviceaccount_types.gen.ts
index d2713bf993d..0f93321ec0d 100644
--- a/packages/grafana-schema/src/raw/serviceaccount/x/serviceaccount_types.gen.ts
+++ b/packages/grafana-schema/src/raw/serviceaccount/x/serviceaccount_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -23,10 +23,6 @@ export interface ServiceAccount {
* of the service account.
*/
avatarUrl: string;
- /**
- * Created indicates when the service account was created.
- */
- created?: string;
/**
* ID is the unique identifier of the service account in the database.
*/
@@ -60,10 +56,6 @@ export interface ServiceAccount {
* Tokens are used to authenticate the service account against Grafana.
*/
tokens: number;
- /**
- * Updated indicates when the service account was updated.
- */
- updated?: string;
}
export const defaultServiceAccount: Partial = {
diff --git a/packages/grafana-schema/src/raw/team/x/team_types.gen.ts b/packages/grafana-schema/src/raw/team/x/team_types.gen.ts
index 3482c0c758c..938d69c4455 100644
--- a/packages/grafana-schema/src/raw/team/x/team_types.gen.ts
+++ b/packages/grafana-schema/src/raw/team/x/team_types.gen.ts
@@ -3,7 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// TSTypesJenny
+// TSResourceJenny
// LatestMajorsOrXJenny
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -24,10 +24,6 @@ export interface Team {
* AvatarUrl is the team's avatar URL.
*/
avatarUrl?: string;
- /**
- * Created indicates when the team was created.
- */
- created: string;
/**
* Email of the team.
*/
@@ -48,8 +44,4 @@ export interface Team {
* TODO - it seems it's a team_member.permission, unlikely it should belong to the team kind
*/
permission: Permission;
- /**
- * Updated indicates when the team was updated.
- */
- updated: string;
}
diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go
index b019c18fca6..466c2ce2409 100644
--- a/pkg/api/dashboard.go
+++ b/pkg/api/dashboard.go
@@ -840,7 +840,10 @@ func (hs *HTTPServer) ValidateDashboard(c *contextmodel.ReqContext) response.Res
// work), or if schemaVersion is absent (which will happen once the Thema
// schema becomes canonical).
if err != nil || schemaVersion >= dashboard.HandoffSchemaVersion {
- _, _, validationErr := dk.JSONValueMux(dashboardBytes)
+ // Schemas expect the dashboard to live in the spec field
+ k8sResource := `{"spec": ` + cmd.Dashboard + "}"
+
+ _, _, validationErr := dk.JSONValueMux([]byte(k8sResource))
if validationErr == nil {
isValid = true
diff --git a/pkg/api/preferences.go b/pkg/api/preferences.go
index 12bbc50f3f1..f4808ec4636 100644
--- a/pkg/api/preferences.go
+++ b/pkg/api/preferences.go
@@ -85,7 +85,7 @@ func (hs *HTTPServer) getPreferencesFor(ctx context.Context, orgID, userID, team
}
}
- dto := preferences.Preferences{}
+ dto := preferences.Spec{}
if preference.WeekStart != nil && *preference.WeekStart != "" {
dto.WeekStart = preference.WeekStart
@@ -302,7 +302,7 @@ type UpdateOrgPreferencesParams struct {
// swagger:response getPreferencesResponse
type GetPreferencesResponse struct {
// in:body
- Body preferences.Preferences `json:"body"`
+ Body preferences.Spec `json:"body"`
}
// swagger:parameters patchUserPreferences
diff --git a/pkg/codegen/jenny_eachmajor.go b/pkg/codegen/jenny_eachmajor.go
index 34027df9d6c..90f7f764b46 100644
--- a/pkg/codegen/jenny_eachmajor.go
+++ b/pkg/codegen/jenny_eachmajor.go
@@ -8,21 +8,25 @@ import (
"github.com/grafana/kindsys"
)
-// LatestMajorsOrXJenny returns a jenny that repeats the input for the latest in each major version,
-func LatestMajorsOrXJenny(parentdir string, inner codejen.OneToOne[SchemaForGen]) OneToMany {
+// LatestMajorsOrXJenny returns a jenny that repeats the input for the latest in each major version.
+//
+// TODO remove forceGroup option, it's a temporary hack to accommodate core kinds
+func LatestMajorsOrXJenny(parentdir string, forceGroup bool, inner codejen.OneToOne[SchemaForGen]) OneToMany {
if inner == nil {
panic("inner jenny must not be nil")
}
return &lmox{
- parentdir: parentdir,
- inner: inner,
+ parentdir: parentdir,
+ inner: inner,
+ forceGroup: forceGroup,
}
}
type lmox struct {
- parentdir string
- inner codejen.OneToOne[SchemaForGen]
+ parentdir string
+ inner codejen.OneToOne[SchemaForGen]
+ forceGroup bool
}
func (j *lmox) JennyName() string {
@@ -36,6 +40,10 @@ func (j *lmox) Generate(kind kindsys.Kind) (codejen.Files, error) {
IsGroup: comm.LineageIsGroup,
}
+ if j.forceGroup {
+ sfg.IsGroup = true
+ }
+
do := func(sfg SchemaForGen, infix string) (codejen.Files, error) {
f, err := j.inner.Generate(sfg)
if err != nil {
diff --git a/pkg/codegen/jenny_go_resources.go b/pkg/codegen/jenny_go_resources.go
new file mode 100644
index 00000000000..c8a02abfa48
--- /dev/null
+++ b/pkg/codegen/jenny_go_resources.go
@@ -0,0 +1,118 @@
+package codegen
+
+import (
+ "bytes"
+ "fmt"
+ "strings"
+
+ "cuelang.org/go/cue"
+ "github.com/dave/dst/dstutil"
+ "github.com/grafana/codejen"
+ "github.com/grafana/kindsys"
+ "github.com/grafana/thema/encoding/gocode"
+ "github.com/grafana/thema/encoding/openapi"
+)
+
+type ResourceGoTypesJenny struct {
+ ApplyFuncs []dstutil.ApplyFunc
+ ExpandReferences bool
+}
+
+func (*ResourceGoTypesJenny) JennyName() string {
+ return "GoTypesJenny"
+}
+
+func (ag *ResourceGoTypesJenny) Generate(kind kindsys.Kind) (*codejen.File, error) {
+ comm := kind.Props().Common()
+ sfg := SchemaForGen{
+ Name: comm.Name,
+ Schema: kind.Lineage().Latest(),
+ IsGroup: comm.LineageIsGroup,
+ }
+ sch := sfg.Schema
+
+ iter, err := sch.Underlying().Fields()
+ if err != nil {
+ return nil, err
+ }
+
+ var subr []string
+ for iter.Next() {
+ subr = append(subr, typeNameFromKey(iter.Selector().String()))
+ }
+
+ buf := new(bytes.Buffer)
+ mname := kind.Props().Common().MachineName
+ if err := tmpls.Lookup("core_resource.tmpl").Execute(buf, tvars_resource{
+ PackageName: mname,
+ KindName: kind.Props().Common().Name,
+ SubresourceNames: subr,
+ }); err != nil {
+ return nil, fmt.Errorf("failed executing core resource template: %w", err)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+ return codejen.NewFile(fmt.Sprintf("pkg/kinds/%s/%s_gen.go", mname, mname), buf.Bytes(), ag), nil
+}
+
+type SubresourceGoTypesJenny struct {
+ ApplyFuncs []dstutil.ApplyFunc
+ ExpandReferences bool
+}
+
+func (*SubresourceGoTypesJenny) JennyName() string {
+ return "GoResourceTypes"
+}
+
+func (g *SubresourceGoTypesJenny) Generate(kind kindsys.Kind) (codejen.Files, error) {
+ comm := kind.Props().Common()
+ sfg := SchemaForGen{
+ Name: comm.Name,
+ Schema: kind.Lineage().Latest(),
+ IsGroup: comm.LineageIsGroup,
+ }
+ sch := sfg.Schema
+
+ // Iterate through all top-level fields and make go types for them
+ // (this should consist of "spec" and arbitrary subresources)
+ i, err := sch.Underlying().Fields()
+ if err != nil {
+ return nil, err
+ }
+ files := make(codejen.Files, 0)
+ for i.Next() {
+ str := i.Selector().String()
+
+ b, err := gocode.GenerateTypesOpenAPI(sch, &gocode.TypeConfigOpenAPI{
+ // TODO will need to account for sanitizing e.g. dashes here at some point
+ Config: &openapi.Config{
+ Group: false, // TODO: better
+ RootName: typeNameFromKey(str),
+ Subpath: cue.MakePath(cue.Str(str)),
+ },
+ PackageName: sfg.Schema.Lineage().Name(),
+ ApplyFuncs: append(g.ApplyFuncs, PrefixDropper(sfg.Name)),
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ name := sfg.Schema.Lineage().Name()
+ files = append(files, codejen.File{
+ RelativePath: fmt.Sprintf("pkg/kinds/%s/%s_%s_gen.go", name, name, strings.ToLower(str)),
+ Data: b,
+ From: []codejen.NamedJenny{g},
+ })
+ }
+
+ return files, nil
+}
+
+func typeNameFromKey(key string) string {
+ if len(key) > 0 {
+ return strings.ToUpper(key[:1]) + key[1:]
+ }
+ return strings.ToUpper(key)
+}
diff --git a/pkg/codegen/jenny_gotypes.go b/pkg/codegen/jenny_go_types.go
similarity index 100%
rename from pkg/codegen/jenny_gotypes.go
rename to pkg/codegen/jenny_go_types.go
diff --git a/pkg/codegen/jenny_ts_resources.go b/pkg/codegen/jenny_ts_resources.go
new file mode 100644
index 00000000000..84d957d5767
--- /dev/null
+++ b/pkg/codegen/jenny_ts_resources.go
@@ -0,0 +1,79 @@
+package codegen
+
+import (
+ "github.com/grafana/codejen"
+ "github.com/grafana/cuetsy/ts"
+ "github.com/grafana/cuetsy/ts/ast"
+ "github.com/grafana/thema/encoding/typescript"
+)
+
+// TSResourceJenny is a [OneToOne] that produces TypeScript types and
+// defaults for a Thema schema.
+//
+// Thema's generic TS jenny will be able to replace this one once
+// https://github.com/grafana/thema/issues/89 is complete.
+type TSResourceJenny struct{}
+
+var _ codejen.OneToOne[SchemaForGen] = &TSResourceJenny{}
+
+func (j TSResourceJenny) JennyName() string {
+ return "TSResourceJenny"
+}
+
+func (j TSResourceJenny) Generate(sfg SchemaForGen) (*codejen.File, error) {
+ // TODO allow using name instead of machine name in thema generator
+ f, err := typescript.GenerateTypes(sfg.Schema, &typescript.TypeConfig{
+ RootName: sfg.Name,
+ Group: sfg.IsGroup,
+ })
+ if err != nil {
+ return nil, err
+ }
+ renameSpecNode(sfg.Name, f)
+
+ return codejen.NewFile(sfg.Schema.Lineage().Name()+"_types.gen.ts", []byte(f.String()), j), nil
+}
+
+func renameSpecNode(name string, tf *ast.File) {
+ specidx, specdefidx := -1, -1
+ for idx, def := range tf.Nodes {
+ // Peer through export keywords
+ if ex, is := def.(ast.ExportKeyword); is {
+ def = ex.Decl
+ }
+
+ switch x := def.(type) {
+ case ast.TypeDecl:
+ if x.Name.Name == "spec" {
+ specidx = idx
+ x.Name.Name = name
+ tf.Nodes[idx] = x
+ }
+ case ast.VarDecl:
+ // Before:
+ // export const defaultspec: Partial = {
+ // After:
+ /// export const defaultPlaylist: Partial = {
+ if x.Names.Idents[0].Name == "defaultspec" {
+ specdefidx = idx
+ x.Names.Idents[0].Name = "default" + name
+ tt := x.Type.(ast.TypeTransformExpr)
+ tt.Expr = ts.Ident(name)
+ x.Type = tt
+ tf.Nodes[idx] = x
+ }
+ }
+ }
+
+ if specidx != -1 {
+ decl := tf.Nodes[specidx]
+ tf.Nodes = append(append(tf.Nodes[:specidx], tf.Nodes[specidx+1:]...), decl)
+ }
+ if specdefidx != -1 {
+ if specdefidx > specidx {
+ specdefidx--
+ }
+ decl := tf.Nodes[specdefidx]
+ tf.Nodes = append(append(tf.Nodes[:specdefidx], tf.Nodes[specdefidx+1:]...), decl)
+ }
+}
diff --git a/pkg/codegen/jenny_tstypes.go b/pkg/codegen/jenny_ts_types.go
similarity index 100%
rename from pkg/codegen/jenny_tstypes.go
rename to pkg/codegen/jenny_ts_types.go
diff --git a/pkg/codegen/jenny_tsveneerindex.go b/pkg/codegen/jenny_tsveneerindex.go
index 63d9632b941..528a9a47668 100644
--- a/pkg/codegen/jenny_tsveneerindex.go
+++ b/pkg/codegen/jenny_tsveneerindex.go
@@ -50,6 +50,7 @@ func (gen *genTSVeneerIndex) Generate(kinds ...kindsys.Kind) (*codejen.File, err
if err != nil {
return nil, fmt.Errorf("%s: %w", def.Props().Common().Name, err)
}
+ renameSpecNode(def.Props().Common().Name, f)
elems, err := gen.extractTSIndexVeneerElements(def, f)
if err != nil {
return nil, fmt.Errorf("%s: %w", def.Props().Common().Name, err)
@@ -75,13 +76,13 @@ func (gen *genTSVeneerIndex) extractTSIndexVeneerElements(def kindsys.Kind, tf *
sels := p.Selectors()
switch len(sels) {
case 0:
- name = comm.Name
- fallthrough
+ return true
+
case 1:
// Only deal with subpaths that are definitions, for now
// TODO incorporate smarts about grouped lineages here
if name == "" {
- if !sels[0].IsDefinition() {
+ if !(sels[0].IsDefinition() || sels[0].String() == "spec") {
return false
}
// It might seem to make sense that we'd strip replaceout the leading # here for
@@ -90,6 +91,10 @@ func (gen *genTSVeneerIndex) extractTSIndexVeneerElements(def kindsys.Kind, tf *
name = sels[0].String()
}
+ if name == "spec" {
+ name = comm.Name
+ }
+
// Search the generated TS AST for the type and default def nodes
pair := findDeclNode(name, tf)
if pair.T == nil {
diff --git a/pkg/codegen/tmpl.go b/pkg/codegen/tmpl.go
index 5ea713278fd..e5071707c44 100644
--- a/pkg/codegen/tmpl.go
+++ b/pkg/codegen/tmpl.go
@@ -3,6 +3,7 @@ package codegen
import (
"bytes"
"embed"
+ "strings"
"text/template"
"time"
@@ -15,7 +16,8 @@ var tmpls *template.Template
func init() {
base := template.New("codegen").Funcs(template.FuncMap{
- "now": time.Now,
+ "now": time.Now,
+ "ToLower": strings.ToLower,
})
tmpls = template.Must(base.ParseFS(tmplFS, "tmpl/*.tmpl"))
}
@@ -46,6 +48,11 @@ type (
tvars_coremodel_imports struct {
PackageName string
}
+ tvars_resource struct {
+ PackageName string
+ KindName string
+ SubresourceNames []string
+ }
)
type HeaderVars = tvars_autogen_header
diff --git a/pkg/codegen/tmpl/core_resource.tmpl b/pkg/codegen/tmpl/core_resource.tmpl
new file mode 100644
index 00000000000..279dc4ae3be
--- /dev/null
+++ b/pkg/codegen/tmpl/core_resource.tmpl
@@ -0,0 +1,7 @@
+package {{ .PackageName }}
+
+// Resource is the wire representation of {{ .KindName }}. (TODO be better)
+type Resource struct {
+ {{- range .SubresourceNames }}
+ {{ . }} {{ . }} `json:"{{ . | ToLower }}"`{{end}}
+}
diff --git a/pkg/codegen/tmpl/kind_core.tmpl b/pkg/codegen/tmpl/kind_core.tmpl
index 19af086e65d..a2db88dffaf 100644
--- a/pkg/codegen/tmpl/kind_core.tmpl
+++ b/pkg/codegen/tmpl/kind_core.tmpl
@@ -17,9 +17,9 @@ const rootrel string = "kinds/{{ .Props.MachineName }}"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*{{ .Props.Name }}]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*{{ .Props.Name }}]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -40,7 +40,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*{{ .Props.Name }}](cursch, &{{ .Props.Name }}{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -53,18 +53,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the {{ .Props.Name }} type generated from the current schema, v{{ .Props.CurrentVersion }}.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*{{ .Props.Name }}] {
+// to the the {{ .Props.Name }} [Resource] type generated from the current schema, v{{ .Props.CurrentVersion }}.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of {{ .Props.Name }}.
+// at any schematized dashboard version to an instance of {{ .Props.Name }} [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*{{ .Props.Name }}, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/dashboard/dashboard_gen.go b/pkg/kinds/dashboard/dashboard_gen.go
new file mode 100644
index 00000000000..93d54e6c8f8
--- /dev/null
+++ b/pkg/kinds/dashboard/dashboard_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package dashboard
+
+// Resource is the wire representation of Dashboard. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/dashboard/dashboard_kind_gen.go b/pkg/kinds/dashboard/dashboard_kind_gen.go
index 65b94008504..4fe311a23a4 100644
--- a/pkg/kinds/dashboard/dashboard_kind_gen.go
+++ b/pkg/kinds/dashboard/dashboard_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/dashboard"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*Dashboard]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*Dashboard]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*Dashboard](cursch, &Dashboard{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the Dashboard type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Dashboard] {
+// to the the Dashboard [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of Dashboard.
+// at any schematized dashboard version to an instance of Dashboard [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*Dashboard, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/dashboard/dashboard_metadata_gen.go b/pkg/kinds/dashboard/dashboard_metadata_gen.go
new file mode 100644
index 00000000000..e9c4a179f23
--- /dev/null
+++ b/pkg/kinds/dashboard/dashboard_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package dashboard
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/dashboard/dashboard_types_gen.go b/pkg/kinds/dashboard/dashboard_spec_gen.go
similarity index 95%
rename from pkg/kinds/dashboard/dashboard_types_gen.go
rename to pkg/kinds/dashboard/dashboard_spec_gen.go
index ff4c26ea296..384abdf7b00 100644
--- a/pkg/kinds/dashboard/dashboard_types_gen.go
+++ b/pkg/kinds/dashboard/dashboard_spec_gen.go
@@ -3,8 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -14,12 +13,6 @@ import (
"time"
)
-// Defines values for Style.
-const (
- StyleDark Style = "dark"
- StyleLight Style = "light"
-)
-
// Defines values for CursorSync.
const (
CursorSyncN0 CursorSync = 0
@@ -33,15 +26,6 @@ const (
LinkTypeLink LinkType = "link"
)
-// Defines values for FieldColorModeId.
-const (
- FieldColorModeIdContinuousGrYlRd FieldColorModeId = "continuous-GrYlRd"
- FieldColorModeIdFixed FieldColorModeId = "fixed"
- FieldColorModeIdPaletteClassic FieldColorModeId = "palette-classic"
- FieldColorModeIdPaletteSaturated FieldColorModeId = "palette-saturated"
- FieldColorModeIdThresholds FieldColorModeId = "thresholds"
-)
-
// Defines values for FieldColorSeriesByMode.
const (
FieldColorSeriesByModeLast FieldColorSeriesByMode = "last"
@@ -103,6 +87,12 @@ const (
RowPanelTypeRow RowPanelType = "row"
)
+// Defines values for SpecStyle.
+const (
+ SpecStyleDark SpecStyle = "dark"
+ SpecStyleLight SpecStyle = "light"
+)
+
// Defines values for SpecialValueMapOptionsMatch.
const (
SpecialValueMapOptionsMatchFalse SpecialValueMapOptionsMatch = "false"
@@ -117,16 +107,6 @@ const (
SpecialValueMapTypeValue SpecialValueMapType = "value"
)
-// Defines values for SpecialValueMatch.
-const (
- SpecialValueMatchEmpty SpecialValueMatch = "empty"
- SpecialValueMatchFalse SpecialValueMatch = "false"
- SpecialValueMatchNan SpecialValueMatch = "nan"
- SpecialValueMatchNull SpecialValueMatch = "null"
- SpecialValueMatchNullNan SpecialValueMatch = "null+nan"
- SpecialValueMatchTrue SpecialValueMatch = "true"
-)
-
// Defines values for ThresholdsMode.
const (
ThresholdsModeAbsolute ThresholdsMode = "absolute"
@@ -225,112 +205,6 @@ type AnnotationTarget struct {
Type string `json:"type"`
}
-// Dashboard defines model for Dashboard.
-type Dashboard struct {
- // TODO -- should not be a public interface on its own, but required for Veneer
- Annotations *AnnotationContainer `json:"annotations,omitempty"`
-
- // Description of dashboard.
- Description *string `json:"description,omitempty"`
-
- // Whether a dashboard is editable or not.
- Editable bool `json:"editable"`
-
- // The month that the fiscal year starts on. 0 = January, 11 = December
- FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
-
- // For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
- GnetId *string `json:"gnetId,omitempty"`
-
- // 0 for no shared crosshair or tooltip (default).
- // 1 for shared crosshair.
- // 2 for shared crosshair AND shared tooltip.
- GraphTooltip CursorSync `json:"graphTooltip"`
-
- // Unique numeric identifier for the dashboard.
- // TODO must isolate or remove identifiers local to a Grafana instance...?
- Id *int64 `json:"id,omitempty"`
-
- // TODO docs
- Links []Link `json:"links,omitempty"`
-
- // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
- // This will keep data "moving left" regardless of the query refresh rate. This setting helps
- // avoid dashboards presenting stale live data
- LiveNow *bool `json:"liveNow,omitempty"`
- Panels []interface{} `json:"panels,omitempty"`
-
- // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
- Refresh *interface{} `json:"refresh,omitempty"`
-
- // This property should only be used in dashboards defined by plugins. It is a quick check
- // to see if the version has changed since the last time. Unclear why using the version property
- // is insufficient.
- Revision *int64 `json:"revision,omitempty"`
-
- // Version of the JSON schema, incremented each time a Grafana update brings
- // changes to said schema.
- // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
- SchemaVersion int `json:"schemaVersion"`
-
- // TODO docs
- Snapshot *Snapshot `json:"snapshot,omitempty"`
-
- // Theme of dashboard.
- Style Style `json:"style"`
-
- // Tags associated with dashboard.
- Tags []string `json:"tags,omitempty"`
-
- // TODO docs
- Templating *struct {
- List []VariableModel `json:"list,omitempty"`
- } `json:"templating,omitempty"`
-
- // Time range for dashboard, e.g. last 6 hours, last 7 days, etc
- Time *struct {
- From string `json:"from"`
- To string `json:"to"`
- } `json:"time,omitempty"`
-
- // TODO docs
- // TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
- Timepicker *struct {
- // Whether timepicker is collapsed or not.
- Collapse bool `json:"collapse"`
-
- // Whether timepicker is enabled or not.
- Enable bool `json:"enable"`
-
- // Whether timepicker is visible or not.
- Hidden bool `json:"hidden"`
-
- // Selectable intervals for auto-refresh.
- RefreshIntervals []string `json:"refresh_intervals"`
-
- // TODO docs
- TimeOptions []string `json:"time_options"`
- } `json:"timepicker,omitempty"`
-
- // Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
- Timezone *string `json:"timezone,omitempty"`
-
- // Title of dashboard.
- Title *string `json:"title,omitempty"`
-
- // Unique dashboard identifier that can be generated by anyone. string (8-40)
- Uid *string `json:"uid,omitempty"`
-
- // Version of the dashboard, incremented each time the dashboard is updated.
- Version *int `json:"version,omitempty"`
-
- // TODO docs
- WeekStart *string `json:"weekStart,omitempty"`
-}
-
-// Theme of dashboard.
-type Style string
-
// 0 for no shared crosshair or tooltip (default).
// 1 for shared crosshair.
// 2 for shared crosshair AND shared tooltip.
@@ -397,9 +271,6 @@ type FieldColor struct {
SeriesBy *FieldColorSeriesByMode `json:"seriesBy,omitempty"`
}
-// TODO docs
-type FieldColorModeId string
-
// TODO docs
type FieldColorSeriesByMode string
@@ -693,6 +564,112 @@ type Snapshot struct {
UserId int `json:"userId"`
}
+// Spec defines model for Spec.
+type Spec struct {
+ // TODO -- should not be a public interface on its own, but required for Veneer
+ Annotations *AnnotationContainer `json:"annotations,omitempty"`
+
+ // Description of dashboard.
+ Description *string `json:"description,omitempty"`
+
+ // Whether a dashboard is editable or not.
+ Editable bool `json:"editable"`
+
+ // The month that the fiscal year starts on. 0 = January, 11 = December
+ FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
+
+ // For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
+ GnetId *string `json:"gnetId,omitempty"`
+
+ // 0 for no shared crosshair or tooltip (default).
+ // 1 for shared crosshair.
+ // 2 for shared crosshair AND shared tooltip.
+ GraphTooltip CursorSync `json:"graphTooltip"`
+
+ // Unique numeric identifier for the dashboard.
+ // TODO must isolate or remove identifiers local to a Grafana instance...?
+ Id *int64 `json:"id,omitempty"`
+
+ // TODO docs
+ Links []Link `json:"links,omitempty"`
+
+ // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
+ // This will keep data "moving left" regardless of the query refresh rate. This setting helps
+ // avoid dashboards presenting stale live data
+ LiveNow *bool `json:"liveNow,omitempty"`
+ Panels []interface{} `json:"panels,omitempty"`
+
+ // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
+ Refresh *interface{} `json:"refresh,omitempty"`
+
+ // This property should only be used in dashboards defined by plugins. It is a quick check
+ // to see if the version has changed since the last time. Unclear why using the version property
+ // is insufficient.
+ Revision *int64 `json:"revision,omitempty"`
+
+ // Version of the JSON schema, incremented each time a Grafana update brings
+ // changes to said schema.
+ // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
+ SchemaVersion int `json:"schemaVersion"`
+
+ // TODO docs
+ Snapshot *Snapshot `json:"snapshot,omitempty"`
+
+ // Theme of dashboard.
+ Style SpecStyle `json:"style"`
+
+ // Tags associated with dashboard.
+ Tags []string `json:"tags,omitempty"`
+
+ // TODO docs
+ Templating *struct {
+ List []VariableModel `json:"list,omitempty"`
+ } `json:"templating,omitempty"`
+
+ // Time range for dashboard, e.g. last 6 hours, last 7 days, etc
+ Time *struct {
+ From string `json:"from"`
+ To string `json:"to"`
+ } `json:"time,omitempty"`
+
+ // TODO docs
+ // TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
+ Timepicker *struct {
+ // Whether timepicker is collapsed or not.
+ Collapse bool `json:"collapse"`
+
+ // Whether timepicker is enabled or not.
+ Enable bool `json:"enable"`
+
+ // Whether timepicker is visible or not.
+ Hidden bool `json:"hidden"`
+
+ // Selectable intervals for auto-refresh.
+ RefreshIntervals []string `json:"refresh_intervals"`
+
+ // TODO docs
+ TimeOptions []string `json:"time_options"`
+ } `json:"timepicker,omitempty"`
+
+ // Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
+ Timezone *string `json:"timezone,omitempty"`
+
+ // Title of dashboard.
+ Title *string `json:"title,omitempty"`
+
+ // Unique dashboard identifier that can be generated by anyone. string (8-40)
+ Uid *string `json:"uid,omitempty"`
+
+ // Version of the dashboard, incremented each time the dashboard is updated.
+ Version *int `json:"version,omitempty"`
+
+ // TODO docs
+ WeekStart *string `json:"weekStart,omitempty"`
+}
+
+// Theme of dashboard.
+type SpecStyle string
+
// TODO docs
type SpecialValueMap struct {
Options struct {
@@ -711,9 +688,6 @@ type SpecialValueMapOptionsMatch string
// SpecialValueMapType defines model for SpecialValueMap.Type.
type SpecialValueMapType string
-// TODO docs
-type SpecialValueMatch string
-
// Schema for panel targets is specified by datasource
// plugins. We use a placeholder definition, which the Go
// schema loader either left open/as-is with the Base
diff --git a/pkg/kinds/dashboard/dashboard_status_gen.go b/pkg/kinds/dashboard/dashboard_status_gen.go
new file mode 100644
index 00000000000..f8dd45b58b4
--- /dev/null
+++ b/pkg/kinds/dashboard/dashboard_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package dashboard
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/dashboard/dashboards_test.go b/pkg/kinds/dashboard/dashboards_test.go
deleted file mode 100644
index 0115ae62fbd..00000000000
--- a/pkg/kinds/dashboard/dashboards_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-package dashboard_test
-
-import (
- "encoding/json"
- "io"
- "io/fs"
- "os"
- "path/filepath"
- "strings"
- "testing"
-
- "cuelang.org/go/cue/errors"
- "github.com/grafana/grafana/pkg/cuectx"
- "github.com/grafana/grafana/pkg/kinds/dashboard"
- "github.com/stretchr/testify/require"
-)
-
-func TestDevenvDashboardValidity(t *testing.T) {
- path, err := filepath.Abs("../../../devenv/dev-dashboards")
- require.NoError(t, err)
-
- m, err := themaTestableDashboards(os.DirFS(path))
- require.NoError(t, err)
- dk, err := dashboard.NewKind(cuectx.GrafanaThemaRuntime())
- require.NoError(t, err)
-
- for path, b := range m {
- t.Run(path, func(t *testing.T) {
- // The path arg here only matters for error output
- cv, err := cuectx.JSONtoCUE(path, b)
- require.NoError(t, err, "error while decoding dashboard JSON into a CUE value")
-
- _, err = dk.ConvergentLineage().TypedSchema().Validate(cv)
- if err != nil {
- // Testify trims errors to short length. We want the full text
- errstr := errors.Details(err, nil)
- t.Log(errstr)
- if strings.Contains(errstr, "null") {
- t.Log("validation failure appears to involve nulls - see if scripts/stripnulls.sh has any effect?")
- }
- t.FailNow()
- }
- })
- }
-}
-
-func themaTestableDashboards(in fs.FS) (map[string][]byte, error) {
- m := make(map[string][]byte)
-
- err := fs.WalkDir(in, ".", func(path string, d fs.DirEntry, err error) error {
- if err != nil {
- return err
- }
-
- if d.IsDir() || filepath.Ext(d.Name()) != ".json" {
- return nil
- }
-
- // nolint:gosec
- f, err := in.Open(path)
- if err != nil {
- return err
- }
- defer f.Close() //nolint:errcheck
-
- b, err := io.ReadAll(f)
- if err != nil {
- return err
- }
-
- jtree := make(map[string]interface{})
- err = json.Unmarshal(b, &jtree)
- if err != nil {
- return err
- }
- if oldschemav, has := jtree["schemaVersion"]; !has || !(oldschemav.(float64) > dashboard.HandoffSchemaVersion-1) {
- return nil
- }
-
- m[path] = b
- return nil
- })
-
- if err != nil {
- return nil, err
- }
-
- return m, nil
-}
diff --git a/pkg/kinds/librarypanel/librarypanel_gen.go b/pkg/kinds/librarypanel/librarypanel_gen.go
new file mode 100644
index 00000000000..cd6556dffc5
--- /dev/null
+++ b/pkg/kinds/librarypanel/librarypanel_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package librarypanel
+
+// Resource is the wire representation of LibraryPanel. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/librarypanel/librarypanel_kind_gen.go b/pkg/kinds/librarypanel/librarypanel_kind_gen.go
index 4404be4dca9..246c8869bc1 100644
--- a/pkg/kinds/librarypanel/librarypanel_kind_gen.go
+++ b/pkg/kinds/librarypanel/librarypanel_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/librarypanel"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*LibraryPanel]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*LibraryPanel]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*LibraryPanel](cursch, &LibraryPanel{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the LibraryPanel type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*LibraryPanel] {
+// to the the LibraryPanel [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of LibraryPanel.
+// at any schematized dashboard version to an instance of LibraryPanel [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*LibraryPanel, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/librarypanel/librarypanel_metadata_gen.go b/pkg/kinds/librarypanel/librarypanel_metadata_gen.go
new file mode 100644
index 00000000000..e64314c8af4
--- /dev/null
+++ b/pkg/kinds/librarypanel/librarypanel_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package librarypanel
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/librarypanel/librarypanel_types_gen.go b/pkg/kinds/librarypanel/librarypanel_spec_gen.go
similarity index 94%
rename from pkg/kinds/librarypanel/librarypanel_types_gen.go
rename to pkg/kinds/librarypanel/librarypanel_spec_gen.go
index 5bc008309d7..f948b83942e 100644
--- a/pkg/kinds/librarypanel/librarypanel_types_gen.go
+++ b/pkg/kinds/librarypanel/librarypanel_spec_gen.go
@@ -3,8 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -32,8 +31,8 @@ type LibraryElementDTOMetaUser struct {
Name string `json:"name"`
}
-// LibraryPanel defines model for LibraryPanel.
-type LibraryPanel struct {
+// Spec defines model for Spec.
+type Spec struct {
// Panel description
Description *string `json:"description,omitempty"`
diff --git a/pkg/kinds/librarypanel/librarypanel_status_gen.go b/pkg/kinds/librarypanel/librarypanel_status_gen.go
new file mode 100644
index 00000000000..de50bacf2f7
--- /dev/null
+++ b/pkg/kinds/librarypanel/librarypanel_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package librarypanel
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/playlist/playlist_gen.go b/pkg/kinds/playlist/playlist_gen.go
new file mode 100644
index 00000000000..fe39143e622
--- /dev/null
+++ b/pkg/kinds/playlist/playlist_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package playlist
+
+// Resource is the wire representation of Playlist. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/playlist/playlist_kind_gen.go b/pkg/kinds/playlist/playlist_kind_gen.go
index 7d4dac3a965..d2f2a04cf4b 100644
--- a/pkg/kinds/playlist/playlist_kind_gen.go
+++ b/pkg/kinds/playlist/playlist_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/playlist"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*Playlist]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*Playlist]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*Playlist](cursch, &Playlist{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the Playlist type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Playlist] {
+// to the the Playlist [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of Playlist.
+// at any schematized dashboard version to an instance of Playlist [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*Playlist, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/playlist/playlist_metadata_gen.go b/pkg/kinds/playlist/playlist_metadata_gen.go
new file mode 100644
index 00000000000..18d1aca5506
--- /dev/null
+++ b/pkg/kinds/playlist/playlist_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package playlist
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/playlist/playlist_types_gen.go b/pkg/kinds/playlist/playlist_spec_gen.go
similarity index 94%
rename from pkg/kinds/playlist/playlist_types_gen.go
rename to pkg/kinds/playlist/playlist_spec_gen.go
index 8d8cff4f06b..211fb577b7f 100644
--- a/pkg/kinds/playlist/playlist_types_gen.go
+++ b/pkg/kinds/playlist/playlist_spec_gen.go
@@ -3,8 +3,7 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
@@ -17,24 +16,6 @@ const (
ItemTypeDashboardByUid ItemType = "dashboard_by_uid"
)
-// Playlist defines model for Playlist.
-type Playlist struct {
- // Interval sets the time between switching views in a playlist.
- // FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
- Interval string `json:"interval"`
-
- // The ordered list of items that the playlist will iterate over.
- // FIXME! This should not be optional, but changing it makes the godegen awkward
- Items []Item `json:"items,omitempty"`
-
- // Name of the playlist.
- Name string `json:"name"`
-
- // Unique playlist identifier. Generated on creation, either by the
- // creator of the playlist of by the application.
- Uid string `json:"uid"`
-}
-
// Item defines model for Item.
type Item struct {
// Title is an unused property -- it will be removed in the future
@@ -56,3 +37,21 @@ type Item struct {
// Type of the item.
type ItemType string
+
+// Spec defines model for Spec.
+type Spec struct {
+ // Interval sets the time between switching views in a playlist.
+ // FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
+ Interval string `json:"interval"`
+
+ // The ordered list of items that the playlist will iterate over.
+ // FIXME! This should not be optional, but changing it makes the godegen awkward
+ Items []Item `json:"items,omitempty"`
+
+ // Name of the playlist.
+ Name string `json:"name"`
+
+ // Unique playlist identifier. Generated on creation, either by the
+ // creator of the playlist of by the application.
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/playlist/playlist_status_gen.go b/pkg/kinds/playlist/playlist_status_gen.go
new file mode 100644
index 00000000000..0ad3608f04e
--- /dev/null
+++ b/pkg/kinds/playlist/playlist_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package playlist
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/preferences/preferences_gen.go b/pkg/kinds/preferences/preferences_gen.go
new file mode 100644
index 00000000000..66ac30558ab
--- /dev/null
+++ b/pkg/kinds/preferences/preferences_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package preferences
+
+// Resource is the wire representation of Preferences. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/preferences/preferences_kind_gen.go b/pkg/kinds/preferences/preferences_kind_gen.go
index 0141c1c2ae6..9efc26fba77 100644
--- a/pkg/kinds/preferences/preferences_kind_gen.go
+++ b/pkg/kinds/preferences/preferences_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/preferences"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*Preferences]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*Preferences]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*Preferences](cursch, &Preferences{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the Preferences type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Preferences] {
+// to the the Preferences [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of Preferences.
+// at any schematized dashboard version to an instance of Preferences [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*Preferences, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/preferences/preferences_metadata_gen.go b/pkg/kinds/preferences/preferences_metadata_gen.go
new file mode 100644
index 00000000000..db023ad66ab
--- /dev/null
+++ b/pkg/kinds/preferences/preferences_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package preferences
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/preferences/preferences_types_gen.go b/pkg/kinds/preferences/preferences_spec_gen.go
similarity index 89%
rename from pkg/kinds/preferences/preferences_types_gen.go
rename to pkg/kinds/preferences/preferences_spec_gen.go
index d03d2a3b106..8ac8df1ed1c 100644
--- a/pkg/kinds/preferences/preferences_types_gen.go
+++ b/pkg/kinds/preferences/preferences_spec_gen.go
@@ -3,15 +3,20 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
package preferences
-// Preferences defines model for Preferences.
-type Preferences struct {
+// QueryHistoryPreference defines model for QueryHistoryPreference.
+type QueryHistoryPreference struct {
+ // HomeTab one of: '' | 'query' | 'starred';
+ HomeTab *string `json:"homeTab,omitempty"`
+}
+
+// Spec defines model for Spec.
+type Spec struct {
// UID for the home dashboard
HomeDashboardUID *string `json:"homeDashboardUID,omitempty"`
@@ -29,9 +34,3 @@ type Preferences struct {
// WeekStart day of the week (sunday, monday, etc)
WeekStart *string `json:"weekStart,omitempty"`
}
-
-// QueryHistoryPreference defines model for QueryHistoryPreference.
-type QueryHistoryPreference struct {
- // HomeTab one of: '' | 'query' | 'starred';
- HomeTab *string `json:"homeTab,omitempty"`
-}
diff --git a/pkg/kinds/preferences/preferences_status_gen.go b/pkg/kinds/preferences/preferences_status_gen.go
new file mode 100644
index 00000000000..22fb6b7f5c3
--- /dev/null
+++ b/pkg/kinds/preferences/preferences_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package preferences
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/publicdashboard/publicdashboard_gen.go b/pkg/kinds/publicdashboard/publicdashboard_gen.go
new file mode 100644
index 00000000000..7870afda7a2
--- /dev/null
+++ b/pkg/kinds/publicdashboard/publicdashboard_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package publicdashboard
+
+// Resource is the wire representation of PublicDashboard. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/publicdashboard/publicdashboard_kind_gen.go b/pkg/kinds/publicdashboard/publicdashboard_kind_gen.go
index c2057b04dcd..f82475779e8 100644
--- a/pkg/kinds/publicdashboard/publicdashboard_kind_gen.go
+++ b/pkg/kinds/publicdashboard/publicdashboard_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/publicdashboard"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*PublicDashboard]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*PublicDashboard]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*PublicDashboard](cursch, &PublicDashboard{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the PublicDashboard type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*PublicDashboard] {
+// to the the PublicDashboard [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of PublicDashboard.
+// at any schematized dashboard version to an instance of PublicDashboard [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*PublicDashboard, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/publicdashboard/publicdashboard_metadata_gen.go b/pkg/kinds/publicdashboard/publicdashboard_metadata_gen.go
new file mode 100644
index 00000000000..df99a88166b
--- /dev/null
+++ b/pkg/kinds/publicdashboard/publicdashboard_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package publicdashboard
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/publicdashboard/publicdashboard_types_gen.go b/pkg/kinds/publicdashboard/publicdashboard_spec_gen.go
similarity index 86%
rename from pkg/kinds/publicdashboard/publicdashboard_types_gen.go
rename to pkg/kinds/publicdashboard/publicdashboard_spec_gen.go
index 80da0c962c1..01321af228a 100644
--- a/pkg/kinds/publicdashboard/publicdashboard_types_gen.go
+++ b/pkg/kinds/publicdashboard/publicdashboard_spec_gen.go
@@ -3,15 +3,14 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
package publicdashboard
-// PublicDashboard defines model for PublicDashboard.
-type PublicDashboard struct {
+// Spec defines model for Spec.
+type Spec struct {
// Unique public access token
AccessToken *string `json:"accessToken,omitempty"`
diff --git a/pkg/kinds/publicdashboard/publicdashboard_status_gen.go b/pkg/kinds/publicdashboard/publicdashboard_status_gen.go
new file mode 100644
index 00000000000..95665a48706
--- /dev/null
+++ b/pkg/kinds/publicdashboard/publicdashboard_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package publicdashboard
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/serviceaccount/serviceaccount_gen.go b/pkg/kinds/serviceaccount/serviceaccount_gen.go
new file mode 100644
index 00000000000..838848fca3c
--- /dev/null
+++ b/pkg/kinds/serviceaccount/serviceaccount_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package serviceaccount
+
+// Resource is the wire representation of ServiceAccount. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/serviceaccount/serviceaccount_kind_gen.go b/pkg/kinds/serviceaccount/serviceaccount_kind_gen.go
index 99aca391fde..95604454724 100644
--- a/pkg/kinds/serviceaccount/serviceaccount_kind_gen.go
+++ b/pkg/kinds/serviceaccount/serviceaccount_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/serviceaccount"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*ServiceAccount]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*ServiceAccount]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*ServiceAccount](cursch, &ServiceAccount{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the ServiceAccount type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*ServiceAccount] {
+// to the the ServiceAccount [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of ServiceAccount.
+// at any schematized dashboard version to an instance of ServiceAccount [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*ServiceAccount, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/serviceaccount/serviceaccount_metadata_gen.go b/pkg/kinds/serviceaccount/serviceaccount_metadata_gen.go
new file mode 100644
index 00000000000..2209086de2e
--- /dev/null
+++ b/pkg/kinds/serviceaccount/serviceaccount_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package serviceaccount
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/serviceaccount/serviceaccount_types_gen.go b/pkg/kinds/serviceaccount/serviceaccount_spec_gen.go
similarity index 81%
rename from pkg/kinds/serviceaccount/serviceaccount_types_gen.go
rename to pkg/kinds/serviceaccount/serviceaccount_spec_gen.go
index d4ab2b4157b..fe6d42152bb 100644
--- a/pkg/kinds/serviceaccount/serviceaccount_types_gen.go
+++ b/pkg/kinds/serviceaccount/serviceaccount_spec_gen.go
@@ -3,17 +3,12 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
package serviceaccount
-import (
- "time"
-)
-
// Defines values for OrgRole.
const (
OrgRoleAdmin OrgRole = "Admin"
@@ -24,8 +19,8 @@ const (
// OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.
type OrgRole string
-// ServiceAccount defines model for ServiceAccount.
-type ServiceAccount struct {
+// Spec defines model for Spec.
+type Spec struct {
// AccessControl metadata associated with a given resource.
AccessControl map[string]bool `json:"accessControl,omitempty"`
@@ -33,9 +28,6 @@ type ServiceAccount struct {
// of the service account.
AvatarUrl string `json:"avatarUrl"`
- // Created indicates when the service account was created.
- Created *time.Time `json:"created,omitempty"`
-
// ID is the unique identifier of the service account in the database.
Id int64 `json:"id"`
@@ -60,7 +52,4 @@ type ServiceAccount struct {
// Tokens is the number of active tokens for the service account.
// Tokens are used to authenticate the service account against Grafana.
Tokens int64 `json:"tokens"`
-
- // Updated indicates when the service account was updated.
- Updated *time.Time `json:"updated,omitempty"`
}
diff --git a/pkg/kinds/serviceaccount/serviceaccount_status_gen.go b/pkg/kinds/serviceaccount/serviceaccount_status_gen.go
new file mode 100644
index 00000000000..a2480770195
--- /dev/null
+++ b/pkg/kinds/serviceaccount/serviceaccount_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package serviceaccount
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/kinds/team/team_gen.go b/pkg/kinds/team/team_gen.go
new file mode 100644
index 00000000000..b86948a4545
--- /dev/null
+++ b/pkg/kinds/team/team_gen.go
@@ -0,0 +1,17 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoTypesJenny
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package team
+
+// Resource is the wire representation of Team. (TODO be better)
+type Resource struct {
+ Metadata Metadata `json:"metadata"`
+ Spec Spec `json:"spec"`
+ Status Status `json:"status"`
+}
diff --git a/pkg/kinds/team/team_kind_gen.go b/pkg/kinds/team/team_kind_gen.go
index 6354997eaf6..8fc6e091565 100644
--- a/pkg/kinds/team/team_kind_gen.go
+++ b/pkg/kinds/team/team_kind_gen.go
@@ -26,9 +26,9 @@ const rootrel string = "kinds/team"
// TODO standard generated docs
type Kind struct {
kindsys.Core
- lin thema.ConvergentLineage[*Team]
+ lin thema.ConvergentLineage[*Resource]
jcodec vmux.Codec
- valmux vmux.ValueMux[*Team]
+ valmux vmux.ValueMux[*Resource]
}
// type guard - ensure generated Kind type satisfies the kindsys.Core interface
@@ -49,7 +49,7 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
// Get the thema.Schema that the meta says is in the current version (which
// codegen ensures is always the latest)
cursch := thema.SchemaP(k.Core.Lineage(), def.Properties.CurrentVersion)
- tsch, err := thema.BindType[*Team](cursch, &Team{})
+ tsch, err := thema.BindType(cursch, &Resource{})
if err != nil {
// Should be unreachable, modulo bugs in the Thema->Go code generator
return nil, err
@@ -62,18 +62,18 @@ func NewKind(rt *thema.Runtime, opts ...thema.BindOption) (*Kind, error) {
}
// ConvergentLineage returns the same [thema.Lineage] as Lineage, but bound (see [thema.BindType])
-// to the the Team type generated from the current schema, v0.0.
-func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Team] {
+// to the the Team [Resource] type generated from the current schema, v0.0.
+func (k *Kind) ConvergentLineage() thema.ConvergentLineage[*Resource] {
return k.lin
}
// JSONValueMux is a version multiplexer that maps a []byte containing JSON data
-// at any schematized dashboard version to an instance of Team.
+// at any schematized dashboard version to an instance of Team [Resource].
//
// Validation and translation errors emitted from this func will identify the
// input bytes as "dashboard.json".
//
// This is a thin wrapper around Thema's [vmux.ValueMux].
-func (k *Kind) JSONValueMux(b []byte) (*Team, thema.TranslationLacunas, error) {
+func (k *Kind) JSONValueMux(b []byte) (*Resource, thema.TranslationLacunas, error) {
return k.valmux(b)
}
diff --git a/pkg/kinds/team/team_metadata_gen.go b/pkg/kinds/team/team_metadata_gen.go
new file mode 100644
index 00000000000..63066884922
--- /dev/null
+++ b/pkg/kinds/team/team_metadata_gen.go
@@ -0,0 +1,42 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package team
+
+import (
+ "time"
+)
+
+// Metadata defines model for Metadata.
+type Metadata struct {
+ CreatedBy string `json:"createdBy"`
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+
+ // extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
+ ExtraFields map[string]interface{} `json:"extraFields"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+ UpdateTimestamp time.Time `json:"updateTimestamp"`
+ UpdatedBy string `json:"updatedBy"`
+}
+
+// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
+// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
+// As it is also intended to be generic enough to function with any API Server.
+type KubeObjectMetadata struct {
+ CreationTimestamp time.Time `json:"creationTimestamp"`
+ DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
+ Finalizers []string `json:"finalizers"`
+ Labels map[string]string `json:"labels"`
+ ResourceVersion string `json:"resourceVersion"`
+ Uid string `json:"uid"`
+}
diff --git a/pkg/kinds/team/team_types_gen.go b/pkg/kinds/team/team_spec_gen.go
similarity index 77%
rename from pkg/kinds/team/team_types_gen.go
rename to pkg/kinds/team/team_spec_gen.go
index 580a803f6da..7fc36635200 100644
--- a/pkg/kinds/team/team_types_gen.go
+++ b/pkg/kinds/team/team_spec_gen.go
@@ -3,17 +3,12 @@
// Generated by:
// kinds/gen.go
// Using jennies:
-// GoTypesJenny
-// LatestJenny
+// GoResourceTypes
//
// Run 'make gen-cue' from repository root to regenerate.
package team
-import (
- "time"
-)
-
// Defines values for Permission.
const (
PermissionN0 Permission = 0
@@ -25,17 +20,14 @@ const (
// Permission defines model for Permission.
type Permission int
-// Team defines model for Team.
-type Team struct {
+// Spec defines model for Spec.
+type Spec struct {
// AccessControl metadata associated with a given resource.
AccessControl map[string]bool `json:"accessControl,omitempty"`
// AvatarUrl is the team's avatar URL.
AvatarUrl *string `json:"avatarUrl,omitempty"`
- // Created indicates when the team was created.
- Created time.Time `json:"created"`
-
// Email of the team.
Email *string `json:"email,omitempty"`
@@ -48,7 +40,4 @@ type Team struct {
// OrgId is the ID of an organisation the team belongs to.
OrgId int64 `json:"orgId"`
Permission Permission `json:"permission"`
-
- // Updated indicates when the team was updated.
- Updated time.Time `json:"updated"`
}
diff --git a/pkg/kinds/team/team_status_gen.go b/pkg/kinds/team/team_status_gen.go
new file mode 100644
index 00000000000..77957257d5f
--- /dev/null
+++ b/pkg/kinds/team/team_status_gen.go
@@ -0,0 +1,47 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+//
+// Generated by:
+// kinds/gen.go
+// Using jennies:
+// GoResourceTypes
+//
+// Run 'make gen-cue' from repository root to regenerate.
+
+package team
+
+// Defines values for OperatorStateState.
+const (
+ OperatorStateStateFailed OperatorStateState = "failed"
+ OperatorStateStateInProgress OperatorStateState = "in_progress"
+ OperatorStateStateSuccess OperatorStateState = "success"
+)
+
+// OperatorState defines model for OperatorState.
+type OperatorState struct {
+ // descriptiveState is an optional more descriptive state field which has no requirements on format
+ DescriptiveState *string `json:"descriptiveState,omitempty"`
+
+ // details contains any extra information that is operator-specific
+ Details map[string]interface{} `json:"details,omitempty"`
+
+ // lastEvaluation is the ResourceVersion last evaluated
+ LastEvaluation string `json:"lastEvaluation"`
+
+ // state describes the state of the lastEvaluation.
+ // It is limited to three possible states for machine evaluation.
+ State OperatorStateState `json:"state"`
+}
+
+// OperatorStateState state describes the state of the lastEvaluation.
+// It is limited to three possible states for machine evaluation.
+type OperatorStateState string
+
+// Status defines model for Status.
+type Status struct {
+ // additionalFields is reserved for future use
+ AdditionalFields map[string]interface{} `json:"additionalFields"`
+
+ // operatorStates is a map of operator ID to operator state evaluations.
+ // Any operator which consumes this kind SHOULD add its state evaluation information to this field.
+ OperatorStates map[string]OperatorState `json:"operatorStates,omitempty"`
+}
diff --git a/pkg/services/playlist/model.go b/pkg/services/playlist/model.go
index 0d6567d2a37..387fd6e9bdc 100644
--- a/pkg/services/playlist/model.go
+++ b/pkg/services/playlist/model.go
@@ -22,7 +22,7 @@ type Playlist struct {
OrgId int64 `json:"-" db:"org_id"`
}
-type PlaylistDTO = playlist.Playlist
+type PlaylistDTO = playlist.Spec
type PlaylistItemDTO = playlist.Item
type PlaylistItemType = playlist.ItemType
diff --git a/pkg/services/store/kind/playlist/summary.go b/pkg/services/store/kind/playlist/summary.go
index 277d1161440..8511ae3e511 100644
--- a/pkg/services/store/kind/playlist/summary.go
+++ b/pkg/services/store/kind/playlist/summary.go
@@ -22,7 +22,7 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
}
func summaryBuilder(ctx context.Context, uid string, body []byte) (*entity.EntitySummary, []byte, error) {
- obj := &playlist.Playlist{}
+ obj := &playlist.Spec{}
err := json.Unmarshal(body, obj)
if err != nil {
return nil, nil, err // unable to read object
diff --git a/pkg/services/store/kind/playlist/summary_test.go b/pkg/services/store/kind/playlist/summary_test.go
index 31d7f141437..7a9186cbc37 100644
--- a/pkg/services/store/kind/playlist/summary_test.go
+++ b/pkg/services/store/kind/playlist/summary_test.go
@@ -17,7 +17,7 @@ func TestPlaylistSummary(t *testing.T) {
_, _, err := builder(context.Background(), "abc", []byte("{invalid json"))
require.Error(t, err)
- playlist := playlist.Playlist{
+ playlist := playlist.Spec{
Interval: "30s",
Name: "test",
Items: []playlist.Item{
diff --git a/pkg/services/store/kind/preferences/summary.go b/pkg/services/store/kind/preferences/summary.go
index c3b557f788e..c2243529e41 100644
--- a/pkg/services/store/kind/preferences/summary.go
+++ b/pkg/services/store/kind/preferences/summary.go
@@ -29,7 +29,7 @@ func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
}
}
- obj := &preferences.Preferences{}
+ obj := &preferences.Spec{}
err := json.Unmarshal(body, obj)
if err != nil {
return nil, nil, err // unable to read object
diff --git a/public/app/features/teams/__mocks__/teamMocks.ts b/public/app/features/teams/__mocks__/teamMocks.ts
index ccbac6e2eb6..e768ea1bb5f 100644
--- a/public/app/features/teams/__mocks__/teamMocks.ts
+++ b/public/app/features/teams/__mocks__/teamMocks.ts
@@ -18,9 +18,7 @@ export const getMockTeam = (i = 1, overrides = {}): Team => {
memberCount: i,
permission: TeamPermissionLevel.Member,
accessControl: { isEditor: false },
- created: '',
orgId: 0,
- updated: '',
...overrides,
};
};
diff --git a/public/app/features/teams/state/navModel.ts b/public/app/features/teams/state/navModel.ts
index 5c63bb577de..0f7b503d1b6 100644
--- a/public/app/features/teams/state/navModel.ts
+++ b/public/app/features/teams/state/navModel.ts
@@ -14,7 +14,6 @@ const loadingTeam = {
memberCount: 0,
permission: TeamPermissionLevel.Member,
accessControl: { isEditor: false },
- created: '',
orgId: 0,
updated: '',
};
diff --git a/scripts/validate-devenv-dashboards.sh b/scripts/validate-devenv-dashboards.sh
deleted file mode 100755
index ed901b14565..00000000000
--- a/scripts/validate-devenv-dashboards.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# Temporary - remove this script once the dashboard schema are mature
-
-# Remove the appropriate ellipses from the schema to check for unspecified
-# fields in the artifacts (validating "open")
-
-# Run from root of grafana repo
-CMD=${CLI:-bin/darwin-amd64/grafana-cli}
-FILES=$(grep -rl '"schemaVersion": 30' devenv)
-for DASH in ${FILES}; do echo "${DASH}"; ${CMD} cue validate-resource --dashboard "${DASH}"; done