From 9e1cd02c41c8c4d7c4343ccacf0ee287b6ddc256 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 1 Jul 2024 10:55:16 +0800 Subject: [PATCH 1/2] chore: bump preset plugins version (#6225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area core /kind improvement /milestone 2.17.x #### What this PR does / why we need it: 更新预设插件的版本。 #### Does this PR introduce a user-facing change? ```release-note None ``` --- application/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/build.gradle b/application/build.gradle index 746030c228..fe11d0f32e 100644 --- a/application/build.gradle +++ b/application/build.gradle @@ -107,7 +107,7 @@ tasks.named('jacocoTestReport', JacocoReport) { } ext.presetPluginUrls = [ - 'https://github.com/halo-dev/plugin-comment-widget/releases/download/v2.1.0/plugin-comment-widget-2.1.0.jar' : 'plugin-comment-widget.jar', + 'https://github.com/halo-dev/plugin-comment-widget/releases/download/v2.3.1/plugin-comment-widget-2.3.1.jar' : 'plugin-comment-widget.jar', 'https://github.com/halo-dev/plugin-search-widget/releases/download/v1.4.0/plugin-search-widget-1.4.0.jar' : 'plugin-search-widget.jar', 'https://github.com/halo-dev/plugin-sitemap/releases/download/v1.1.1/plugin-sitemap-1.1.1.jar' : 'plugin-sitemap.jar', 'https://github.com/halo-dev/plugin-feed/releases/download/v1.2.2/plugin-feed-1.2.2.jar' : 'plugin-feed.jar', @@ -115,7 +115,7 @@ ext.presetPluginUrls = [ // Currently, plugin-app-store is not open source, so we need to download it from the official website. // Please see https://github.com/halo-dev/plugin-app-store/issues/55 // https://www.halo.run/store/apps/app-VYJbF - 'https://www.halo.run/store/apps/app-VYJbF/releases/download/app-release-yfjXe/assets/app-release-yfjXe-kOzZZ': 'appstore.jar', + 'https://www.halo.run/store/apps/app-VYJbF/releases/download/app-release-SRWfv/assets/app-release-SRWfv-VLtMA': 'appstore.jar', ] tasks.register('downloadPluginPresets', Download) { From ceb97458d430a0efcaa4d25f7686d60daaefed46 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 1 Jul 2024 11:05:16 +0800 Subject: [PATCH 2/2] fix: correct the kind definition in the Device extension (#6222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area core /kind bug /milestone 2.17.x #### What this PR does / why we need it: 修复 Device 模型中,Kind 定义错误的问题。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/6221 #### Does this PR introduce a user-facing change? ```release-note None ``` --- api-docs/openapi/v3_0/aggregated.json | 156 ++-- .../v3_0/apis_extension.api_v1alpha1.json | 156 ++-- .../run/halo/app/core/extension/Device.java | 2 +- .../api-client/src/.openapi-generator/FILES | 4 +- ui/packages/api-client/src/api.ts | 2 +- .../api-client/src/api/device-v1alpha1-api.ts | 665 ++++++++++++++++++ .../api-client/src/models/device-list.ts | 4 +- ui/packages/api-client/src/models/index.ts | 2 +- 8 files changed, 828 insertions(+), 163 deletions(-) create mode 100644 ui/packages/api-client/src/api/device-v1alpha1-api.ts diff --git a/api-docs/openapi/v3_0/aggregated.json b/api-docs/openapi/v3_0/aggregated.json index cedcccda86..69471b6ad0 100644 --- a/api-docs/openapi/v3_0/aggregated.json +++ b/api-docs/openapi/v3_0/aggregated.json @@ -12186,8 +12186,8 @@ }, "/apis/security.halo.run/v1alpha1/devices": { "get": { - "description": "List v1alpha1", - "operationId": "listv1alpha1", + "description": "List Device", + "operationId": "listDevice", "parameters": [ { "description": "Page number. Default is 0.", @@ -12246,7 +12246,7 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/v1alpha1List" + "$ref": "#/components/schemas/DeviceList" } } }, @@ -12254,12 +12254,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "post": { - "description": "Create v1alpha1", - "operationId": "createv1alpha1", + "description": "Create Device", + "operationId": "createDevice", "requestBody": { "content": { "*/*": { @@ -12283,14 +12283,14 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] } }, "/apis/security.halo.run/v1alpha1/devices/{name}": { "delete": { - "description": "Delete v1alpha1", - "operationId": "deletev1alpha1", + "description": "Delete Device", + "operationId": "deleteDevice", "parameters": [ { "description": "Name of device", @@ -12308,12 +12308,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "get": { - "description": "Get v1alpha1", - "operationId": "getv1alpha1", + "description": "Get Device", + "operationId": "getDevice", "parameters": [ { "description": "Name of device", @@ -12338,12 +12338,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "patch": { - "description": "Patch v1alpha1", - "operationId": "patchv1alpha1", + "description": "Patch Device", + "operationId": "patchDevice", "parameters": [ { "description": "Name of device", @@ -12377,12 +12377,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "put": { - "description": "Update v1alpha1", - "operationId": "updatev1alpha1", + "description": "Update Device", + "operationId": "updateDevice", "parameters": [ { "description": "Name of device", @@ -12417,7 +12417,7 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] } }, @@ -16646,6 +16646,65 @@ } } }, + "DeviceList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/Device" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, "DeviceSpec": { "required": [ "ipAddress", @@ -22939,65 +22998,6 @@ "type": "string" } } - }, - "v1alpha1List": { - "required": [ - "first", - "hasNext", - "hasPrevious", - "items", - "last", - "page", - "size", - "total", - "totalPages" - ], - "type": "object", - "properties": { - "first": { - "type": "boolean", - "description": "Indicates whether current page is the first page." - }, - "hasNext": { - "type": "boolean", - "description": "Indicates whether current page has previous page." - }, - "hasPrevious": { - "type": "boolean", - "description": "Indicates whether current page has previous page." - }, - "items": { - "type": "array", - "description": "A chunk of items.", - "items": { - "$ref": "#/components/schemas/Device" - } - }, - "last": { - "type": "boolean", - "description": "Indicates whether current page is the last page." - }, - "page": { - "type": "integer", - "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", - "format": "int32" - }, - "size": { - "type": "integer", - "description": "Size of each page. If not set or equal to 0, it means no pagination.", - "format": "int32" - }, - "total": { - "type": "integer", - "description": "Total elements.", - "format": "int64" - }, - "totalPages": { - "type": "integer", - "description": "Indicates total pages.", - "format": "int64" - } - } } }, "securitySchemes": { diff --git a/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json b/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json index 7e54af902b..14c0fad330 100644 --- a/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json +++ b/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json @@ -5944,8 +5944,8 @@ }, "/apis/security.halo.run/v1alpha1/devices": { "get": { - "description": "List v1alpha1", - "operationId": "listv1alpha1", + "description": "List Device", + "operationId": "listDevice", "parameters": [ { "description": "Page number. Default is 0.", @@ -6004,7 +6004,7 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/v1alpha1List" + "$ref": "#/components/schemas/DeviceList" } } }, @@ -6012,12 +6012,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "post": { - "description": "Create v1alpha1", - "operationId": "createv1alpha1", + "description": "Create Device", + "operationId": "createDevice", "requestBody": { "content": { "*/*": { @@ -6041,14 +6041,14 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] } }, "/apis/security.halo.run/v1alpha1/devices/{name}": { "delete": { - "description": "Delete v1alpha1", - "operationId": "deletev1alpha1", + "description": "Delete Device", + "operationId": "deleteDevice", "parameters": [ { "description": "Name of device", @@ -6066,12 +6066,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "get": { - "description": "Get v1alpha1", - "operationId": "getv1alpha1", + "description": "Get Device", + "operationId": "getDevice", "parameters": [ { "description": "Name of device", @@ -6096,12 +6096,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "patch": { - "description": "Patch v1alpha1", - "operationId": "patchv1alpha1", + "description": "Patch Device", + "operationId": "patchDevice", "parameters": [ { "description": "Name of device", @@ -6135,12 +6135,12 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] }, "put": { - "description": "Update v1alpha1", - "operationId": "updatev1alpha1", + "description": "Update Device", + "operationId": "updateDevice", "parameters": [ { "description": "Name of device", @@ -6175,7 +6175,7 @@ } }, "tags": [ - "v1alpha1V1alpha1" + "DeviceV1alpha1" ] } }, @@ -9042,6 +9042,65 @@ } } }, + "DeviceList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/Device" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, "DeviceSpec": { "required": [ "ipAddress", @@ -12624,65 +12683,6 @@ "type": "string" } } - }, - "v1alpha1List": { - "required": [ - "first", - "hasNext", - "hasPrevious", - "items", - "last", - "page", - "size", - "total", - "totalPages" - ], - "type": "object", - "properties": { - "first": { - "type": "boolean", - "description": "Indicates whether current page is the first page." - }, - "hasNext": { - "type": "boolean", - "description": "Indicates whether current page has previous page." - }, - "hasPrevious": { - "type": "boolean", - "description": "Indicates whether current page has previous page." - }, - "items": { - "type": "array", - "description": "A chunk of items.", - "items": { - "$ref": "#/components/schemas/Device" - } - }, - "last": { - "type": "boolean", - "description": "Indicates whether current page is the last page." - }, - "page": { - "type": "integer", - "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", - "format": "int32" - }, - "size": { - "type": "integer", - "description": "Size of each page. If not set or equal to 0, it means no pagination.", - "format": "int32" - }, - "total": { - "type": "integer", - "description": "Total elements.", - "format": "int64" - }, - "totalPages": { - "type": "integer", - "description": "Indicates total pages.", - "format": "int64" - } - } } }, "securitySchemes": { diff --git a/api/src/main/java/run/halo/app/core/extension/Device.java b/api/src/main/java/run/halo/app/core/extension/Device.java index 8410e6472c..40f4043038 100644 --- a/api/src/main/java/run/halo/app/core/extension/Device.java +++ b/api/src/main/java/run/halo/app/core/extension/Device.java @@ -19,7 +19,7 @@ public class Device extends AbstractExtension { public static final String GROUP = "security.halo.run"; public static final String VERSION = "v1alpha1"; - public static final String KIND = "v1alpha1"; + public static final String KIND = "Device"; @Schema(requiredMode = REQUIRED) private Spec spec; diff --git a/ui/packages/api-client/src/.openapi-generator/FILES b/ui/packages/api-client/src/.openapi-generator/FILES index 0b379107cb..60d5bb0b0c 100644 --- a/ui/packages/api-client/src/.openapi-generator/FILES +++ b/ui/packages/api-client/src/.openapi-generator/FILES @@ -16,6 +16,7 @@ api/comment-v1alpha1-console-api.ts api/comment-v1alpha1-public-api.ts api/config-map-v1alpha1-api.ts api/counter-v1alpha1-api.ts +api/device-v1alpha1-api.ts api/device-v1alpha1-uc-api.ts api/extension-definition-v1alpha1-api.ts api/extension-point-definition-v1alpha1-api.ts @@ -74,7 +75,6 @@ api/user-connection-v1alpha1-api.ts api/user-v1alpha1-api.ts api/user-v1alpha1-console-api.ts api/user-v1alpha1-public-api.ts -api/v1alpha1-v1alpha1-api.ts base.ts common.ts configuration.ts @@ -135,6 +135,7 @@ models/create-user-request.ts models/custom-templates.ts models/dashboard-stats.ts models/detailed-user.ts +models/device-list.ts models/device-spec.ts models/device-status.ts models/device.ts @@ -327,6 +328,5 @@ models/user-permission.ts models/user-spec.ts models/user-status.ts models/user.ts -models/v1alpha1-list.ts models/verify-code-request.ts models/vote-request.ts diff --git a/ui/packages/api-client/src/api.ts b/ui/packages/api-client/src/api.ts index 6b9861e91e..b69fa96905 100644 --- a/ui/packages/api-client/src/api.ts +++ b/ui/packages/api-client/src/api.ts @@ -29,6 +29,7 @@ export * from './api/comment-v1alpha1-console-api'; export * from './api/comment-v1alpha1-public-api'; export * from './api/config-map-v1alpha1-api'; export * from './api/counter-v1alpha1-api'; +export * from './api/device-v1alpha1-api'; export * from './api/device-v1alpha1-uc-api'; export * from './api/extension-definition-v1alpha1-api'; export * from './api/extension-point-definition-v1alpha1-api'; @@ -87,5 +88,4 @@ export * from './api/user-connection-v1alpha1-api'; export * from './api/user-v1alpha1-api'; export * from './api/user-v1alpha1-console-api'; export * from './api/user-v1alpha1-public-api'; -export * from './api/v1alpha1-v1alpha1-api'; diff --git a/ui/packages/api-client/src/api/device-v1alpha1-api.ts b/ui/packages/api-client/src/api/device-v1alpha1-api.ts new file mode 100644 index 0000000000..9736fdbfa1 --- /dev/null +++ b/ui/packages/api-client/src/api/device-v1alpha1-api.ts @@ -0,0 +1,665 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Halo + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.17.0-SNAPSHOT + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import { Device } from '../models'; +// @ts-ignore +import { DeviceList } from '../models'; +// @ts-ignore +import { JsonPatchInner } from '../models'; +/** + * DeviceV1alpha1Api - axios parameter creator + * @export + */ +export const DeviceV1alpha1ApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Create Device + * @param {Device} [device] Fresh device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createDevice: async (device?: Device, options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/apis/security.halo.run/v1alpha1/devices`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(device, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Delete Device + * @param {string} name Name of device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteDevice: async (name: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists('deleteDevice', 'name', name) + const localVarPath = `/apis/security.halo.run/v1alpha1/devices/{name}` + .replace(`{${"name"}}`, encodeURIComponent(String(name))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Get Device + * @param {string} name Name of device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDevice: async (name: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists('getDevice', 'name', name) + const localVarPath = `/apis/security.halo.run/v1alpha1/devices/{name}` + .replace(`{${"name"}}`, encodeURIComponent(String(name))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * List Device + * @param {number} [page] Page number. Default is 0. + * @param {number} [size] Size number. Default is 0. + * @param {Array} [labelSelector] Label selector. e.g.: hidden!=true + * @param {Array} [fieldSelector] Field selector. e.g.: metadata.name==halo + * @param {Array} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listDevice: async (page?: number, size?: number, labelSelector?: Array, fieldSelector?: Array, sort?: Array, options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/apis/security.halo.run/v1alpha1/devices`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (size !== undefined) { + localVarQueryParameter['size'] = size; + } + + if (labelSelector) { + localVarQueryParameter['labelSelector'] = labelSelector; + } + + if (fieldSelector) { + localVarQueryParameter['fieldSelector'] = fieldSelector; + } + + if (sort) { + localVarQueryParameter['sort'] = sort; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Patch Device + * @param {string} name Name of device + * @param {Array} [jsonPatchInner] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchDevice: async (name: string, jsonPatchInner?: Array, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists('patchDevice', 'name', name) + const localVarPath = `/apis/security.halo.run/v1alpha1/devices/{name}` + .replace(`{${"name"}}`, encodeURIComponent(String(name))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json-patch+json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(jsonPatchInner, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Update Device + * @param {string} name Name of device + * @param {Device} [device] Updated device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateDevice: async (name: string, device?: Device, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists('updateDevice', 'name', name) + const localVarPath = `/apis/security.halo.run/v1alpha1/devices/{name}` + .replace(`{${"name"}}`, encodeURIComponent(String(name))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication basicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(device, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DeviceV1alpha1Api - functional programming interface + * @export + */ +export const DeviceV1alpha1ApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DeviceV1alpha1ApiAxiosParamCreator(configuration) + return { + /** + * Create Device + * @param {Device} [device] Fresh device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createDevice(device?: Device, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createDevice(device, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.createDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Delete Device + * @param {string} name Name of device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteDevice(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteDevice(name, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.deleteDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Get Device + * @param {string} name Name of device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getDevice(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getDevice(name, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.getDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * List Device + * @param {number} [page] Page number. Default is 0. + * @param {number} [size] Size number. Default is 0. + * @param {Array} [labelSelector] Label selector. e.g.: hidden!=true + * @param {Array} [fieldSelector] Field selector. e.g.: metadata.name==halo + * @param {Array} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listDevice(page?: number, size?: number, labelSelector?: Array, fieldSelector?: Array, sort?: Array, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listDevice(page, size, labelSelector, fieldSelector, sort, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.listDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Patch Device + * @param {string} name Name of device + * @param {Array} [jsonPatchInner] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async patchDevice(name: string, jsonPatchInner?: Array, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.patchDevice(name, jsonPatchInner, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.patchDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Update Device + * @param {string} name Name of device + * @param {Device} [device] Updated device + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateDevice(name: string, device?: Device, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateDevice(name, device, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['DeviceV1alpha1Api.updateDevice']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * DeviceV1alpha1Api - factory interface + * @export + */ +export const DeviceV1alpha1ApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DeviceV1alpha1ApiFp(configuration) + return { + /** + * Create Device + * @param {DeviceV1alpha1ApiCreateDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createDevice(requestParameters: DeviceV1alpha1ApiCreateDeviceRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.createDevice(requestParameters.device, options).then((request) => request(axios, basePath)); + }, + /** + * Delete Device + * @param {DeviceV1alpha1ApiDeleteDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteDevice(requestParameters: DeviceV1alpha1ApiDeleteDeviceRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.deleteDevice(requestParameters.name, options).then((request) => request(axios, basePath)); + }, + /** + * Get Device + * @param {DeviceV1alpha1ApiGetDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDevice(requestParameters: DeviceV1alpha1ApiGetDeviceRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getDevice(requestParameters.name, options).then((request) => request(axios, basePath)); + }, + /** + * List Device + * @param {DeviceV1alpha1ApiListDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listDevice(requestParameters: DeviceV1alpha1ApiListDeviceRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.listDevice(requestParameters.page, requestParameters.size, requestParameters.labelSelector, requestParameters.fieldSelector, requestParameters.sort, options).then((request) => request(axios, basePath)); + }, + /** + * Patch Device + * @param {DeviceV1alpha1ApiPatchDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchDevice(requestParameters: DeviceV1alpha1ApiPatchDeviceRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.patchDevice(requestParameters.name, requestParameters.jsonPatchInner, options).then((request) => request(axios, basePath)); + }, + /** + * Update Device + * @param {DeviceV1alpha1ApiUpdateDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateDevice(requestParameters: DeviceV1alpha1ApiUpdateDeviceRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.updateDevice(requestParameters.name, requestParameters.device, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for createDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiCreateDeviceRequest + */ +export interface DeviceV1alpha1ApiCreateDeviceRequest { + /** + * Fresh device + * @type {Device} + * @memberof DeviceV1alpha1ApiCreateDevice + */ + readonly device?: Device +} + +/** + * Request parameters for deleteDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiDeleteDeviceRequest + */ +export interface DeviceV1alpha1ApiDeleteDeviceRequest { + /** + * Name of device + * @type {string} + * @memberof DeviceV1alpha1ApiDeleteDevice + */ + readonly name: string +} + +/** + * Request parameters for getDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiGetDeviceRequest + */ +export interface DeviceV1alpha1ApiGetDeviceRequest { + /** + * Name of device + * @type {string} + * @memberof DeviceV1alpha1ApiGetDevice + */ + readonly name: string +} + +/** + * Request parameters for listDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiListDeviceRequest + */ +export interface DeviceV1alpha1ApiListDeviceRequest { + /** + * Page number. Default is 0. + * @type {number} + * @memberof DeviceV1alpha1ApiListDevice + */ + readonly page?: number + + /** + * Size number. Default is 0. + * @type {number} + * @memberof DeviceV1alpha1ApiListDevice + */ + readonly size?: number + + /** + * Label selector. e.g.: hidden!=true + * @type {Array} + * @memberof DeviceV1alpha1ApiListDevice + */ + readonly labelSelector?: Array + + /** + * Field selector. e.g.: metadata.name==halo + * @type {Array} + * @memberof DeviceV1alpha1ApiListDevice + */ + readonly fieldSelector?: Array + + /** + * Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported. + * @type {Array} + * @memberof DeviceV1alpha1ApiListDevice + */ + readonly sort?: Array +} + +/** + * Request parameters for patchDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiPatchDeviceRequest + */ +export interface DeviceV1alpha1ApiPatchDeviceRequest { + /** + * Name of device + * @type {string} + * @memberof DeviceV1alpha1ApiPatchDevice + */ + readonly name: string + + /** + * + * @type {Array} + * @memberof DeviceV1alpha1ApiPatchDevice + */ + readonly jsonPatchInner?: Array +} + +/** + * Request parameters for updateDevice operation in DeviceV1alpha1Api. + * @export + * @interface DeviceV1alpha1ApiUpdateDeviceRequest + */ +export interface DeviceV1alpha1ApiUpdateDeviceRequest { + /** + * Name of device + * @type {string} + * @memberof DeviceV1alpha1ApiUpdateDevice + */ + readonly name: string + + /** + * Updated device + * @type {Device} + * @memberof DeviceV1alpha1ApiUpdateDevice + */ + readonly device?: Device +} + +/** + * DeviceV1alpha1Api - object-oriented interface + * @export + * @class DeviceV1alpha1Api + * @extends {BaseAPI} + */ +export class DeviceV1alpha1Api extends BaseAPI { + /** + * Create Device + * @param {DeviceV1alpha1ApiCreateDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public createDevice(requestParameters: DeviceV1alpha1ApiCreateDeviceRequest = {}, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).createDevice(requestParameters.device, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Delete Device + * @param {DeviceV1alpha1ApiDeleteDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public deleteDevice(requestParameters: DeviceV1alpha1ApiDeleteDeviceRequest, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).deleteDevice(requestParameters.name, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Get Device + * @param {DeviceV1alpha1ApiGetDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public getDevice(requestParameters: DeviceV1alpha1ApiGetDeviceRequest, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).getDevice(requestParameters.name, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * List Device + * @param {DeviceV1alpha1ApiListDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public listDevice(requestParameters: DeviceV1alpha1ApiListDeviceRequest = {}, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).listDevice(requestParameters.page, requestParameters.size, requestParameters.labelSelector, requestParameters.fieldSelector, requestParameters.sort, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Patch Device + * @param {DeviceV1alpha1ApiPatchDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public patchDevice(requestParameters: DeviceV1alpha1ApiPatchDeviceRequest, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).patchDevice(requestParameters.name, requestParameters.jsonPatchInner, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Update Device + * @param {DeviceV1alpha1ApiUpdateDeviceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DeviceV1alpha1Api + */ + public updateDevice(requestParameters: DeviceV1alpha1ApiUpdateDeviceRequest, options?: RawAxiosRequestConfig) { + return DeviceV1alpha1ApiFp(this.configuration).updateDevice(requestParameters.name, requestParameters.device, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/ui/packages/api-client/src/models/device-list.ts b/ui/packages/api-client/src/models/device-list.ts index 1332f13808..631da5cae8 100644 --- a/ui/packages/api-client/src/models/device-list.ts +++ b/ui/packages/api-client/src/models/device-list.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ /** - * Halo Next API + * Halo * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * - * The version of the OpenAPI document: 2.0.0 + * The version of the OpenAPI document: 2.17.0-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/packages/api-client/src/models/index.ts b/ui/packages/api-client/src/models/index.ts index b3227ced61..a7e4a24a47 100644 --- a/ui/packages/api-client/src/models/index.ts +++ b/ui/packages/api-client/src/models/index.ts @@ -54,6 +54,7 @@ export * from './custom-templates'; export * from './dashboard-stats'; export * from './detailed-user'; export * from './device'; +export * from './device-list'; export * from './device-spec'; export * from './device-status'; export * from './email-config-validation-request'; @@ -244,6 +245,5 @@ export * from './user-list'; export * from './user-permission'; export * from './user-spec'; export * from './user-status'; -export * from './v1alpha1-list'; export * from './verify-code-request'; export * from './vote-request';