It adds extra annotations in enums to be able to map a string/integer into a enum value. Additionally it adds the final modifier to avoid to indicate that the value is immutable.
Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.
### 🔎 Changes to `grafana-foundation-sdk@next+cog-v0.0.x`
```patch
diff --git a/go/cloudwatch/cloudwatchmetricsquery_builder_gen.go b/go/cloudwatch/cloudwatchmetricsquery_builder_gen.go
index f31b854..6d679fb 100644
--- a/go/cloudwatch/cloudwatchmetricsquery_builder_gen.go
+++ b/go/cloudwatch/cloudwatchmetricsquery_builder_gen.go
@@ -48,7 +48,7 @@ func (builder *CloudWatchMetricsQueryBuilder) QueryMode(queryMode CloudWatchQuer
return builder
}
-// Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+// Whether to use a metric search or metric insights query
func (builder *CloudWatchMetricsQueryBuilder) MetricQueryType(metricQueryType MetricQueryType) *CloudWatchMetricsQueryBuilder {
builder.internal.MetricQueryType = &metricQueryType
@@ -91,7 +91,7 @@ func (builder *CloudWatchMetricsQueryBuilder) Expression(expression string) *Clo
return builder
}
-// When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+// When the metric query type is set to `Insights`, this field is used to specify the query string.
func (builder *CloudWatchMetricsQueryBuilder) SqlExpression(sqlExpression string) *CloudWatchMetricsQueryBuilder {
builder.internal.SqlExpression = &sqlExpression
@@ -178,7 +178,7 @@ func (builder *CloudWatchMetricsQueryBuilder) Statistic(statistic string) *Cloud
return builder
}
-// When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+// When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
func (builder *CloudWatchMetricsQueryBuilder) Sql(sql cog.Builder[SQLExpression]) *CloudWatchMetricsQueryBuilder {
sqlResource, err := sql.Build()
if err != nil {
diff --git a/go/cloudwatch/types_gen.go b/go/cloudwatch/types_gen.go
index 6f32fe2..9fdb9ad 100644
--- a/go/cloudwatch/types_gen.go
+++ b/go/cloudwatch/types_gen.go
@@ -38,7 +38,7 @@ type Dimensions map[string]StringOrArrayOfString
type CloudWatchMetricsQuery struct {
// Whether a query is a Metrics, Logs, or Annotations query
QueryMode CloudWatchQueryMode `json:"queryMode"`
- // Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+ // Whether to use a metric search or metric insights query
MetricQueryType *MetricQueryType `json:"metricQueryType,omitempty"`
// Whether to use the query builder or code editor to create the query
MetricEditorMode *MetricEditorMode `json:"metricEditorMode,omitempty"`
@@ -51,7 +51,7 @@ type CloudWatchMetricsQuery struct {
Label *string `json:"label,omitempty"`
// Math expression query
Expression *string `json:"expression,omitempty"`
- // When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+ // When the metric query type is set to `Insights`, this field is used to specify the query string.
SqlExpression *string `json:"sqlExpression,omitempty"`
// A unique identifier for the query within the list of targets.
// In server side expressions, the refId is used as a variable name to identify results.
@@ -78,7 +78,7 @@ type CloudWatchMetricsQuery struct {
AccountId *string `json:"accountId,omitempty"`
// Metric data aggregations over specified periods of time. For detailed definitions of the statistics supported by CloudWatch, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.
Statistic *string `json:"statistic,omitempty"`
- // When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+ // When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
Sql *SQLExpression `json:"sql,omitempty"`
// For mixed data sources the selected datasource is on the query level.
// For non mixed scenarios this is undefined.
@@ -102,8 +102,8 @@ const (
type MetricQueryType int64
const (
- MetricQueryTypeSearch MetricQueryType = 0
- MetricQueryTypeQuery MetricQueryType = 1
+ MetricQueryTypeSearch MetricQueryType = 0
+ MetricQueryTypeInsights MetricQueryType = 1
)
type MetricEditorMode int64
diff --git a/go/common/tableimagecelloptions_builder_gen.go b/go/common/tableimagecelloptions_builder_gen.go
new file mode 100644
index 0000000..2bfe851
--- /dev/null
+++ b/go/common/tableimagecelloptions_builder_gen.go
@@ -0,0 +1,57 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+
+package common
+
+import (
+ cog "github.com/grafana/grafana-foundation-sdk/go/cog"
+)
+
+var _ cog.Builder[TableImageCellOptions] = (*TableImageCellOptionsBuilder)(nil)
+
+// Json view cell options
+type TableImageCellOptionsBuilder struct {
+ internal *TableImageCellOptions
+ errors map[string]cog.BuildErrors
+}
+
+func NewTableImageCellOptionsBuilder() *TableImageCellOptionsBuilder {
+ resource := &TableImageCellOptions{}
+ builder := &TableImageCellOptionsBuilder{
+ internal: resource,
+ errors: make(map[string]cog.BuildErrors),
+ }
+
+ builder.applyDefaults()
+ builder.internal.Type = "image"
+
+ return builder
+}
+
+func (builder *TableImageCellOptionsBuilder) Build() (TableImageCellOptions, error) {
+ var errs cog.BuildErrors
+
+ for _, err := range builder.errors {
+ errs = append(errs, cog.MakeBuildErrors("TableImageCellOptions", err)...)
+ }
+
+ if len(errs) != 0 {
+ return TableImageCellOptions{}, errs
+ }
+
+ return *builder.internal, nil
+}
+
+func (builder *TableImageCellOptionsBuilder) Alt(alt string) *TableImageCellOptionsBuilder {
+ builder.internal.Alt = &alt
+
+ return builder
+}
+
+func (builder *TableImageCellOptionsBuilder) Title(title string) *TableImageCellOptionsBuilder {
+ builder.internal.Title = &title
+
+ return builder
+}
+
+func (builder *TableImageCellOptionsBuilder) applyDefaults() {
+}
diff --git a/go/common/types_gen.go b/go/common/types_gen.go
index 2a884e4..ae2bc62 100644
--- a/go/common/types_gen.go
+++ b/go/common/types_gen.go
@@ -714,7 +714,9 @@ type TableJsonViewCellOptions struct {
// Json view cell options
type TableImageCellOptions struct {
- Type string `json:"type"`
+ Type string `json:"type"`
+ Alt *string `json:"alt,omitempty"`
+ Title *string `json:"title,omitempty"`
}
// Show data links in the cell
diff --git a/go/dashboard/dashboard_builder_gen.go b/go/dashboard/dashboard_builder_gen.go
index 284a7ae..b8a326e 100644
--- a/go/dashboard/dashboard_builder_gen.go
+++ b/go/dashboard/dashboard_builder_gen.go
@@ -381,6 +381,13 @@ func (builder *DashboardBuilder) Snapshot(snapshot cog.Builder[Snapshot]) *Dashb
return builder
}
+// When set to true, the dashboard will load all panels in the dashboard when it's loaded.
+func (builder *DashboardBuilder) Preload(preload bool) *DashboardBuilder {
+ builder.internal.Preload = &preload
+
+ return builder
+}
+
func (builder *DashboardBuilder) applyDefaults() {
builder.Timezone("browser")
builder.Tooltip(0)
diff --git a/go/dashboard/types_gen.go b/go/dashboard/types_gen.go
index 74ce0d0..a8f9657 100644
--- a/go/dashboard/types_gen.go
+++ b/go/dashboard/types_gen.go
@@ -75,6 +75,8 @@ type Dashboard struct {
Links []DashboardLink `json:"links,omitempty"`
// Snapshot options. They are present only if the dashboard is a snapshot.
Snapshot *Snapshot `json:"snapshot,omitempty"`
+ // When set to true, the dashboard will load all panels in the dashboard when it's loaded.
+ Preload *bool `json:"preload,omitempty"`
}
// TODO: this should be a regular DataQuery that depends on the selected dashboard
diff --git a/go/preferences/navbarpreference_builder_gen.go b/go/preferences/navbarpreference_builder_gen.go
new file mode 100644
index 0000000..e3c6c3d
--- /dev/null
+++ b/go/preferences/navbarpreference_builder_gen.go
@@ -0,0 +1,49 @@
+// Code generated - EDITING IS FUTILE. DO NOT EDIT.
+
+package preferences
+
+import (
+ cog "github.com/grafana/grafana-foundation-sdk/go/cog"
+)
+
+var _ cog.Builder[NavbarPreference] = (*NavbarPreferenceBuilder)(nil)
+
+type NavbarPreferenceBuilder struct {
+ internal *NavbarPreference
+ errors map[string]cog.BuildErrors
+}
+
+func NewNavbarPreferenceBuilder() *NavbarPreferenceBuilder {
+ resource := &NavbarPreference{}
+ builder := &NavbarPreferenceBuilder{
+ internal: resource,
+ errors: make(map[string]cog.BuildErrors),
+ }
+
+ builder.applyDefaults()
+
+ return builder
+}
+
+func (builder *NavbarPreferenceBuilder) Build() (NavbarPreference, error) {
+ var errs cog.BuildErrors
+
+ for _, err := range builder.errors {
+ errs = append(errs, cog.MakeBuildErrors("NavbarPreference", err)...)
+ }
+
+ if len(errs) != 0 {
+ return NavbarPreference{}, errs
+ }
+
+ return *builder.internal, nil
+}
+
+func (builder *NavbarPreferenceBuilder) SavedItemIds(savedItemIds []string) *NavbarPreferenceBuilder {
+ builder.internal.SavedItemIds = savedItemIds
+
+ return builder
+}
+
+func (builder *NavbarPreferenceBuilder) applyDefaults() {
+}
diff --git a/go/preferences/preferences_builder_gen.go b/go/preferences/preferences_builder_gen.go
index 5e622be..2452c8c 100644
--- a/go/preferences/preferences_builder_gen.go
+++ b/go/preferences/preferences_builder_gen.go
@@ -101,5 +101,17 @@ func (builder *PreferencesBuilder) CookiePreferences(cookiePreferences cog.Build
return builder
}
+// Navigation preferences
+func (builder *PreferencesBuilder) Navbar(navbar cog.Builder[NavbarPreference]) *PreferencesBuilder {
+ navbarResource, err := navbar.Build()
+ if err != nil {
+ builder.errors["navbar"] = err.(cog.BuildErrors)
+ return builder
+ }
+ builder.internal.Navbar = &navbarResource
+
+ return builder
+}
+
func (builder *PreferencesBuilder) applyDefaults() {
}
diff --git a/go/preferences/types_gen.go b/go/preferences/types_gen.go
index 19531a9..448b028 100644
--- a/go/preferences/types_gen.go
+++ b/go/preferences/types_gen.go
@@ -20,6 +20,8 @@ type Preferences struct {
QueryHistory *QueryHistoryPreference `json:"queryHistory,omitempty"`
// Cookie preferences
CookiePreferences *CookiePreferences `json:"cookiePreferences,omitempty"`
+ // Navigation preferences
+ Navbar *NavbarPreference `json:"navbar,omitempty"`
}
type QueryHistoryPreference struct {
@@ -32,3 +34,7 @@ type CookiePreferences struct {
Performance any `json:"performance,omitempty"`
Functional any `json:"functional,omitempty"`
}
+
+type NavbarPreference struct {
+ SavedItemIds []string `json:"savedItemIds"`
+}
diff --git a/jsonschema/cloudwatch.jsonschema.json b/jsonschema/cloudwatch.jsonschema.json
index e8cd42e..16552c6 100644
--- a/jsonschema/cloudwatch.jsonschema.json
+++ b/jsonschema/cloudwatch.jsonschema.json
@@ -86,7 +86,7 @@
},
"metricQueryType": {
"$ref": "#/definitions/MetricQueryType",
- "description": "Whether to use a metric search or metric query. Metric query is referred to as \"Metrics Insights\" in the AWS console."
+ "description": "Whether to use a metric search or metric insights query"
},
"metricEditorMode": {
"$ref": "#/definitions/MetricEditorMode",
@@ -110,7 +110,7 @@
},
"sqlExpression": {
"type": "string",
- "description": "When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string."
+ "description": "When the metric query type is set to `Insights`, this field is used to specify the query string."
},
"refId": {
"type": "string",
@@ -158,7 +158,7 @@
},
"sql": {
"$ref": "#/definitions/SQLExpression",
- "description": "When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query."
+ "description": "When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query."
},
"datasource": {
"type": "object",
diff --git a/jsonschema/common.jsonschema.json b/jsonschema/common.jsonschema.json
index e5c63ca..24cc9a1 100644
--- a/jsonschema/common.jsonschema.json
+++ b/jsonschema/common.jsonschema.json
@@ -1171,6 +1171,12 @@
"type": {
"type": "string",
"const": "image"
+ },
+ "alt": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
}
},
"description": "Json view cell options"
diff --git a/jsonschema/dashboard.jsonschema.json b/jsonschema/dashboard.jsonschema.json
index e220ac1..78923dc 100644
--- a/jsonschema/dashboard.jsonschema.json
+++ b/jsonschema/dashboard.jsonschema.json
@@ -149,6 +149,10 @@
"snapshot": {
"$ref": "#/definitions/Snapshot",
"description": "Snapshot options. They are present only if the dashboard is a snapshot."
+ },
+ "preload": {
+ "type": "boolean",
+ "description": "When set to true, the dashboard will load all panels in the dashboard when it's loaded."
}
}
},
diff --git a/jsonschema/preferences.jsonschema.json b/jsonschema/preferences.jsonschema.json
index bfbf80b..304fa55 100644
--- a/jsonschema/preferences.jsonschema.json
+++ b/jsonschema/preferences.jsonschema.json
@@ -33,6 +33,10 @@
"cookiePreferences": {
"$ref": "#/definitions/CookiePreferences",
"description": "Cookie preferences"
+ },
+ "navbar": {
+ "$ref": "#/definitions/NavbarPreference",
+ "description": "Navigation preferences"
}
},
"description": "Spec defines user, team or org Grafana preferences\nswagger:model Preferences"
@@ -64,6 +68,21 @@
"additionalProperties": {}
}
}
+ },
+ "NavbarPreference": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "savedItemIds"
+ ],
+ "properties": {
+ "savedItemIds": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/jsonschema/table.jsonschema.json b/jsonschema/table.jsonschema.json
index 4ac0b57..a63c980 100644
--- a/jsonschema/table.jsonschema.json
+++ b/jsonschema/table.jsonschema.json
@@ -424,6 +424,12 @@
"type": {
"type": "string",
"const": "image"
+ },
+ "alt": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
}
},
"description": "Json view cell options"
diff --git a/openapi/cloudwatch.openapi.json b/openapi/cloudwatch.openapi.json
index b710fee..d98385a 100644
--- a/openapi/cloudwatch.openapi.json
+++ b/openapi/cloudwatch.openapi.json
@@ -94,7 +94,7 @@
},
"metricQueryType": {
"$ref": "#/components/schemas/MetricQueryType",
- "description": "Whether to use a metric search or metric query. Metric query is referred to as \"Metrics Insights\" in the AWS console."
+ "description": "Whether to use a metric search or metric insights query"
},
"metricEditorMode": {
"$ref": "#/components/schemas/MetricEditorMode",
@@ -118,7 +118,7 @@
},
"sqlExpression": {
"type": "string",
- "description": "When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string."
+ "description": "When the metric query type is set to `Insights`, this field is used to specify the query string."
},
"refId": {
"type": "string",
@@ -166,7 +166,7 @@
},
"sql": {
"$ref": "#/components/schemas/SQLExpression",
- "description": "When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query."
+ "description": "When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query."
},
"datasource": {
"type": "object",
diff --git a/openapi/common.openapi.json b/openapi/common.openapi.json
index 91f58f0..5142142 100644
--- a/openapi/common.openapi.json
+++ b/openapi/common.openapi.json
@@ -1179,6 +1179,12 @@
"type": {
"type": "string",
"const": "image"
+ },
+ "alt": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
}
},
"description": "Json view cell options"
diff --git a/openapi/dashboard.openapi.json b/openapi/dashboard.openapi.json
index 3a9a83f..91548cc 100644
--- a/openapi/dashboard.openapi.json
+++ b/openapi/dashboard.openapi.json
@@ -156,6 +156,10 @@
"snapshot": {
"$ref": "#/components/schemas/Snapshot",
"description": "Snapshot options. They are present only if the dashboard is a snapshot."
+ },
+ "preload": {
+ "type": "boolean",
+ "description": "When set to true, the dashboard will load all panels in the dashboard when it's loaded."
}
}
},
diff --git a/openapi/preferences.openapi.json b/openapi/preferences.openapi.json
index 15030e1..ef11156 100644
--- a/openapi/preferences.openapi.json
+++ b/openapi/preferences.openapi.json
@@ -40,6 +40,10 @@
"cookiePreferences": {
"$ref": "#/components/schemas/CookiePreferences",
"description": "Cookie preferences"
+ },
+ "navbar": {
+ "$ref": "#/components/schemas/NavbarPreference",
+ "description": "Navigation preferences"
}
},
"description": "Spec defines user, team or org Grafana preferences\nswagger:model Preferences"
@@ -71,6 +75,21 @@
"additionalProperties": {}
}
}
+ },
+ "NavbarPreference": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "savedItemIds"
+ ],
+ "properties": {
+ "savedItemIds": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
}
}
}
diff --git a/openapi/table.openapi.json b/openapi/table.openapi.json
index d42ed0e..e72ac9a 100644
--- a/openapi/table.openapi.json
+++ b/openapi/table.openapi.json
@@ -433,6 +433,12 @@
"type": {
"type": "string",
"const": "image"
+ },
+ "alt": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
}
},
"description": "Json view cell options"
diff --git a/php/src/Azuremonitor/AzureMonitorQuery.php b/php/src/Azuremonitor/AzureMonitorQuery.php
index 97b672d..d116cc7 100644
--- a/php/src/Azuremonitor/AzureMonitorQuery.php
+++ b/php/src/Azuremonitor/AzureMonitorQuery.php
@@ -159,26 +159,26 @@ class AzureMonitorQuery implements \JsonSerializable, \Grafana\Foundation\Cog\Da
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["kind"]) {
+ case "MetricNamespaceQuery":
+ return MetricNamespaceQuery::fromArray($input);
+ case "WorkspacesQuery":
+ return WorkspacesQuery::fromArray($input);
+ case "AppInsightsMetricNameQuery":
+ return AppInsightsMetricNameQuery::fromArray($input);
+ case "ResourceNamesQuery":
+ return ResourceNamesQuery::fromArray($input);
case "MetricDefinitionsQuery":
return MetricDefinitionsQuery::fromArray($input);
+ case "UnknownQuery":
+ return UnknownQuery::fromArray($input);
case "AppInsightsGroupByQuery":
return AppInsightsGroupByQuery::fromArray($input);
- case "ResourceGroupsQuery":
- return ResourceGroupsQuery::fromArray($input);
- case "WorkspacesQuery":
- return WorkspacesQuery::fromArray($input);
case "SubscriptionsQuery":
return SubscriptionsQuery::fromArray($input);
- case "ResourceNamesQuery":
- return ResourceNamesQuery::fromArray($input);
- case "AppInsightsMetricNameQuery":
- return AppInsightsMetricNameQuery::fromArray($input);
- case "MetricNamespaceQuery":
- return MetricNamespaceQuery::fromArray($input);
+ case "ResourceGroupsQuery":
+ return ResourceGroupsQuery::fromArray($input);
case "MetricNamesQuery":
return MetricNamesQuery::fromArray($input);
- case "UnknownQuery":
- return UnknownQuery::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Cloudwatch/CloudWatchMetricsQuery.php b/php/src/Cloudwatch/CloudWatchMetricsQuery.php
index a6f49e9..193ef99 100644
--- a/php/src/Cloudwatch/CloudWatchMetricsQuery.php
+++ b/php/src/Cloudwatch/CloudWatchMetricsQuery.php
@@ -13,7 +13,7 @@ class CloudWatchMetricsQuery implements \JsonSerializable, \Grafana\Foundation\C
public \Grafana\Foundation\Cloudwatch\CloudWatchQueryMode $queryMode;
/**
- * Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+ * Whether to use a metric search or metric insights query
*/
public ?\Grafana\Foundation\Cloudwatch\MetricQueryType $metricQueryType;
@@ -44,7 +44,7 @@ class CloudWatchMetricsQuery implements \JsonSerializable, \Grafana\Foundation\C
public ?string $expression;
/**
- * When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+ * When the metric query type is set to `Insights`, this field is used to specify the query string.
*/
public ?string $sqlExpression;
@@ -108,7 +108,7 @@ class CloudWatchMetricsQuery implements \JsonSerializable, \Grafana\Foundation\C
public ?string $statistic;
/**
- * When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+ * When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
*/
public ?\Grafana\Foundation\Cloudwatch\SQLExpression $sql;
diff --git a/php/src/Cloudwatch/CloudWatchMetricsQueryBuilder.php b/php/src/Cloudwatch/CloudWatchMetricsQueryBuilder.php
index 0a25b4c..dd779e9 100644
--- a/php/src/Cloudwatch/CloudWatchMetricsQueryBuilder.php
+++ b/php/src/Cloudwatch/CloudWatchMetricsQueryBuilder.php
@@ -33,7 +33,7 @@ class CloudWatchMetricsQueryBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
/**
- * Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+ * Whether to use a metric search or metric insights query
*/
public function metricQueryType(\Grafana\Foundation\Cloudwatch\MetricQueryType $metricQueryType): static
{
@@ -88,7 +88,7 @@ class CloudWatchMetricsQueryBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
/**
- * When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+ * When the metric query type is set to `Insights`, this field is used to specify the query string.
*/
public function sqlExpression(string $sqlExpression): static
{
@@ -200,7 +200,7 @@ class CloudWatchMetricsQueryBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
/**
- * When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+ * When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
* @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Cloudwatch\SQLExpression> $sql
*/
public function sql(\Grafana\Foundation\Cog\Builder $sql): static
diff --git a/php/src/Cloudwatch/MetricQueryType.php b/php/src/Cloudwatch/MetricQueryType.php
index 20acb2a..25931b3 100644
--- a/php/src/Cloudwatch/MetricQueryType.php
+++ b/php/src/Cloudwatch/MetricQueryType.php
@@ -27,13 +27,13 @@ final class MetricQueryType implements \JsonSerializable, \Stringable {
return self::$instances["Search"];
}
- public static function query(): self
+ public static function insights(): self
{
- if (!isset(self::$instances["Query"])) {
- self::$instances["Query"] = new self(1);
+ if (!isset(self::$instances["Insights"])) {
+ self::$instances["Insights"] = new self(1);
}
- return self::$instances["Query"];
+ return self::$instances["Insights"];
}
public static function fromValue(int $value): self
@@ -43,7 +43,7 @@ final class MetricQueryType implements \JsonSerializable, \Stringable {
}
if ($value === 1) {
- return self::query();
+ return self::insights();
}
throw new \UnexpectedValueException("Value '$value' is not part of the enum MetricQueryType");
diff --git a/php/src/Cloudwatch/SQLExpression.php b/php/src/Cloudwatch/SQLExpression.php
index 2fb8653..88380e3 100644
--- a/php/src/Cloudwatch/SQLExpression.php
+++ b/php/src/Cloudwatch/SQLExpression.php
@@ -77,10 +77,10 @@ class SQLExpression implements \JsonSerializable
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["type"]) {
- case "property":
- return QueryEditorPropertyExpression::fromArray($input);
case "function":
return QueryEditorFunctionExpression::fromArray($input);
+ case "property":
+ return QueryEditorPropertyExpression::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Cloudwatch/VariantConfig.php b/php/src/Cloudwatch/VariantConfig.php
index 0e16d2d..e8860cc 100644
--- a/php/src/Cloudwatch/VariantConfig.php
+++ b/php/src/Cloudwatch/VariantConfig.php
@@ -12,12 +12,12 @@ final class VariantConfig
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["queryMode"]) {
+ case "Logs":
+ return CloudWatchLogsQuery::fromArray($input);
case "Annotations":
return CloudWatchAnnotationQuery::fromArray($input);
case "Metrics":
return CloudWatchMetricsQuery::fromArray($input);
- case "Logs":
- return CloudWatchLogsQuery::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Common/TableFieldOptions.php b/php/src/Common/TableFieldOptions.php
index 9d9d692..fbae7a8 100644
--- a/php/src/Common/TableFieldOptions.php
+++ b/php/src/Common/TableFieldOptions.php
@@ -78,6 +78,10 @@ class TableFieldOptions implements \JsonSerializable
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["type"]) {
+ case "color-background":
+ return TableColoredBackgroundCellOptions::fromArray($input);
+ case "color-text":
+ return TableColorTextCellOptions::fromArray($input);
case "image":
return TableImageCellOptions::fromArray($input);
case "data-links":
@@ -90,10 +94,6 @@ class TableFieldOptions implements \JsonSerializable
return TableSparklineCellOptions::fromArray($input);
case "gauge":
return TableBarGaugeCellOptions::fromArray($input);
- case "color-background":
- return TableColoredBackgroundCellOptions::fromArray($input);
- case "color-text":
- return TableColorTextCellOptions::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Common/TableFieldOptionsBuilder.php b/php/src/Common/TableFieldOptionsBuilder.php
index 99cd884..1bef667 100644
--- a/php/src/Common/TableFieldOptionsBuilder.php
+++ b/php/src/Common/TableFieldOptionsBuilder.php
@@ -52,7 +52,7 @@ class TableFieldOptionsBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
/**
- * @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableAutoCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableSparklineCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableBarGaugeCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColoredBackgroundCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColorTextCellOptions>|\Grafana\Foundation\Common\TableImageCellOptions|\Grafana\Foundation\Common\TableDataLinksCellOptions|\Grafana\Foundation\Common\TableJsonViewCellOptions $cellOptions
+ * @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableAutoCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableSparklineCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableBarGaugeCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColoredBackgroundCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColorTextCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableImageCellOptions>|\Grafana\Foundation\Common\TableDataLinksCellOptions|\Grafana\Foundation\Common\TableJsonViewCellOptions $cellOptions
*/
public function cellOptions( $cellOptions): static
{
diff --git a/php/src/Common/TableImageCellOptions.php b/php/src/Common/TableImageCellOptions.php
index 5abefdd..0bba06e 100644
--- a/php/src/Common/TableImageCellOptions.php
+++ b/php/src/Common/TableImageCellOptions.php
@@ -9,10 +9,20 @@ class TableImageCellOptions implements \JsonSerializable
{
public string $type;
- public function __construct()
+ public ?string $alt;
+
+ public ?string $title;
+
+ /**
+ * @param string|null $alt
+ * @param string|null $title
+ */
+ public function __construct(?string $alt = null, ?string $title = null)
{
$this->type = "image";
+ $this->alt = $alt;
+ $this->title = $title;
}
/**
@@ -20,7 +30,11 @@ class TableImageCellOptions implements \JsonSerializable
*/
public static function fromArray(array $inputData): self
{
+ /** @var array{type?: string, alt?: string, title?: string} $inputData */
+ $data = $inputData;
return new self(
+ alt: $data["alt"] ?? null,
+ title: $data["title"] ?? null,
);
}
@@ -32,6 +46,12 @@ class TableImageCellOptions implements \JsonSerializable
$data = [
"type" => $this->type,
];
+ if (isset($this->alt)) {
+ $data["alt"] = $this->alt;
+ }
+ if (isset($this->title)) {
+ $data["title"] = $this->title;
+ }
return $data;
}
}
diff --git a/php/src/Common/TableImageCellOptionsBuilder.php b/php/src/Common/TableImageCellOptionsBuilder.php
new file mode 100644
index 0000000..a4ee5e0
--- /dev/null
+++ b/php/src/Common/TableImageCellOptionsBuilder.php
@@ -0,0 +1,40 @@
+
+ */
+class TableImageCellOptionsBuilder implements \Grafana\Foundation\Cog\Builder
+{
+ protected \Grafana\Foundation\Common\TableImageCellOptions $internal;
+
+ public function __construct()
+ {
+ $this->internal = new \Grafana\Foundation\Common\TableImageCellOptions();
+ $this->internal->type = "image";
+ }
+
+ /**
+ * @return \Grafana\Foundation\Common\TableImageCellOptions
+ */
+ public function build()
+ {
+ return $this->internal;
+ }
+
+ public function alt(string $alt): static
+ {
+ $this->internal->alt = $alt;
+
+ return $this;
+ }
+ public function title(string $title): static
+ {
+ $this->internal->title = $title;
+
+ return $this;
+ }
+
+}
diff --git a/php/src/Dashboard/Dashboard.php b/php/src/Dashboard/Dashboard.php
index 7e577cc..af3dfb3 100644
--- a/php/src/Dashboard/Dashboard.php
+++ b/php/src/Dashboard/Dashboard.php
@@ -132,6 +132,11 @@ class Dashboard implements \JsonSerializable
*/
public ?\Grafana\Foundation\Dashboard\Snapshot $snapshot;
+ /**
+ * When set to true, the dashboard will load all panels in the dashboard when it's loaded.
+ */
+ public ?bool $preload;
+
/**
* @param int|null $id
* @param string|null $uid
@@ -156,8 +161,9 @@ class Dashboard implements \JsonSerializable
* @param \Grafana\Foundation\Dashboard\AnnotationContainer|null $annotations
* @param array<\Grafana\Foundation\Dashboard\DashboardLink>|null $links
* @param \Grafana\Foundation\Dashboard\Snapshot|null $snapshot
+ * @param bool|null $preload
*/
- public function __construct(?int $id = null, ?string $uid = null, ?string $title = null, ?string $description = null, ?int $revision = null, ?string $gnetId = null, ?array $tags = null, ?string $timezone = null, ?bool $editable = null, ?\Grafana\Foundation\Dashboard\DashboardCursorSync $graphTooltip = null, ?\Grafana\Foundation\Dashboard\DashboardDashboardTime $time = null, ?\Grafana\Foundation\Dashboard\TimePickerConfig $timepicker = null, ?int $fiscalYearStartMonth = null, ?bool $liveNow = null, ?string $weekStart = null, ?string $refresh = null, ?int $schemaVersion = null, ?int $version = null, ?array $panels = null, ?\Grafana\Foundation\Dashboard\DashboardDashboardTemplating $templating = null, ?\Grafana\Foundation\Dashboard\AnnotationContainer $annotations = null, ?array $links = null, ?\Grafana\Foundation\Dashboard\Snapshot $snapshot = null)
+ public function __construct(?int $id = null, ?string $uid = null, ?string $title = null, ?string $description = null, ?int $revision = null, ?string $gnetId = null, ?array $tags = null, ?string $timezone = null, ?bool $editable = null, ?\Grafana\Foundation\Dashboard\DashboardCursorSync $graphTooltip = null, ?\Grafana\Foundation\Dashboard\DashboardDashboardTime $time = null, ?\Grafana\Foundation\Dashboard\TimePickerConfig $timepicker = null, ?int $fiscalYearStartMonth = null, ?bool $liveNow = null, ?string $weekStart = null, ?string $refresh = null, ?int $schemaVersion = null, ?int $version = null, ?array $panels = null, ?\Grafana\Foundation\Dashboard\DashboardDashboardTemplating $templating = null, ?\Grafana\Foundation\Dashboard\AnnotationContainer $annotations = null, ?array $links = null, ?\Grafana\Foundation\Dashboard\Snapshot $snapshot = null, ?bool $preload = null)
{
$this->id = $id;
$this->uid = $uid;
@@ -182,6 +188,7 @@ class Dashboard implements \JsonSerializable
$this->annotations = $annotations ?: new \Grafana\Foundation\Dashboard\AnnotationContainer();
$this->links = $links;
$this->snapshot = $snapshot;
+ $this->preload = $preload;
}
/**
@@ -189,7 +196,7 @@ class Dashboard implements \JsonSerializable
*/
public static function fromArray(array $inputData): self
{
- /** @var array{id?: int, uid?: string, title?: string, description?: string, revision?: int, gnetId?: string, tags?: array, timezone?: string, editable?: bool, graphTooltip?: int, time?: mixed, timepicker?: mixed, fiscalYearStartMonth?: int, liveNow?: bool, weekStart?: string, refresh?: string, schemaVersion?: int, version?: int, panels?: array, templating?: mixed, annotations?: mixed, links?: array, snapshot?: mixed} $inputData */
+ /** @var array{id?: int, uid?: string, title?: string, description?: string, revision?: int, gnetId?: string, tags?: array, timezone?: string, editable?: bool, graphTooltip?: int, time?: mixed, timepicker?: mixed, fiscalYearStartMonth?: int, liveNow?: bool, weekStart?: string, refresh?: string, schemaVersion?: int, version?: int, panels?: array, templating?: mixed, annotations?: mixed, links?: array, snapshot?: mixed, preload?: bool} $inputData */
$data = $inputData;
return new self(
id: $data["id"] ?? null,
@@ -248,6 +255,7 @@ class Dashboard implements \JsonSerializable
$val = $input;
return \Grafana\Foundation\Dashboard\Snapshot::fromArray($val);
})($data["snapshot"]) : null,
+ preload: $data["preload"] ?? null,
);
}
@@ -321,6 +329,9 @@ class Dashboard implements \JsonSerializable
if (isset($this->snapshot)) {
$data["snapshot"] = $this->snapshot;
}
+ if (isset($this->preload)) {
+ $data["preload"] = $this->preload;
+ }
return $data;
}
}
diff --git a/php/src/Dashboard/DashboardBuilder.php b/php/src/Dashboard/DashboardBuilder.php
index 99dfccc..dd53cc1 100644
--- a/php/src/Dashboard/DashboardBuilder.php
+++ b/php/src/Dashboard/DashboardBuilder.php
@@ -402,5 +402,14 @@ class DashboardBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
+ /**
+ * When set to true, the dashboard will load all panels in the dashboard when it's loaded.
+ */
+ public function preload(bool $preload): static
+ {
+ $this->internal->preload = $preload;
+
+ return $this;
+ }
}
diff --git a/php/src/Dashboard/Snapshot.php b/php/src/Dashboard/Snapshot.php
index a40f7a8..2f083b4 100644
--- a/php/src/Dashboard/Snapshot.php
+++ b/php/src/Dashboard/Snapshot.php
@@ -126,7 +126,7 @@ class Snapshot implements \JsonSerializable
url: $data["url"] ?? null,
userId: $data["userId"] ?? null,
dashboard: isset($data["dashboard"]) ? (function($input) {
- /** @var array{id?: int, uid?: string, title?: string, description?: string, revision?: int, gnetId?: string, tags?: array, timezone?: string, editable?: bool, graphTooltip?: int, time?: mixed, timepicker?: mixed, fiscalYearStartMonth?: int, liveNow?: bool, weekStart?: string, refresh?: string, schemaVersion?: int, version?: int, panels?: array, templating?: mixed, annotations?: mixed, links?: array, snapshot?: mixed} */
+ /** @var array{id?: int, uid?: string, title?: string, description?: string, revision?: int, gnetId?: string, tags?: array, timezone?: string, editable?: bool, graphTooltip?: int, time?: mixed, timepicker?: mixed, fiscalYearStartMonth?: int, liveNow?: bool, weekStart?: string, refresh?: string, schemaVersion?: int, version?: int, panels?: array, templating?: mixed, annotations?: mixed, links?: array, snapshot?: mixed, preload?: bool} */
$val = $input;
return \Grafana\Foundation\Dashboard\Dashboard::fromArray($val);
})($data["dashboard"]) : null,
diff --git a/php/src/Elasticsearch/Dataquery.php b/php/src/Elasticsearch/Dataquery.php
index 6484d0c..c8c311f 100644
--- a/php/src/Elasticsearch/Dataquery.php
+++ b/php/src/Elasticsearch/Dataquery.php
@@ -97,18 +97,18 @@ class Dataquery implements \JsonSerializable, \Grafana\Foundation\Cog\Dataquery
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["type"]) {
- case "filters":
- return Filters::fromArray($input);
- case "geohash_grid":
- return GeoHashGrid::fromArray($input);
- case "nested":
- return Nested::fromArray($input);
case "date_histogram":
return DateHistogram::fromArray($input);
case "histogram":
return Histogram::fromArray($input);
case "terms":
return Terms::fromArray($input);
+ case "filters":
+ return Filters::fromArray($input);
+ case "geohash_grid":
+ return GeoHashGrid::fromArray($input);
+ case "nested":
+ return Nested::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
@@ -117,44 +117,44 @@ class Dataquery implements \JsonSerializable, \Grafana\Foundation\Cog\Dataquery
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["type"]) {
- case "percentiles":
- return Percentiles::fromArray($input);
- case "max":
- return Max::fromArray($input);
- case "moving_avg":
- return MovingAverage::fromArray($input);
+ case "derivative":
+ return Derivative::fromArray($input);
+ case "count":
+ return Count::fromArray($input);
+ case "sum":
+ return Sum::fromArray($input);
+ case "rate":
+ return Rate::fromArray($input);
+ case "moving_fn":
+ return MovingFunction::fromArray($input);
+ case "extended_stats":
+ return ExtendedStats::fromArray($input);
case "logs":
return Logs::fromArray($input);
- case "bucket_script":
- return BucketScript::fromArray($input);
- case "min":
- return Min::fromArray($input);
+ case "raw_data":
+ return RawData::fromArray($input);
case "top_metrics":
return TopMetrics::fromArray($input);
- case "count":
- return Count::fromArray($input);
- case "derivative":
- return Derivative::fromArray($input);
case "raw_document":
return RawDocument::fromArray($input);
- case "raw_data":
- return RawData::fromArray($input);
- case "extended_stats":
- return ExtendedStats::fromArray($input);
+ case "min":
+ return Min::fromArray($input);
+ case "moving_avg":
+ return MovingAverage::fromArray($input);
+ case "bucket_script":
+ return BucketScript::fromArray($input);
+ case "percentiles":
+ return Percentiles::fromArray($input);
+ case "max":
+ return Max::fromArray($input);
+ case "cumulative_sum":
+ return CumulativeSum::fromArray($input);
case "serial_diff":
return SerialDiff::fromArray($input);
case "avg":
return Average::fromArray($input);
- case "moving_fn":
- return MovingFunction::fromArray($input);
- case "sum":
- return Sum::fromArray($input);
case "cardinality":
return UniqueCount::fromArray($input);
- case "cumulative_sum":
- return CumulativeSum::fromArray($input);
- case "rate":
- return Rate::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Expr/VariantConfig.php b/php/src/Expr/VariantConfig.php
index 9ca27eb..710d51e 100644
--- a/php/src/Expr/VariantConfig.php
+++ b/php/src/Expr/VariantConfig.php
@@ -12,8 +12,6 @@ final class VariantConfig
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["type"]) {
- case "reduce":
- return TypeReduce::fromArray($input);
case "resample":
return TypeResample::fromArray($input);
case "classic_conditions":
@@ -24,6 +22,8 @@ final class VariantConfig
return TypeSql::fromArray($input);
case "math":
return TypeMath::fromArray($input);
+ case "reduce":
+ return TypeReduce::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Preferences/NavbarPreference.php b/php/src/Preferences/NavbarPreference.php
new file mode 100644
index 0000000..37cc68f
--- /dev/null
+++ b/php/src/Preferences/NavbarPreference.php
@@ -0,0 +1,42 @@
+
+ */
+ public array $savedItemIds;
+
+ /**
+ * @param array|null $savedItemIds
+ */
+ public function __construct(?array $savedItemIds = null)
+ {
+ $this->savedItemIds = $savedItemIds ?: [];
+ }
+
+ /**
+ * @param array $inputData
+ */
+ public static function fromArray(array $inputData): self
+ {
+ /** @var array{savedItemIds?: array} $inputData */
+ $data = $inputData;
+ return new self(
+ savedItemIds: $data["savedItemIds"] ?? null,
+ );
+ }
+
+ /**
+ * @return array
+ */
+ public function jsonSerialize(): array
+ {
+ $data = [
+ "savedItemIds" => $this->savedItemIds,
+ ];
+ return $data;
+ }
+}
diff --git a/php/src/Preferences/NavbarPreferenceBuilder.php b/php/src/Preferences/NavbarPreferenceBuilder.php
new file mode 100644
index 0000000..3675bd5
--- /dev/null
+++ b/php/src/Preferences/NavbarPreferenceBuilder.php
@@ -0,0 +1,35 @@
+
+ */
+class NavbarPreferenceBuilder implements \Grafana\Foundation\Cog\Builder
+{
+ protected \Grafana\Foundation\Preferences\NavbarPreference $internal;
+
+ public function __construct()
+ {
+ $this->internal = new \Grafana\Foundation\Preferences\NavbarPreference();
+ }
+
+ /**
+ * @return \Grafana\Foundation\Preferences\NavbarPreference
+ */
+ public function build()
+ {
+ return $this->internal;
+ }
+
+ /**
+ * @param array $savedItemIds
+ */
+ public function savedItemIds(array $savedItemIds): static
+ {
+ $this->internal->savedItemIds = $savedItemIds;
+
+ return $this;
+ }
+
+}
diff --git a/php/src/Preferences/Preferences.php b/php/src/Preferences/Preferences.php
index c6f5ba2..247102a 100644
--- a/php/src/Preferences/Preferences.php
+++ b/php/src/Preferences/Preferences.php
@@ -44,6 +44,11 @@ class Preferences implements \JsonSerializable
*/
public ?\Grafana\Foundation\Preferences\CookiePreferences $cookiePreferences;
+ /**
+ * Navigation preferences
+ */
+ public ?\Grafana\Foundation\Preferences\NavbarPreference $navbar;
+
/**
* @param string|null $homeDashboardUID
* @param string|null $timezone
@@ -52,8 +57,9 @@ class Preferences implements \JsonSerializable
* @param string|null $language
* @param \Grafana\Foundation\Preferences\QueryHistoryPreference|null $queryHistory
* @param \Grafana\Foundation\Preferences\CookiePreferences|null $cookiePreferences
+ * @param \Grafana\Foundation\Preferences\NavbarPreference|null $navbar
*/
- public function __construct(?string $homeDashboardUID = null, ?string $timezone = null, ?string $weekStart = null, ?string $theme = null, ?string $language = null, ?\Grafana\Foundation\Preferences\QueryHistoryPreference $queryHistory = null, ?\Grafana\Foundation\Preferences\CookiePreferences $cookiePreferences = null)
+ public function __construct(?string $homeDashboardUID = null, ?string $timezone = null, ?string $weekStart = null, ?string $theme = null, ?string $language = null, ?\Grafana\Foundation\Preferences\QueryHistoryPreference $queryHistory = null, ?\Grafana\Foundation\Preferences\CookiePreferences $cookiePreferences = null, ?\Grafana\Foundation\Preferences\NavbarPreference $navbar = null)
{
$this->homeDashboardUID = $homeDashboardUID;
$this->timezone = $timezone;
@@ -62,6 +68,7 @@ class Preferences implements \JsonSerializable
$this->language = $language;
$this->queryHistory = $queryHistory;
$this->cookiePreferences = $cookiePreferences;
+ $this->navbar = $navbar;
}
/**
@@ -69,7 +76,7 @@ class Preferences implements \JsonSerializable
*/
public static function fromArray(array $inputData): self
{
- /** @var array{homeDashboardUID?: string, timezone?: string, weekStart?: string, theme?: string, language?: string, queryHistory?: mixed, cookiePreferences?: mixed} $inputData */
+ /** @var array{homeDashboardUID?: string, timezone?: string, weekStart?: string, theme?: string, language?: string, queryHistory?: mixed, cookiePreferences?: mixed, navbar?: mixed} $inputData */
$data = $inputData;
return new self(
homeDashboardUID: $data["homeDashboardUID"] ?? null,
@@ -87,6 +94,11 @@ class Preferences implements \JsonSerializable
$val = $input;
return \Grafana\Foundation\Preferences\CookiePreferences::fromArray($val);
})($data["cookiePreferences"]) : null,
+ navbar: isset($data["navbar"]) ? (function($input) {
+ /** @var array{savedItemIds?: array} */
+ $val = $input;
+ return \Grafana\Foundation\Preferences\NavbarPreference::fromArray($val);
+ })($data["navbar"]) : null,
);
}
@@ -118,6 +130,9 @@ class Preferences implements \JsonSerializable
if (isset($this->cookiePreferences)) {
$data["cookiePreferences"] = $this->cookiePreferences;
}
+ if (isset($this->navbar)) {
+ $data["navbar"] = $this->navbar;
+ }
return $data;
}
}
diff --git a/php/src/Preferences/PreferencesBuilder.php b/php/src/Preferences/PreferencesBuilder.php
index 3689dff..c23e878 100644
--- a/php/src/Preferences/PreferencesBuilder.php
+++ b/php/src/Preferences/PreferencesBuilder.php
@@ -92,5 +92,16 @@ class PreferencesBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
+ /**
+ * Navigation preferences
+ * @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Preferences\NavbarPreference> $navbar
+ */
+ public function navbar(\Grafana\Foundation\Cog\Builder $navbar): static
+ {
+ $navbarResource = $navbar->build();
+ $this->internal->navbar = $navbarResource;
+
+ return $this;
+ }
}
diff --git a/php/src/Rolebinding/RoleBinding.php b/php/src/Rolebinding/RoleBinding.php
index 910b987..1dfddca 100644
--- a/php/src/Rolebinding/RoleBinding.php
+++ b/php/src/Rolebinding/RoleBinding.php
@@ -37,10 +37,10 @@ class RoleBinding implements \JsonSerializable
\assert(is_array($input), 'expected disjunction value to be an array');
switch ($input["kind"]) {
- case "BuiltinRole":
- return BuiltinRoleRef::fromArray($input);
case "Role":
return CustomRoleRef::fromArray($input);
+ case "BuiltinRole":
+ return BuiltinRoleRef::fromArray($input);
default:
throw new \ValueError('can not parse disjunction from array');
}
diff --git a/php/src/Table/PanelBuilder.php b/php/src/Table/PanelBuilder.php
index a8212f1..092b3bd 100644
--- a/php/src/Table/PanelBuilder.php
+++ b/php/src/Table/PanelBuilder.php
@@ -615,7 +615,7 @@ class PanelBuilder implements \Grafana\Foundation\Cog\Builder
return $this;
}
/**
- * @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableAutoCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableSparklineCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableBarGaugeCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColoredBackgroundCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColorTextCellOptions>|\Grafana\Foundation\Common\TableImageCellOptions|\Grafana\Foundation\Common\TableDataLinksCellOptions|\Grafana\Foundation\Common\TableJsonViewCellOptions $cellOptions
+ * @param \Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableAutoCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableSparklineCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableBarGaugeCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColoredBackgroundCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableColorTextCellOptions>|\Grafana\Foundation\Cog\Builder<\Grafana\Foundation\Common\TableImageCellOptions>|\Grafana\Foundation\Common\TableDataLinksCellOptions|\Grafana\Foundation\Common\TableJsonViewCellOptions $cellOptions
*/
public function cellOptions( $cellOptions): static
{
diff --git a/python/grafana_foundation_sdk/builders/cloudwatch.py b/python/grafana_foundation_sdk/builders/cloudwatch.py
index 88328e7..d5d69d4 100644
--- a/python/grafana_foundation_sdk/builders/cloudwatch.py
+++ b/python/grafana_foundation_sdk/builders/cloudwatch.py
@@ -120,7 +120,7 @@ class CloudWatchMetricsQuery(cogbuilder.Builder[cloudwatch.CloudWatchMetricsQuer
def metric_query_type(self, metric_query_type: cloudwatch.MetricQueryType) -> typing.Self:
"""
- Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+ Whether to use a metric search or metric insights query
"""
self._internal.metric_query_type = metric_query_type
@@ -175,7 +175,7 @@ class CloudWatchMetricsQuery(cogbuilder.Builder[cloudwatch.CloudWatchMetricsQuer
def sql_expression(self, sql_expression: str) -> typing.Self:
"""
- When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+ When the metric query type is set to `Insights`, this field is used to specify the query string.
"""
self._internal.sql_expression = sql_expression
@@ -286,7 +286,7 @@ class CloudWatchMetricsQuery(cogbuilder.Builder[cloudwatch.CloudWatchMetricsQuer
def sql(self, sql: cogbuilder.Builder[cloudwatch.SQLExpression]) -> typing.Self:
"""
- When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+ When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
"""
sql_resource = sql.build()
diff --git a/python/grafana_foundation_sdk/builders/common.py b/python/grafana_foundation_sdk/builders/common.py
index ad060e0..c1585ac 100644
--- a/python/grafana_foundation_sdk/builders/common.py
+++ b/python/grafana_foundation_sdk/builders/common.py
@@ -1323,6 +1323,31 @@ class TableColorTextCellOptions(cogbuilder.Builder[common.TableColorTextCellOpti
return self
+class TableImageCellOptions(cogbuilder.Builder[common.TableImageCellOptions]):
+ """
+ Json view cell options
+ """
+
+ _internal: common.TableImageCellOptions
+
+ def __init__(self):
+ self._internal = common.TableImageCellOptions()
+ self._internal.type_val = "image"
+
+ def build(self) -> common.TableImageCellOptions:
+ return self._internal
+
+ def alt(self, alt: str) -> typing.Self:
+ self._internal.alt = alt
+
+ return self
+
+ def title(self, title: str) -> typing.Self:
+ self._internal.title = title
+
+ return self
+
+
class TableBarGaugeCellOptions(cogbuilder.Builder[common.TableBarGaugeCellOptions]):
"""
Gauge cell options
diff --git a/python/grafana_foundation_sdk/builders/dashboard.py b/python/grafana_foundation_sdk/builders/dashboard.py
index 7d04fe8..afffa78 100644
--- a/python/grafana_foundation_sdk/builders/dashboard.py
+++ b/python/grafana_foundation_sdk/builders/dashboard.py
@@ -364,6 +364,15 @@ class Dashboard(cogbuilder.Builder[dashboard.Dashboard]):
return self
+ def preload(self, preload: bool) -> typing.Self:
+ """
+ When set to true, the dashboard will load all panels in the dashboard when it's loaded.
+ """
+
+ self._internal.preload = preload
+
+ return self
+
class AnnotationTarget(cogbuilder.Builder[dashboard.AnnotationTarget]):
"""
diff --git a/python/grafana_foundation_sdk/builders/preferences.py b/python/grafana_foundation_sdk/builders/preferences.py
index e57ee9c..c5ddc0f 100644
--- a/python/grafana_foundation_sdk/builders/preferences.py
+++ b/python/grafana_foundation_sdk/builders/preferences.py
@@ -85,6 +85,16 @@ class Preferences(cogbuilder.Builder[preferences.Preferences]):
return self
+ def navbar(self, navbar: cogbuilder.Builder[preferences.NavbarPreference]) -> typing.Self:
+ """
+ Navigation preferences
+ """
+
+ navbar_resource = navbar.build()
+ self._internal.navbar = navbar_resource
+
+ return self
+
class QueryHistoryPreference(cogbuilder.Builder[preferences.QueryHistoryPreference]):
_internal: preferences.QueryHistoryPreference
@@ -128,4 +138,19 @@ class CookiePreferences(cogbuilder.Builder[preferences.CookiePreferences]):
self._internal.functional = functional
return self
+
+
+class NavbarPreference(cogbuilder.Builder[preferences.NavbarPreference]):
+ _internal: preferences.NavbarPreference
+
+ def __init__(self):
+ self._internal = preferences.NavbarPreference()
+
+ def build(self) -> preferences.NavbarPreference:
+ return self._internal
+
+ def saved_item_ids(self, saved_item_ids: list[str]) -> typing.Self:
+ self._internal.saved_item_ids = saved_item_ids
+
+ return self
\ No newline at end of file
diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py
index 9173245..d965012 100644
--- a/python/grafana_foundation_sdk/cog/plugins.py
+++ b/python/grafana_foundation_sdk/cog/plugins.py
@@ -1,39 +1,39 @@
# Code generated - EDITING IS FUTILE. DO NOT EDIT.
+from ..models import table
+from ..models import canvas
+from ..models import debug
from ..models import gauge
-from ..models import nodegraph
-from ..models import statetimeline
+from ..models import heatmap
+from ..models import parca
from ..models import tempo
+from ..models import azuremonitor
+from ..models import datagrid
+from ..models import logs
+from ..models import text
from ..models import expr
-from ..models import cloudwatch
-from ..models import debug
+from ..models import bargauge
from ..models import googlecloudmonitoring
-from ..models import parca
-from ..models import stat
-from ..models import statushistory
-from ..models import table
-from ..models import trend
-from ..models import prometheus
-from ..models import barchart
-from ..models import dashboardlist
-from ..models import grafanapyroscope
-from ..models import news
+from ..models import nodegraph
from ..models import piechart
-from ..models import annotationslist
-from ..models import datagrid
-from ..models import elasticsearch
-from ..models import logs
+from ..models import statetimeline
from ..models import xychart
-from ..models import bargauge
-from ..models import canvas
+from ..models import annotationslist
+from ..models import barchart
+from ..models import dashboardlist
from ..models import loki
-from ..models import text
from ..models import timeseries
-from ..models import azuremonitor
-from ..models import candlestick
+from ..models import cloudwatch
+from ..models import statushistory
+from ..models import news
+from ..models import prometheus
+from ..models import elasticsearch
from ..models import geomap
-from ..models import heatmap
from ..models import histogram
+from ..models import stat
+from ..models import trend
+from ..models import candlestick
+from ..models import grafanapyroscope
from . import runtime as cogruntime
diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py
index 8ef9b81..799f88e 100644
--- a/python/grafana_foundation_sdk/models/cloudwatch.py
+++ b/python/grafana_foundation_sdk/models/cloudwatch.py
@@ -95,7 +95,7 @@ class CloudWatchMetricsQuery(cogvariants.Dataquery):
# Whether a query is a Metrics, Logs, or Annotations query
query_mode: 'CloudWatchQueryMode'
- # Whether to use a metric search or metric query. Metric query is referred to as "Metrics Insights" in the AWS console.
+ # Whether to use a metric search or metric insights query
metric_query_type: typing.Optional['MetricQueryType']
# Whether to use the query builder or code editor to create the query
metric_editor_mode: typing.Optional['MetricEditorMode']
@@ -108,7 +108,7 @@ class CloudWatchMetricsQuery(cogvariants.Dataquery):
label: typing.Optional[str]
# Math expression query
expression: typing.Optional[str]
- # When the metric query type is `metricQueryType` is set to `Query`, this field is used to specify the query string.
+ # When the metric query type is set to `Insights`, this field is used to specify the query string.
sql_expression: typing.Optional[str]
# A unique identifier for the query within the list of targets.
# In server side expressions, the refId is used as a variable name to identify results.
@@ -135,7 +135,7 @@ class CloudWatchMetricsQuery(cogvariants.Dataquery):
account_id: typing.Optional[str]
# Metric data aggregations over specified periods of time. For detailed definitions of the statistics supported by CloudWatch, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.
statistic: typing.Optional[str]
- # When the metric query type is `metricQueryType` is set to `Query` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
+ # When the metric query type is set to `Insights` and the `metricEditorMode` is set to `Builder`, this field is used to build up an object representation of a SQL query.
sql: typing.Optional['SQLExpression']
# For mixed data sources the selected datasource is on the query level.
# For non mixed scenarios this is undefined.
@@ -273,7 +273,7 @@ class CloudWatchQueryMode(enum.StrEnum):
class MetricQueryType(enum.IntEnum):
SEARCH = 0
- QUERY = 1
+ INSIGHTS = 1
class MetricEditorMode(enum.IntEnum):
@@ -332,7 +332,7 @@ class SQLExpression:
if "select" in data:
args["select"] = QueryEditorFunctionExpression.from_json(data["select"])
if "from" in data:
- decoding_map: dict[str, typing.Union[typing.Type[QueryEditorFunctionExpression], typing.Type[QueryEditorPropertyExpression]]] = {"function": QueryEditorFunctionExpression, "property": QueryEditorPropertyExpression}
+ decoding_map: dict[str, typing.Union[typing.Type[QueryEditorPropertyExpression], typing.Type[QueryEditorFunctionExpression]]] = {"property": QueryEditorPropertyExpression, "function": QueryEditorFunctionExpression}
args["from_val"] = decoding_map[data["from"]["type"]].from_json(data["from"])
if "where" in data:
args["where"] = QueryEditorArrayExpression.from_json(data["where"])
@@ -894,7 +894,7 @@ CloudWatchQuery: typing.TypeAlias = typing.Union['CloudWatchMetricsQuery', 'Clou
def variant_config() -> cogruntime.DataqueryConfig:
- decoding_map: dict[str, typing.Union[typing.Type[CloudWatchAnnotationQuery], typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery]]] = {"Annotations": CloudWatchAnnotationQuery, "Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery}
+ decoding_map: dict[str, typing.Union[typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchAnnotationQuery]]] = {"Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery, "Annotations": CloudWatchAnnotationQuery}
return cogrun...*[Comment body truncated]*
It adds extra annotations in enums to be able to map a string/integer into a enum value. Additionally it adds the final modifier to avoid to indicate that the value is immutable.