diff --git a/packages_generated/cockpit/src/v1/api.gen.ts b/packages_generated/cockpit/src/v1/api.gen.ts index e20eb303e..1f7668dd1 100644 --- a/packages_generated/cockpit/src/v1/api.gen.ts +++ b/packages_generated/cockpit/src/v1/api.gen.ts @@ -28,6 +28,8 @@ import { unmarshalAlertManager, unmarshalContactPoint, unmarshalDataSource, + unmarshalDisableAlertRulesResponse, + unmarshalEnableAlertRulesResponse, unmarshalGetConfigResponse, unmarshalGrafana, unmarshalGrafanaProductDashboard, @@ -47,6 +49,8 @@ import type { AlertManager, ContactPoint, DataSource, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponse, GlobalApiCreateGrafanaUserRequest, GlobalApiDeleteGrafanaUserRequest, @@ -861,41 +865,49 @@ If you need to receive alerts for other receivers, you can create additional con * Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules.. Enable preconfigured alert rules. Enable alert rules from the list of available preconfigured rules. * * @param request - The request {@link RegionalApiEnableAlertRulesRequest} + * @returns A Promise of EnableAlertRulesResponse */ enableAlertRules = ( request: Readonly = {}, ) => - this.client.fetch({ - body: JSON.stringify( - marshalRegionalApiEnableAlertRulesRequest( - request, - this.client.settings, + this.client.fetch( + { + body: JSON.stringify( + marshalRegionalApiEnableAlertRulesRequest( + request, + this.client.settings, + ), ), - ), - headers: jsonContentHeaders, - method: 'POST', - path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable-alert-rules`, - }) + headers: jsonContentHeaders, + method: 'POST', + path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/alert-manager/enable-alert-rules`, + }, + unmarshalEnableAlertRulesResponse, + ) /** * Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules.. Disable preconfigured alert rules. Disable alert rules from the list of available preconfigured rules. * * @param request - The request {@link RegionalApiDisableAlertRulesRequest} + * @returns A Promise of DisableAlertRulesResponse */ disableAlertRules = ( request: Readonly = {}, ) => - this.client.fetch({ - body: JSON.stringify( - marshalRegionalApiDisableAlertRulesRequest( - request, - this.client.settings, + this.client.fetch( + { + body: JSON.stringify( + marshalRegionalApiDisableAlertRulesRequest( + request, + this.client.settings, + ), ), - ), - headers: jsonContentHeaders, - method: 'POST', - path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable-alert-rules`, - }) + headers: jsonContentHeaders, + method: 'POST', + path: `/cockpit/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/alert-manager/disable-alert-rules`, + }, + unmarshalDisableAlertRulesResponse, + ) /** * Trigger a test alert. Send a test alert to the Alert manager to make sure your contact points get notified. diff --git a/packages_generated/cockpit/src/v1/index.gen.ts b/packages_generated/cockpit/src/v1/index.gen.ts index 85759b6bb..34fb919b0 100644 --- a/packages_generated/cockpit/src/v1/index.gen.ts +++ b/packages_generated/cockpit/src/v1/index.gen.ts @@ -14,6 +14,8 @@ export type { DataSource, DataSourceOrigin, DataSourceType, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponse, GetConfigResponseRetention, GlobalApiCreateGrafanaUserRequest, diff --git a/packages_generated/cockpit/src/v1/marshalling.gen.ts b/packages_generated/cockpit/src/v1/marshalling.gen.ts index 9e21dfb38..06d27e651 100644 --- a/packages_generated/cockpit/src/v1/marshalling.gen.ts +++ b/packages_generated/cockpit/src/v1/marshalling.gen.ts @@ -13,6 +13,8 @@ import type { ContactPoint, ContactPointEmail, DataSource, + DisableAlertRulesResponse, + EnableAlertRulesResponse, GetConfigResponse, GetConfigResponseRetention, GlobalApiCreateGrafanaUserRequest, @@ -183,6 +185,34 @@ export const unmarshalAlertManager = (data: unknown): AlertManager => { } as AlertManager } +export const unmarshalDisableAlertRulesResponse = ( + data: unknown, +): DisableAlertRulesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'DisableAlertRulesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + disabledRuleIds: data.disabled_rule_ids, + } as DisableAlertRulesResponse +} + +export const unmarshalEnableAlertRulesResponse = ( + data: unknown, +): EnableAlertRulesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'EnableAlertRulesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + enabledRuleIds: data.enabled_rule_ids, + } as EnableAlertRulesResponse +} + const unmarshalGetConfigResponseRetention = ( data: unknown, ): GetConfigResponseRetention => { diff --git a/packages_generated/cockpit/src/v1/types.gen.ts b/packages_generated/cockpit/src/v1/types.gen.ts index 157c62fbe..677085d47 100644 --- a/packages_generated/cockpit/src/v1/types.gen.ts +++ b/packages_generated/cockpit/src/v1/types.gen.ts @@ -372,6 +372,14 @@ export interface AlertManager { region: ScwRegion } +export interface DisableAlertRulesResponse { + disabledRuleIds: string[] +} + +export interface EnableAlertRulesResponse { + enabledRuleIds: string[] +} + /** * Cockpit configuration. */ diff --git a/packages_generated/std/src/index.gen.ts b/packages_generated/std/src/index.gen.ts index 63c6940eb..156220bde 100644 --- a/packages_generated/std/src/index.gen.ts +++ b/packages_generated/std/src/index.gen.ts @@ -1,6 +1,3 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. -export type { - CountryCode, - LanguageCode, -} from './types.gen' +export type { LanguageCode } from './types.gen'