From 3eec36f6635c3e01f9a6edda0a484b47a168c170 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Mon, 19 Aug 2024 11:52:42 -0500 Subject: [PATCH] bump omicron for oxql api tweak --- OMICRON_VERSION | 2 +- app/api/__generated__/Api.ts | 125 +++++++++-------------- app/api/__generated__/OMICRON_VERSION | 2 +- app/api/__generated__/msw-handlers.ts | 18 +--- app/api/__generated__/validate.ts | 142 ++++++++++++-------------- app/api/window.ts | 2 +- mock-api/msw/handlers.ts | 1 - 7 files changed, 120 insertions(+), 172 deletions(-) diff --git a/OMICRON_VERSION b/OMICRON_VERSION index 8c24669447..2f61bc760f 100644 --- a/OMICRON_VERSION +++ b/OMICRON_VERSION @@ -1 +1 @@ -eeb723c6a0d727f016ca947541ac85c029801c06 +b449abb736c10313df1d5e0c8f126970b2b968e5 diff --git a/app/api/__generated__/Api.ts b/app/api/__generated__/Api.ts index b81249f1c8..9de8c9928f 100644 --- a/app/api/__generated__/Api.ts +++ b/app/api/__generated__/Api.ts @@ -1844,11 +1844,6 @@ If not provided, all SSH public keys from the user's profile will be sent. If an userData?: string } -/** - * Migration parameters for an `Instance` - */ -export type InstanceMigrate = { dstSledId: string } - /** * A MAC address * @@ -2248,6 +2243,56 @@ export type NetworkInterface = { vni: Vni } +/** + * List of data values for one timeseries. + * + * Each element is an option, where `None` represents a missing sample. + */ +export type ValueArray = + | { type: 'integer'; values: number[] } + | { type: 'double'; values: number[] } + | { type: 'boolean'; values: boolean[] } + | { type: 'string'; values: string[] } + | { type: 'integer_distribution'; values: Distributionint64[] } + | { type: 'double_distribution'; values: Distributiondouble[] } + +/** + * A single list of values, for one dimension of a timeseries. + */ +export type Values = { + /** The type of this metric. */ + metricType: MetricType + /** The data values. */ + values: ValueArray +} + +/** + * Timepoints and values for one timeseries. + */ +export type Points = { startTimes?: Date[]; timestamps: Date[]; values: Values[] } + +/** + * A timeseries contains a timestamped set of values from one source. + * + * This includes the typed key-value pairs that uniquely identify it, and the set of timestamps and data values from it. + */ +export type Timeseries = { fields: Record; points: Points } + +/** + * A table represents one or more timeseries with the same schema. + * + * A table is the result of an OxQL query. It contains a name, usually the name of the timeseries schema from which the data is derived, and any number of timeseries, which contain the actual data. + */ +export type Table = { name: string; timeseries: Record } + +/** + * The result of a successful OxQL query. + */ +export type OxqlQueryResult = { + /** Tables resulting from the query, each containing timeseries. */ + tables: Table[] +} + /** * A password used to authenticate a user * @@ -2326,29 +2371,6 @@ export type Ping = { status: PingStatus } -/** - * List of data values for one timeseries. - * - * Each element is an option, where `None` represents a missing sample. - */ -export type ValueArray = - | { type: 'integer'; values: number[] } - | { type: 'double'; values: number[] } - | { type: 'boolean'; values: boolean[] } - | { type: 'string'; values: string[] } - | { type: 'integer_distribution'; values: Distributionint64[] } - | { type: 'double_distribution'; values: Distributiondouble[] } - -/** - * A single list of values, for one dimension of a timeseries. - */ -export type Values = { metricType: MetricType; values: ValueArray } - -/** - * Timepoints and values for one timeseries. - */ -export type Points = { startTimes?: Date[]; timestamps: Date[]; values: Values[] } - /** * Identity-related metadata that's included in nearly all public API objects */ @@ -3408,20 +3430,6 @@ export type SwitchResultsPage = { nextPage?: string } -/** - * A timeseries contains a timestamped set of values from one source. - * - * This includes the typed key-value pairs that uniquely identify it, and the set of timestamps and data values from it. - */ -export type Timeseries = { fields: Record; points: Points } - -/** - * A table represents one or more timeseries with the same schema. - * - * A table is the result of an OxQL query. It contains a name, usually the name of the timeseries schema from which the data is derived, and any number of timeseries, which contain the actual data. - */ -export type Table = { name: string; timeseries: Record } - /** * Text descriptions for the target and metric of a timeseries. */ @@ -4214,14 +4222,6 @@ export interface InstanceEphemeralIpDetachQueryParams { project?: NameOrId } -export interface InstanceMigratePathParams { - instance: NameOrId -} - -export interface InstanceMigrateQueryParams { - project?: NameOrId -} - export interface InstanceRebootPathParams { instance: NameOrId } @@ -5792,29 +5792,6 @@ export class Api extends HttpClient { ...params, }) }, - /** - * Migrate an instance - */ - instanceMigrate: ( - { - path, - query = {}, - body, - }: { - path: InstanceMigratePathParams - query?: InstanceMigrateQueryParams - body: InstanceMigrate - }, - params: FetchParams = {} - ) => { - return this.request({ - path: `/v1/instances/${path.instance}/migrate`, - method: 'POST', - body, - query, - ...params, - }) - }, /** * Reboot an instance */ @@ -7532,7 +7509,7 @@ export class Api extends HttpClient { * Run timeseries query */ timeseriesQuery: ({ body }: { body: TimeseriesQuery }, params: FetchParams = {}) => { - return this.request({ + return this.request({ path: `/v1/timeseries/query`, method: 'POST', body, diff --git a/app/api/__generated__/OMICRON_VERSION b/app/api/__generated__/OMICRON_VERSION index e906553774..324a038ac4 100644 --- a/app/api/__generated__/OMICRON_VERSION +++ b/app/api/__generated__/OMICRON_VERSION @@ -1,2 +1,2 @@ # generated file. do not update manually. see docs/update-pinned-api.md -eeb723c6a0d727f016ca947541ac85c029801c06 +b449abb736c10313df1d5e0c8f126970b2b968e5 diff --git a/app/api/__generated__/msw-handlers.ts b/app/api/__generated__/msw-handlers.ts index e9cf7103f6..f97ded0372 100644 --- a/app/api/__generated__/msw-handlers.ts +++ b/app/api/__generated__/msw-handlers.ts @@ -357,14 +357,6 @@ export interface MSWHandlers { req: Request cookies: Record }) => Promisable - /** `POST /v1/instances/:instance/migrate` */ - instanceMigrate: (params: { - path: Api.InstanceMigratePathParams - query: Api.InstanceMigrateQueryParams - body: Json - req: Request - cookies: Record - }) => Promisable> /** `POST /v1/instances/:instance/reboot` */ instanceReboot: (params: { path: Api.InstanceRebootPathParams @@ -1137,7 +1129,7 @@ export interface MSWHandlers { body: Json req: Request cookies: Record - }) => Promisable> + }) => Promisable> /** `GET /v1/timeseries/schema` */ timeseriesSchemaList: (params: { query: Api.TimeseriesSchemaListQueryParams @@ -1634,14 +1626,6 @@ export function makeHandlers(handlers: MSWHandlers): HttpHandler[] { null ) ), - http.post( - '/v1/instances/:instance/migrate', - handler( - handlers['instanceMigrate'], - schema.InstanceMigrateParams, - schema.InstanceMigrate - ) - ), http.post( '/v1/instances/:instance/reboot', handler(handlers['instanceReboot'], schema.InstanceRebootParams, null) diff --git a/app/api/__generated__/validate.ts b/app/api/__generated__/validate.ts index 8405c4eeb8..38e308bf4f 100644 --- a/app/api/__generated__/validate.ts +++ b/app/api/__generated__/validate.ts @@ -1751,14 +1751,6 @@ export const InstanceCreate = z.preprocess( }) ) -/** - * Migration parameters for an `Instance` - */ -export const InstanceMigrate = z.preprocess( - processResponseBody, - z.object({ dstSledId: z.string().uuid() }) -) - /** * A MAC address * @@ -2133,6 +2125,71 @@ export const NetworkInterface = z.preprocess( }) ) +/** + * List of data values for one timeseries. + * + * Each element is an option, where `None` represents a missing sample. + */ +export const ValueArray = z.preprocess( + processResponseBody, + z.union([ + z.object({ type: z.enum(['integer']), values: z.number().array() }), + z.object({ type: z.enum(['double']), values: z.number().array() }), + z.object({ type: z.enum(['boolean']), values: SafeBoolean.array() }), + z.object({ type: z.enum(['string']), values: z.string().array() }), + z.object({ type: z.enum(['integer_distribution']), values: Distributionint64.array() }), + z.object({ type: z.enum(['double_distribution']), values: Distributiondouble.array() }), + ]) +) + +/** + * A single list of values, for one dimension of a timeseries. + */ +export const Values = z.preprocess( + processResponseBody, + z.object({ metricType: MetricType, values: ValueArray }) +) + +/** + * Timepoints and values for one timeseries. + */ +export const Points = z.preprocess( + processResponseBody, + z.object({ + startTimes: z.coerce.date().array().optional(), + timestamps: z.coerce.date().array(), + values: Values.array(), + }) +) + +/** + * A timeseries contains a timestamped set of values from one source. + * + * This includes the typed key-value pairs that uniquely identify it, and the set of timestamps and data values from it. + */ +export const Timeseries = z.preprocess( + processResponseBody, + z.object({ fields: z.record(z.string().min(1), FieldValue), points: Points }) +) + +/** + * A table represents one or more timeseries with the same schema. + * + * A table is the result of an OxQL query. It contains a name, usually the name of the timeseries schema from which the data is derived, and any number of timeseries, which contain the actual data. + */ +export const Table = z.preprocess( + processResponseBody, + z.object({ name: z.string(), timeseries: z.record(z.string().min(1), Timeseries) }) +) + +/** + * The result of a successful OxQL query. + */ +export const OxqlQueryResult = z.preprocess( + processResponseBody, + z.object({ tables: Table.array() }) +) + /** * A password used to authenticate a user * @@ -2197,43 +2254,6 @@ export const PingStatus = z.preprocess(processResponseBody, z.enum(['ok'])) export const Ping = z.preprocess(processResponseBody, z.object({ status: PingStatus })) -/** - * List of data values for one timeseries. - * - * Each element is an option, where `None` represents a missing sample. - */ -export const ValueArray = z.preprocess( - processResponseBody, - z.union([ - z.object({ type: z.enum(['integer']), values: z.number().array() }), - z.object({ type: z.enum(['double']), values: z.number().array() }), - z.object({ type: z.enum(['boolean']), values: SafeBoolean.array() }), - z.object({ type: z.enum(['string']), values: z.string().array() }), - z.object({ type: z.enum(['integer_distribution']), values: Distributionint64.array() }), - z.object({ type: z.enum(['double_distribution']), values: Distributiondouble.array() }), - ]) -) - -/** - * A single list of values, for one dimension of a timeseries. - */ -export const Values = z.preprocess( - processResponseBody, - z.object({ metricType: MetricType, values: ValueArray }) -) - -/** - * Timepoints and values for one timeseries. - */ -export const Points = z.preprocess( - processResponseBody, - z.object({ - startTimes: z.coerce.date().array().optional(), - timestamps: z.coerce.date().array(), - values: Values.array(), - }) -) - /** * Identity-related metadata that's included in nearly all public API objects */ @@ -3162,26 +3182,6 @@ export const SwitchResultsPage = z.preprocess( z.object({ items: Switch.array(), nextPage: z.string().optional() }) ) -/** - * A timeseries contains a timestamped set of values from one source. - * - * This includes the typed key-value pairs that uniquely identify it, and the set of timestamps and data values from it. - */ -export const Timeseries = z.preprocess( - processResponseBody, - z.object({ fields: z.record(z.string().min(1), FieldValue), points: Points }) -) - -/** - * A table represents one or more timeseries with the same schema. - * - * A table is the result of an OxQL query. It contains a name, usually the name of the timeseries schema from which the data is derived, and any number of timeseries, which contain the actual data. - */ -export const Table = z.preprocess( - processResponseBody, - z.object({ name: z.string(), timeseries: z.record(z.string().min(1), Timeseries) }) -) - /** * Text descriptions for the target and metric of a timeseries. */ @@ -4211,18 +4211,6 @@ export const InstanceEphemeralIpDetachParams = z.preprocess( }) ) -export const InstanceMigrateParams = z.preprocess( - processResponseBody, - z.object({ - path: z.object({ - instance: NameOrId, - }), - query: z.object({ - project: NameOrId.optional(), - }), - }) -) - export const InstanceRebootParams = z.preprocess( processResponseBody, z.object({ diff --git a/app/api/window.ts b/app/api/window.ts index 7b095ac575..256967f49e 100644 --- a/app/api/window.ts +++ b/app/api/window.ts @@ -42,7 +42,7 @@ if (typeof window !== 'undefined') { window.oxql = { query: async (q: string) => { const result = await api.methods.timeseriesQuery({ body: { query: q } }) - const data = handleResult(result) + const data = handleResult(result).tables logHeading(data.length + ' timeseries returned') for (const table of data) { for (const ts of Object.values(table.timeseries)) { diff --git a/mock-api/msw/handlers.ts b/mock-api/msw/handlers.ts index 67dfe200c1..509b39a405 100644 --- a/mock-api/msw/handlers.ts +++ b/mock-api/msw/handlers.ts @@ -1408,7 +1408,6 @@ export const handlers = makeHandlers({ certificateDelete: NotImplemented, certificateList: NotImplemented, certificateView: NotImplemented, - instanceMigrate: NotImplemented, instanceSerialConsoleStream: NotImplemented, instanceSshPublicKeyList: NotImplemented, ipPoolServiceRangeAdd: NotImplemented,