3 Commits

Author SHA1 Message Date
longjuan
97f653bd42 feat: support selecting groups to join when link (#165)
fixes https://github.com/halo-dev/plugin-s3/issues/152
```release-note
S3关联时支持选择加入的分组
```
![image](https://github.com/user-attachments/assets/2380688c-3e04-4485-986d-b9118e05fe95)
2024-07-31 04:40:03 +00:00
longjuan
d4df735759 perf: refactor API request implementation and upgrade Halo dependency to 2.17 (#163)
使用 openapi-generator 重构请求库
使用 @halo-dev/api-client 提供的axiosInstance
提升所有 Halo 依赖版本至2.17
```release-note
None
```
2024-07-14 15:27:27 +00:00
longjuan
63be3ed3dc chore: bump version to 1.11.0 (#164)
```release-note
None
```
2024-07-14 15:25:26 +00:00
69 changed files with 6178 additions and 2889 deletions

View File

@@ -2,11 +2,15 @@ plugins {
id 'java'
id "com.github.node-gradle.node" version "5.0.0"
id "io.freefair.lombok" version "8.0.1"
id "run.halo.plugin.devtools" version "0.0.7"
id "run.halo.plugin.devtools" version "0.0.9"
id 'org.openapi.generator' version '7.7.0'
}
group 'run.halo.s3os'
sourceCompatibility = JavaVersion.VERSION_17
java {
sourceCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
@@ -16,7 +20,7 @@ repositories {
}
dependencies {
implementation platform('run.halo.tools.platform:plugin:2.14.0-SNAPSHOT')
implementation platform('run.halo.tools.platform:plugin:2.17.0-SNAPSHOT')
compileOnly 'run.halo.app:api'
implementation platform('software.amazon.awssdk:bom:2.19.8')
@@ -36,7 +40,7 @@ configurations.runtimeClasspath {
halo {
version = '2.14.0'
version = '2.17.0'
}
haloPlugin {
@@ -67,3 +71,29 @@ build {
// build frontend before build
tasks.getByName('compileJava').dependsOn('buildFrontend')
}
task downloadOpenApiSpec {
doLast {
def url = 'http://localhost:8090/v3/api-docs/plugin-s3'
def file = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile
file.parentFile.mkdirs()
file.text = new URL(url).text
}
}
openApiGenerate {
generatorName = "typescript-axios"
inputSpec = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile.getAbsolutePath()
outputDir = "${projectDir}/console/src/api"
additionalProperties = [
useES6: true,
useSingleRequestParameter: true,
withSeparateModelsAndApi: true,
apiPackage: "api",
modelPackage: "models"
]
typeMappings = [
set: "Array"
]
}

View File

@@ -1,5 +1,5 @@
{
"name": "@halo-dev/plugin-starter",
"name": "@halo-dev/plugin-s3",
"version": "1.0.0",
"private": true,
"scripts": {
@@ -11,38 +11,40 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/api-client": "^2.11.0",
"@halo-dev/components": "^1.10.0",
"@halo-dev/console-shared": "^2.11.0",
"@halo-dev/api-client": "^2.17.0",
"@halo-dev/components": "^2.17.0",
"@halo-dev/console-shared": "^2.17.0",
"@tanstack/vue-query": "4.29.1",
"axios": "^1.4.0",
"axios": "^1.7.2",
"canvas-confetti": "^1.6.0",
"path-browserify": "^1.0.1",
"vue": "^3.3.4"
"vue": "^3.4.27"
},
"devDependencies": {
"@halo-dev/ui-plugin-bundler-kit": "^2.12.0",
"@halo-dev/ui-plugin-bundler-kit": "^2.17.0",
"@iconify/json": "^2.2.18",
"@rushstack/eslint-patch": "^1.2.0",
"@tsconfig/node18": "^18.2.4",
"@types/canvas-confetti": "^1.6.0",
"@types/jsdom": "^20.0.0",
"@types/node": "^16.18.0",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue-jsx": "^2.0.1",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.2.0",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.26.0",
"eslint-plugin-vue": "^9.6.0",
"jsdom": "^19.0.0",
"@types/node": "^18.11.19",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.43.0",
"eslint-plugin-vue": "^9.17.0",
"jsdom": "^20.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"sass": "^1.58.0",
"typescript": "~4.7.4",
"typescript": "~5.3.0",
"unplugin-icons": "^0.15.2",
"vite": "^3.1.8",
"vitest": "^0.24.3",
"vue-tsc": "^1.0.9"
"vite": "^5.0.0",
"vitest": "^0.34.1",
"vue-router": "^4.4.0",
"vue-tsc": "^1.8.27"
}
}

6348
console/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

4
console/src/api/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist

View File

@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm

View File

@@ -0,0 +1,25 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
git_push.sh

View File

@@ -0,0 +1,31 @@
.gitignore
.npmignore
api.ts
api/policy-config-validation-controller-api.ts
api/s3-link-controller-api.ts
api/s3-unlink-controller-api.ts
base.ts
common.ts
configuration.ts
index.ts
models/add-operation.ts
models/attachment-spec.ts
models/attachment-status.ts
models/attachment.ts
models/copy-operation.ts
models/index.ts
models/json-patch-inner.ts
models/link-request.ts
models/link-result-item.ts
models/link-result.ts
models/metadata.ts
models/move-operation.ts
models/object-vo.ts
models/policy-spec.ts
models/policy.ts
models/remove-operation.ts
models/replace-operation.ts
models/s3-list-result.ts
models/s3-os-properties.ts
models/test-operation.ts
models/url-suffix-item.ts

View File

@@ -0,0 +1 @@
7.7.0

20
console/src/api/api.ts Normal file
View File

@@ -0,0 +1,20 @@
/* 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.18.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.
*/
export * from './api/policy-config-validation-controller-api';
export * from './api/s3-link-controller-api';
export * from './api/s3-unlink-controller-api';

View File

@@ -0,0 +1,151 @@
/* 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.18.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, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { S3OsProperties } from '../models';
/**
* PolicyConfigValidationControllerApi - axios parameter creator
* @export
*/
export const PolicyConfigValidationControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {S3OsProperties} s3OsProperties
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
validatePolicyConfig: async (s3OsProperties: S3OsProperties, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 's3OsProperties' is not null or undefined
assertParamExists('validatePolicyConfig', 's3OsProperties', s3OsProperties)
const localVarPath = `/apis/s3os.halo.run/v1alpha1/policies/s3/validation`;
// 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(s3OsProperties, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* PolicyConfigValidationControllerApi - functional programming interface
* @export
*/
export const PolicyConfigValidationControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = PolicyConfigValidationControllerApiAxiosParamCreator(configuration)
return {
/**
*
* @param {S3OsProperties} s3OsProperties
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async validatePolicyConfig(s3OsProperties: S3OsProperties, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.validatePolicyConfig(s3OsProperties, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['PolicyConfigValidationControllerApi.validatePolicyConfig']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* PolicyConfigValidationControllerApi - factory interface
* @export
*/
export const PolicyConfigValidationControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = PolicyConfigValidationControllerApiFp(configuration)
return {
/**
*
* @param {PolicyConfigValidationControllerApiValidatePolicyConfigRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
validatePolicyConfig(requestParameters: PolicyConfigValidationControllerApiValidatePolicyConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.validatePolicyConfig(requestParameters.s3OsProperties, options).then((request) => request(axios, basePath));
},
};
};
/**
* Request parameters for validatePolicyConfig operation in PolicyConfigValidationControllerApi.
* @export
* @interface PolicyConfigValidationControllerApiValidatePolicyConfigRequest
*/
export interface PolicyConfigValidationControllerApiValidatePolicyConfigRequest {
/**
*
* @type {S3OsProperties}
* @memberof PolicyConfigValidationControllerApiValidatePolicyConfig
*/
readonly s3OsProperties: S3OsProperties
}
/**
* PolicyConfigValidationControllerApi - object-oriented interface
* @export
* @class PolicyConfigValidationControllerApi
* @extends {BaseAPI}
*/
export class PolicyConfigValidationControllerApi extends BaseAPI {
/**
*
* @param {PolicyConfigValidationControllerApiValidatePolicyConfigRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PolicyConfigValidationControllerApi
*/
public validatePolicyConfig(requestParameters: PolicyConfigValidationControllerApiValidatePolicyConfigRequest, options?: RawAxiosRequestConfig) {
return PolicyConfigValidationControllerApiFp(this.configuration).validatePolicyConfig(requestParameters.s3OsProperties, options).then((request) => request(this.axios, this.basePath));
}
}

View File

@@ -0,0 +1,377 @@
/* 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.18.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, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { LinkRequest } from '../models';
// @ts-ignore
import type { LinkResult } from '../models';
// @ts-ignore
import type { Policy } from '../models';
// @ts-ignore
import type { S3ListResult } from '../models';
/**
* S3LinkControllerApi - axios parameter creator
* @export
*/
export const S3LinkControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {LinkRequest} linkRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addAttachmentRecord: async (linkRequest: LinkRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'linkRequest' is not null or undefined
assertParamExists('addAttachmentRecord', 'linkRequest', linkRequest)
const localVarPath = `/apis/s3os.halo.run/v1alpha1/attachments/link`;
// 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(linkRequest, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {string} policyName
* @param {number} pageSize
* @param {string} [continuationToken]
* @param {string} [continuationObject]
* @param {boolean} [unlinked]
* @param {string} [filePrefix]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listObjects: async (policyName: string, pageSize: number, continuationToken?: string, continuationObject?: string, unlinked?: boolean, filePrefix?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'policyName' is not null or undefined
assertParamExists('listObjects', 'policyName', policyName)
// verify required parameter 'pageSize' is not null or undefined
assertParamExists('listObjects', 'pageSize', pageSize)
const localVarPath = `/apis/s3os.halo.run/v1alpha1/objects/{policyName}`
.replace(`{${"policyName"}}`, encodeURIComponent(String(policyName)));
// 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 (continuationToken !== undefined) {
localVarQueryParameter['continuationToken'] = continuationToken;
}
if (continuationObject !== undefined) {
localVarQueryParameter['continuationObject'] = continuationObject;
}
if (pageSize !== undefined) {
localVarQueryParameter['pageSize'] = pageSize;
}
if (unlinked !== undefined) {
localVarQueryParameter['unlinked'] = unlinked;
}
if (filePrefix !== undefined) {
localVarQueryParameter['filePrefix'] = filePrefix;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listS3Policies: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/apis/s3os.halo.run/v1alpha1/policies/s3`;
// 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,
};
},
}
};
/**
* S3LinkControllerApi - functional programming interface
* @export
*/
export const S3LinkControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = S3LinkControllerApiAxiosParamCreator(configuration)
return {
/**
*
* @param {LinkRequest} linkRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async addAttachmentRecord(linkRequest: LinkRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<LinkResult>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.addAttachmentRecord(linkRequest, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['S3LinkControllerApi.addAttachmentRecord']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {string} policyName
* @param {number} pageSize
* @param {string} [continuationToken]
* @param {string} [continuationObject]
* @param {boolean} [unlinked]
* @param {string} [filePrefix]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listObjects(policyName: string, pageSize: number, continuationToken?: string, continuationObject?: string, unlinked?: boolean, filePrefix?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<S3ListResult>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listObjects(policyName, pageSize, continuationToken, continuationObject, unlinked, filePrefix, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['S3LinkControllerApi.listObjects']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listS3Policies(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Policy>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listS3Policies(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['S3LinkControllerApi.listS3Policies']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* S3LinkControllerApi - factory interface
* @export
*/
export const S3LinkControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = S3LinkControllerApiFp(configuration)
return {
/**
*
* @param {S3LinkControllerApiAddAttachmentRecordRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addAttachmentRecord(requestParameters: S3LinkControllerApiAddAttachmentRecordRequest, options?: RawAxiosRequestConfig): AxiosPromise<LinkResult> {
return localVarFp.addAttachmentRecord(requestParameters.linkRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @param {S3LinkControllerApiListObjectsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listObjects(requestParameters: S3LinkControllerApiListObjectsRequest, options?: RawAxiosRequestConfig): AxiosPromise<S3ListResult> {
return localVarFp.listObjects(requestParameters.policyName, requestParameters.pageSize, requestParameters.continuationToken, requestParameters.continuationObject, requestParameters.unlinked, requestParameters.filePrefix, options).then((request) => request(axios, basePath));
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listS3Policies(options?: RawAxiosRequestConfig): AxiosPromise<Array<Policy>> {
return localVarFp.listS3Policies(options).then((request) => request(axios, basePath));
},
};
};
/**
* Request parameters for addAttachmentRecord operation in S3LinkControllerApi.
* @export
* @interface S3LinkControllerApiAddAttachmentRecordRequest
*/
export interface S3LinkControllerApiAddAttachmentRecordRequest {
/**
*
* @type {LinkRequest}
* @memberof S3LinkControllerApiAddAttachmentRecord
*/
readonly linkRequest: LinkRequest
}
/**
* Request parameters for listObjects operation in S3LinkControllerApi.
* @export
* @interface S3LinkControllerApiListObjectsRequest
*/
export interface S3LinkControllerApiListObjectsRequest {
/**
*
* @type {string}
* @memberof S3LinkControllerApiListObjects
*/
readonly policyName: string
/**
*
* @type {number}
* @memberof S3LinkControllerApiListObjects
*/
readonly pageSize: number
/**
*
* @type {string}
* @memberof S3LinkControllerApiListObjects
*/
readonly continuationToken?: string
/**
*
* @type {string}
* @memberof S3LinkControllerApiListObjects
*/
readonly continuationObject?: string
/**
*
* @type {boolean}
* @memberof S3LinkControllerApiListObjects
*/
readonly unlinked?: boolean
/**
*
* @type {string}
* @memberof S3LinkControllerApiListObjects
*/
readonly filePrefix?: string
}
/**
* S3LinkControllerApi - object-oriented interface
* @export
* @class S3LinkControllerApi
* @extends {BaseAPI}
*/
export class S3LinkControllerApi extends BaseAPI {
/**
*
* @param {S3LinkControllerApiAddAttachmentRecordRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof S3LinkControllerApi
*/
public addAttachmentRecord(requestParameters: S3LinkControllerApiAddAttachmentRecordRequest, options?: RawAxiosRequestConfig) {
return S3LinkControllerApiFp(this.configuration).addAttachmentRecord(requestParameters.linkRequest, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {S3LinkControllerApiListObjectsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof S3LinkControllerApi
*/
public listObjects(requestParameters: S3LinkControllerApiListObjectsRequest, options?: RawAxiosRequestConfig) {
return S3LinkControllerApiFp(this.configuration).listObjects(requestParameters.policyName, requestParameters.pageSize, requestParameters.continuationToken, requestParameters.continuationObject, requestParameters.unlinked, requestParameters.filePrefix, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof S3LinkControllerApi
*/
public listS3Policies(options?: RawAxiosRequestConfig) {
return S3LinkControllerApiFp(this.configuration).listS3Policies(options).then((request) => request(this.axios, this.basePath));
}
}

View File

@@ -0,0 +1,149 @@
/* 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.18.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, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { Attachment } from '../models';
/**
* S3UnlinkControllerApi - axios parameter creator
* @export
*/
export const S3UnlinkControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
unlink: async (name: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'name' is not null or undefined
assertParamExists('unlink', 'name', name)
const localVarPath = `/apis/s3os.halo.run/v1alpha1/attachments/{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,
};
},
}
};
/**
* S3UnlinkControllerApi - functional programming interface
* @export
*/
export const S3UnlinkControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = S3UnlinkControllerApiAxiosParamCreator(configuration)
return {
/**
*
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async unlink(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Attachment>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.unlink(name, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['S3UnlinkControllerApi.unlink']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* S3UnlinkControllerApi - factory interface
* @export
*/
export const S3UnlinkControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = S3UnlinkControllerApiFp(configuration)
return {
/**
*
* @param {S3UnlinkControllerApiUnlinkRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
unlink(requestParameters: S3UnlinkControllerApiUnlinkRequest, options?: RawAxiosRequestConfig): AxiosPromise<Attachment> {
return localVarFp.unlink(requestParameters.name, options).then((request) => request(axios, basePath));
},
};
};
/**
* Request parameters for unlink operation in S3UnlinkControllerApi.
* @export
* @interface S3UnlinkControllerApiUnlinkRequest
*/
export interface S3UnlinkControllerApiUnlinkRequest {
/**
*
* @type {string}
* @memberof S3UnlinkControllerApiUnlink
*/
readonly name: string
}
/**
* S3UnlinkControllerApi - object-oriented interface
* @export
* @class S3UnlinkControllerApi
* @extends {BaseAPI}
*/
export class S3UnlinkControllerApi extends BaseAPI {
/**
*
* @param {S3UnlinkControllerApiUnlinkRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof S3UnlinkControllerApi
*/
public unlink(requestParameters: S3UnlinkControllerApiUnlinkRequest, options?: RawAxiosRequestConfig) {
return S3UnlinkControllerApiFp(this.configuration).unlink(requestParameters.name, options).then((request) => request(this.axios, this.basePath));
}
}

86
console/src/api/base.ts Normal file
View File

@@ -0,0 +1,86 @@
/* 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.18.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';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
export const BASE_PATH = "http://localhost:8090".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: RawAxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath ?? basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}
interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}
/**
*
* @export
*/
export const operationServerMap: ServerMap = {
}

150
console/src/api/common.ts Normal file
View File

@@ -0,0 +1,150 @@
/* 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.18.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 { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View File

@@ -0,0 +1,110 @@
/* 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.18.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.
*/
export interface ConfigurationParameters {
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* override server index
*
* @type {number}
* @memberof Configuration
*/
serverIndex?: number;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
this.serverIndex = param.serverIndex;
this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

18
console/src/api/index.ts Normal file
View File

@@ -0,0 +1,18 @@
/* 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.18.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.
*/
export * from "./api";
export * from "./configuration";
export * from "./models";

View File

@@ -0,0 +1,49 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface AddOperation
*/
export interface AddOperation {
/**
*
* @type {string}
* @memberof AddOperation
*/
'op': AddOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof AddOperation
*/
'path': string;
/**
* Value can be any JSON value
* @type {any}
* @memberof AddOperation
*/
'value': any;
}
export const AddOperationOpEnum = {
Add: 'add'
} as const;
export type AddOperationOpEnum = typeof AddOperationOpEnum[keyof typeof AddOperationOpEnum];

View File

@@ -0,0 +1,66 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface AttachmentSpec
*/
export interface AttachmentSpec {
/**
* Display name of attachment
* @type {string}
* @memberof AttachmentSpec
*/
'displayName'?: string;
/**
* Group name
* @type {string}
* @memberof AttachmentSpec
*/
'groupName'?: string;
/**
* Media type of attachment
* @type {string}
* @memberof AttachmentSpec
*/
'mediaType'?: string;
/**
* Name of User who uploads the attachment
* @type {string}
* @memberof AttachmentSpec
*/
'ownerName'?: string;
/**
* Policy name
* @type {string}
* @memberof AttachmentSpec
*/
'policyName'?: string;
/**
* Size of attachment. Unit is Byte
* @type {number}
* @memberof AttachmentSpec
*/
'size'?: number;
/**
* Tags of attachment
* @type {Array<string>}
* @memberof AttachmentSpec
*/
'tags'?: Array<string>;
}

View File

@@ -0,0 +1,30 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface AttachmentStatus
*/
export interface AttachmentStatus {
/**
* Permalink of attachment. If it is in local storage, the public URL will be set. If it is in s3 storage, the Object URL will be set.
* @type {string}
* @memberof AttachmentStatus
*/
'permalink'?: string;
}

View File

@@ -0,0 +1,63 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { AttachmentSpec } from './attachment-spec';
// May contain unused imports in some cases
// @ts-ignore
import type { AttachmentStatus } from './attachment-status';
// May contain unused imports in some cases
// @ts-ignore
import type { Metadata } from './metadata';
/**
*
* @export
* @interface Attachment
*/
export interface Attachment {
/**
*
* @type {string}
* @memberof Attachment
*/
'apiVersion': string;
/**
*
* @type {string}
* @memberof Attachment
*/
'kind': string;
/**
*
* @type {Metadata}
* @memberof Attachment
*/
'metadata': Metadata;
/**
*
* @type {AttachmentSpec}
* @memberof Attachment
*/
'spec': AttachmentSpec;
/**
*
* @type {AttachmentStatus}
* @memberof Attachment
*/
'status'?: AttachmentStatus;
}

View File

@@ -0,0 +1,49 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface CopyOperation
*/
export interface CopyOperation {
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof CopyOperation
*/
'from': string;
/**
*
* @type {string}
* @memberof CopyOperation
*/
'op': CopyOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof CopyOperation
*/
'path': string;
}
export const CopyOperationOpEnum = {
Copy: 'copy'
} as const;
export type CopyOperationOpEnum = typeof CopyOperationOpEnum[keyof typeof CopyOperationOpEnum];

View File

@@ -0,0 +1,20 @@
export * from './add-operation';
export * from './attachment';
export * from './attachment-spec';
export * from './attachment-status';
export * from './copy-operation';
export * from './json-patch-inner';
export * from './link-request';
export * from './link-result';
export * from './link-result-item';
export * from './metadata';
export * from './move-operation';
export * from './object-vo';
export * from './policy';
export * from './policy-spec';
export * from './remove-operation';
export * from './replace-operation';
export * from './s3-list-result';
export * from './s3-os-properties';
export * from './test-operation';
export * from './url-suffix-item';

View File

@@ -0,0 +1,41 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { AddOperation } from './add-operation';
// May contain unused imports in some cases
// @ts-ignore
import type { CopyOperation } from './copy-operation';
// May contain unused imports in some cases
// @ts-ignore
import type { MoveOperation } from './move-operation';
// May contain unused imports in some cases
// @ts-ignore
import type { RemoveOperation } from './remove-operation';
// May contain unused imports in some cases
// @ts-ignore
import type { ReplaceOperation } from './replace-operation';
// May contain unused imports in some cases
// @ts-ignore
import type { TestOperation } from './test-operation';
/**
* @type JsonPatchInner
* @export
*/
export type JsonPatchInner = AddOperation | CopyOperation | MoveOperation | RemoveOperation | ReplaceOperation | TestOperation;

View File

@@ -0,0 +1,42 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface LinkRequest
*/
export interface LinkRequest {
/**
*
* @type {string}
* @memberof LinkRequest
*/
'groupName'?: string;
/**
*
* @type {Array<string>}
* @memberof LinkRequest
*/
'objectKeys'?: Array<string>;
/**
*
* @type {string}
* @memberof LinkRequest
*/
'policyName'?: string;
}

View File

@@ -0,0 +1,42 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface LinkResultItem
*/
export interface LinkResultItem {
/**
*
* @type {string}
* @memberof LinkResultItem
*/
'message'?: string;
/**
*
* @type {string}
* @memberof LinkResultItem
*/
'objectKey'?: string;
/**
*
* @type {boolean}
* @memberof LinkResultItem
*/
'success'?: boolean;
}

View File

@@ -0,0 +1,33 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { LinkResultItem } from './link-result-item';
/**
*
* @export
* @interface LinkResult
*/
export interface LinkResult {
/**
*
* @type {Array<LinkResultItem>}
* @memberof LinkResult
*/
'items'?: Array<LinkResultItem>;
}

View File

@@ -0,0 +1,72 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface Metadata
*/
export interface Metadata {
/**
*
* @type {{ [key: string]: string; }}
* @memberof Metadata
*/
'annotations'?: { [key: string]: string; };
/**
*
* @type {string}
* @memberof Metadata
*/
'creationTimestamp'?: string | null;
/**
*
* @type {string}
* @memberof Metadata
*/
'deletionTimestamp'?: string | null;
/**
*
* @type {Array<string>}
* @memberof Metadata
*/
'finalizers'?: Array<string> | null;
/**
* The name field will be generated automatically according to the given generateName field
* @type {string}
* @memberof Metadata
*/
'generateName'?: string;
/**
*
* @type {{ [key: string]: string; }}
* @memberof Metadata
*/
'labels'?: { [key: string]: string; };
/**
* Metadata name
* @type {string}
* @memberof Metadata
*/
'name': string;
/**
*
* @type {number}
* @memberof Metadata
*/
'version'?: number | null;
}

View File

@@ -0,0 +1,49 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface MoveOperation
*/
export interface MoveOperation {
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof MoveOperation
*/
'from': string;
/**
*
* @type {string}
* @memberof MoveOperation
*/
'op': MoveOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof MoveOperation
*/
'path': string;
}
export const MoveOperationOpEnum = {
Move: 'move'
} as const;
export type MoveOperationOpEnum = typeof MoveOperationOpEnum[keyof typeof MoveOperationOpEnum];

View File

@@ -0,0 +1,48 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface ObjectVo
*/
export interface ObjectVo {
/**
*
* @type {string}
* @memberof ObjectVo
*/
'displayName'?: string;
/**
*
* @type {boolean}
* @memberof ObjectVo
*/
'isLinked'?: boolean;
/**
*
* @type {string}
* @memberof ObjectVo
*/
'key'?: string;
/**
*
* @type {string}
* @memberof ObjectVo
*/
'lastModified'?: string;
}

View File

@@ -0,0 +1,42 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface PolicySpec
*/
export interface PolicySpec {
/**
* Reference name of ConfigMap extension
* @type {string}
* @memberof PolicySpec
*/
'configMapName'?: string;
/**
* Display name of policy
* @type {string}
* @memberof PolicySpec
*/
'displayName': string;
/**
* Reference name of PolicyTemplate
* @type {string}
* @memberof PolicySpec
*/
'templateName': string;
}

View File

@@ -0,0 +1,54 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { Metadata } from './metadata';
// May contain unused imports in some cases
// @ts-ignore
import type { PolicySpec } from './policy-spec';
/**
*
* @export
* @interface Policy
*/
export interface Policy {
/**
*
* @type {string}
* @memberof Policy
*/
'apiVersion': string;
/**
*
* @type {string}
* @memberof Policy
*/
'kind': string;
/**
*
* @type {Metadata}
* @memberof Policy
*/
'metadata': Metadata;
/**
*
* @type {PolicySpec}
* @memberof Policy
*/
'spec': PolicySpec;
}

View File

@@ -0,0 +1,43 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface RemoveOperation
*/
export interface RemoveOperation {
/**
*
* @type {string}
* @memberof RemoveOperation
*/
'op': RemoveOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof RemoveOperation
*/
'path': string;
}
export const RemoveOperationOpEnum = {
Remove: 'remove'
} as const;
export type RemoveOperationOpEnum = typeof RemoveOperationOpEnum[keyof typeof RemoveOperationOpEnum];

View File

@@ -0,0 +1,49 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface ReplaceOperation
*/
export interface ReplaceOperation {
/**
*
* @type {string}
* @memberof ReplaceOperation
*/
'op': ReplaceOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof ReplaceOperation
*/
'path': string;
/**
* Value can be any JSON value
* @type {any}
* @memberof ReplaceOperation
*/
'value': any;
}
export const ReplaceOperationOpEnum = {
Replace: 'replace'
} as const;
export type ReplaceOperationOpEnum = typeof ReplaceOperationOpEnum[keyof typeof ReplaceOperationOpEnum];

View File

@@ -0,0 +1,63 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { ObjectVo } from './object-vo';
/**
*
* @export
* @interface S3ListResult
*/
export interface S3ListResult {
/**
*
* @type {string}
* @memberof S3ListResult
*/
'currentContinuationObject'?: string;
/**
*
* @type {string}
* @memberof S3ListResult
*/
'currentToken'?: string;
/**
*
* @type {boolean}
* @memberof S3ListResult
*/
'hasMore'?: boolean;
/**
*
* @type {string}
* @memberof S3ListResult
*/
'nextContinuationObject'?: string;
/**
*
* @type {string}
* @memberof S3ListResult
*/
'nextToken'?: string;
/**
*
* @type {Array<ObjectVo>}
* @memberof S3ListResult
*/
'objects'?: Array<ObjectVo>;
}

View File

@@ -0,0 +1,151 @@
/* 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.18.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.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { UrlSuffixItem } from './url-suffix-item';
/**
*
* @export
* @interface S3OsProperties
*/
export interface S3OsProperties {
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'accessKey'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'accessSecret'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'bucket'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'customTemplate'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'domain'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'duplicateFilenameHandling'?: S3OsPropertiesDuplicateFilenameHandlingEnum;
/**
*
* @type {boolean}
* @memberof S3OsProperties
*/
'enablePathStyleAccess'?: boolean;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'endpoint'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'endpointProtocol'?: S3OsPropertiesEndpointProtocolEnum;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'location'?: string;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'protocol'?: S3OsPropertiesProtocolEnum;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'randomFilenameMode'?: S3OsPropertiesRandomFilenameModeEnum;
/**
*
* @type {number}
* @memberof S3OsProperties
*/
'randomStringLength'?: number;
/**
*
* @type {string}
* @memberof S3OsProperties
*/
'region'?: string;
/**
*
* @type {Array<UrlSuffixItem>}
* @memberof S3OsProperties
*/
'urlSuffixes'?: Array<UrlSuffixItem>;
}
export const S3OsPropertiesDuplicateFilenameHandlingEnum = {
RandomAlphanumeric: 'randomAlphanumeric',
RandomAlphabetic: 'randomAlphabetic',
Exception: 'exception'
} as const;
export type S3OsPropertiesDuplicateFilenameHandlingEnum = typeof S3OsPropertiesDuplicateFilenameHandlingEnum[keyof typeof S3OsPropertiesDuplicateFilenameHandlingEnum];
export const S3OsPropertiesEndpointProtocolEnum = {
Http: 'http',
Https: 'https'
} as const;
export type S3OsPropertiesEndpointProtocolEnum = typeof S3OsPropertiesEndpointProtocolEnum[keyof typeof S3OsPropertiesEndpointProtocolEnum];
export const S3OsPropertiesProtocolEnum = {
Http: 'http',
Https: 'https'
} as const;
export type S3OsPropertiesProtocolEnum = typeof S3OsPropertiesProtocolEnum[keyof typeof S3OsPropertiesProtocolEnum];
export const S3OsPropertiesRandomFilenameModeEnum = {
None: 'none',
Custom: 'custom',
Uuid: 'uuid',
TimestampMs: 'timestampMs',
DateWithString: 'dateWithString',
DatetimeWithString: 'datetimeWithString',
WithString: 'withString',
String: 'string',
RandomNumber: 'random_number'
} as const;
export type S3OsPropertiesRandomFilenameModeEnum = typeof S3OsPropertiesRandomFilenameModeEnum[keyof typeof S3OsPropertiesRandomFilenameModeEnum];

View File

@@ -0,0 +1,49 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface TestOperation
*/
export interface TestOperation {
/**
*
* @type {string}
* @memberof TestOperation
*/
'op': TestOperationOpEnum;
/**
* A JSON Pointer path pointing to the location to move/copy from.
* @type {string}
* @memberof TestOperation
*/
'path': string;
/**
* Value can be any JSON value
* @type {any}
* @memberof TestOperation
*/
'value': any;
}
export const TestOperationOpEnum = {
Test: 'test'
} as const;
export type TestOperationOpEnum = typeof TestOperationOpEnum[keyof typeof TestOperationOpEnum];

View File

@@ -0,0 +1,36 @@
/* 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.18.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.
*/
/**
*
* @export
* @interface UrlSuffixItem
*/
export interface UrlSuffixItem {
/**
*
* @type {string}
* @memberof UrlSuffixItem
*/
'fileSuffix'?: string;
/**
*
* @type {string}
* @memberof UrlSuffixItem
*/
'urlSuffix'?: string;
}

View File

@@ -1,2 +0,0 @@
export * from "./s-3-link-controller";
export * from "./s-3-unlink-controller";

View File

@@ -1,27 +0,0 @@
import request from "@/utils/request";
import { S3ListResult, DeepRequired } from "../../interface";
/**
* /apis/s3os.halo.run/v1alpha1/objects/{policyName}
*/
export function getApisS3OsHaloRunV1Alpha1ObjectsByPolicyName(params: GetApisS3OsHaloRunV1Alpha1ObjectsByPolicyNameParams) {
const paramsInput = {
continuationToken: params.continuationToken,
continuationObject: params.continuationObject,
pageSize: params.pageSize,
unlinked: params.unlinked,
filePrefix: params.filePrefix,
};
return request.get<DeepRequired<S3ListResult>>(`/apis/s3os.halo.run/v1alpha1/objects/${params.policyName}`, {
params: paramsInput,
});
}
interface GetApisS3OsHaloRunV1Alpha1ObjectsByPolicyNameParams {
policyName: any;
continuationToken?: any;
continuationObject?: any;
pageSize: any;
unlinked?: any;
filePrefix?: any;
}

View File

@@ -1,9 +0,0 @@
import request from "@/utils/request";
import { DeepRequired } from "../../interface";
/**
* /apis/s3os.halo.run/v1alpha1/policies/s3
*/
export function getApisS3OsHaloRunV1Alpha1PoliciesS3() {
return request.get<DeepRequired<any>>(`/apis/s3os.halo.run/v1alpha1/policies/s3`);
}

View File

@@ -1,3 +0,0 @@
export * from "./postApisS3OsHaloRunV1Alpha1AttachmentsLink";
export * from "./getApisS3OsHaloRunV1Alpha1ObjectsByPolicyName";
export * from "./getApisS3OsHaloRunV1Alpha1PoliciesS3";

View File

@@ -1,9 +0,0 @@
import request from "@/utils/request";
import { LinkResult, DeepRequired, LinkRequest } from "../../interface";
/**
* /apis/s3os.halo.run/v1alpha1/attachments/link
*/
export function postApisS3OsHaloRunV1Alpha1AttachmentsLink(input: LinkRequest) {
return request.post<DeepRequired<LinkResult>>(`/apis/s3os.halo.run/v1alpha1/attachments/link`, input);
}

View File

@@ -1,14 +0,0 @@
import request from "@/utils/request";
import { DeepRequired } from "../../interface";
import { Attachment } from "@halo-dev/api-client";
/**
* /apis/s3os.halo.run/v1alpha1/attachments/{name}
*/
export function deleteApisS3OsHaloRunV1Alpha1AttachmentsByName(params: DeleteApisS3OsHaloRunV1Alpha1AttachmentsByNameParams) {
return request.delete<DeepRequired<Attachment>>(`/apis/s3os.halo.run/v1alpha1/attachments/${params.name}`);
}
interface DeleteApisS3OsHaloRunV1Alpha1AttachmentsByNameParams {
name: any;
}

View File

@@ -1 +0,0 @@
export * from "./deleteApisS3OsHaloRunV1Alpha1AttachmentsByName";

View File

@@ -1,10 +1,10 @@
import type { Ref } from "vue";
import { markRaw } from "vue";
import CarbonFolderDetailsReference from "~icons/carbon/folder-details-reference";
import type { Attachment } from "@halo-dev/api-client";
import { definePlugin } from "@halo-dev/console-shared";
import S3Link from "./views/S3Link.vue";
import S3Unlink from "./views/S3Unlink.vue";
import type { Ref } from "vue";
import { markRaw } from "vue";
import CarbonFolderDetailsReference from "~icons/carbon/folder-details-reference";
export default definePlugin({
components: {},

View File

@@ -1,4 +0,0 @@
export interface LinkRequest {
objectKeys?: string[];
policyName?: string;
}

View File

@@ -1,5 +0,0 @@
import { LinkResultItem } from "../../interface";
export interface LinkResult {
items?: LinkResultItem[];
}

View File

@@ -1,5 +0,0 @@
export interface LinkResultItem {
message?: string;
objectKey?: string;
success?: boolean;
}

View File

@@ -1,20 +0,0 @@
export interface Metadata {
annotations?: MetadataAnnotations;
creationTimestamp?: string;
deletionTimestamp?: string;
finalizers?: string[];
/** The name field will be generated automatically according to the given generateName field */
generateName?: string;
labels?: MetadataLabels;
/** Metadata name */
name: string;
version?: number;
}
export interface MetadataAnnotations {
[key: string]: any;
}
export interface MetadataLabels {
[key: string]: any;
}

View File

@@ -1,6 +0,0 @@
export interface ObjectVo {
displayName?: string;
isLinked?: boolean;
key?: string;
lastModified?: string;
}

View File

@@ -1,8 +0,0 @@
import { Metadata, PolicySpec } from "../../interface";
export interface Policy {
apiVersion: string;
kind: string;
metadata: Metadata;
spec: PolicySpec;
}

View File

@@ -1,8 +0,0 @@
export interface PolicySpec {
/** Reference name of ConfigMap extension */
configMapName?: string;
/** Display name of policy */
displayName: string;
/** Reference name of PolicyTemplate */
templateName: string;
}

View File

@@ -1,10 +0,0 @@
import { ObjectVo } from "../../interface";
export interface S3ListResult {
currentContinuationObject?: string;
currentToken?: string;
hasMore?: boolean;
nextContinuationObject?: string;
nextToken?: string;
objects?: ObjectVo[];
}

View File

@@ -1,11 +0,0 @@
export * from "./apiTypes/LinkRequest";
export * from "./apiTypes/LinkResult";
export * from "./apiTypes/LinkResultItem";
export * from "./apiTypes/Metadata";
export * from "./apiTypes/ObjectVo";
export * from "./apiTypes/Policy";
export * from "./apiTypes/PolicySpec";
export * from "./apiTypes/S3ListResult";
export type Primitive = undefined | null | boolean | string | number | symbol;
export type DeepRequired<T> = T extends Primitive ? T : keyof T extends never ? T : { [K in keyof T]-?: DeepRequired<T[K]> };

View File

@@ -1,7 +0,0 @@
{
"docsUrl": "http://localhost:8090/v3/api-docs/extension-api",
"includeTags": ["s-3-link-controller", "s-3-unlink-controller"],
"excludeTags": [],
"axiosInstanceUrl": "@/utils/request",
"prefix": ""
}

View File

@@ -1,33 +0,0 @@
import axios from "axios";
import {Toast} from "@halo-dev/components";
const baseURL = import.meta.env.VITE_API_URL;
const request = axios.create({
baseURL,
withCredentials: true,
});
// 非200状态码就弹窗
request.interceptors.response.use(
(response) => {
return response;
},
async (error) => {
const errorResponse = error.response;
if (!errorResponse) {
return Promise.reject(error);
}
const { status } = errorResponse;
if (status === 400) {
Toast.error(errorResponse.data.detail);
} else if (status !== 200) {
Toast.error("status: " + status);
}
return Promise.reject(error);
}
);
request.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
// TODO 使用halo console 中的axios https://github.com/halo-dev/halo/issues/3979
export default request;

View File

@@ -1,5 +1,7 @@
<script setup lang="ts">
import { computed, getCurrentInstance, onMounted, ref, watch } from "vue";
import {
IconCheckboxCircle,
IconRefreshLine,
Toast,
VButton,
@@ -11,27 +13,47 @@ import {
VModal,
VPageHeader,
VSpace,
VStatusDot,
VTag,
} from "@halo-dev/components";
import CarbonFolderDetailsReference from "~icons/carbon/folder-details-reference";
import IconErrorWarning from "~icons/ri/error-warning-line";
import {computed, onMounted, ref, watch} from "vue";
import {
getApisS3OsHaloRunV1Alpha1ObjectsByPolicyName,
getApisS3OsHaloRunV1Alpha1PoliciesS3,
postApisS3OsHaloRunV1Alpha1AttachmentsLink,
} from "@/controller";
import type {ObjectVo, S3ListResult, Policy, LinkResultItem} from "@/interface";
import { axiosInstance, coreApiClient, type Group } from "@halo-dev/api-client";
import { S3LinkControllerApi } from "@/api";
import type { S3ListResult, LinkResultItem, Policy, ObjectVo } from "@/api";
const s3LinkControllerApi = new S3LinkControllerApi(undefined, axiosInstance.defaults.baseURL, axiosInstance);
const componentInstance = getCurrentInstance();
const t = (key: string) => {
// @ts-ignore
if (typeof componentInstance?.proxy?.$t === 'function') {
// @ts-ignore
return componentInstance.proxy.$t(key);
}
return key;
};
const selectedFiles = ref<string[]>([]);
const policyName = ref<string>("");
const page = ref(1);
const size = ref(50);
const selectedGroup = ref("")
const policyOptions = ref<{ label: string; value: string; attrs: any }[]>([{
label: "请选择存储策略",
value: "",
attrs: {disabled: true}
}]);
const defaultGroup = ref<Group>({
apiVersion: "",
kind: "",
metadata: {
name: "",
},
spec: {
displayName: t("core.attachment.common.text.ungrouped"),
},
});
// update when fetch first page
const filePrefix = ref<string>("");
// update when user input
@@ -44,6 +66,7 @@ const s3Objects = ref<S3ListResult>({
currentContinuationObject: "",
nextContinuationObject: "",
});
const customGroups = ref<Group[]>([]);
// view state
const isFetching = ref(false);
const isShowModal = ref(false);
@@ -64,17 +87,14 @@ const selectedLinkedStatusItem = ref<boolean | undefined>(linkedStatusItems[0].v
const emptyTips = computed(() => {
if (isFetchingPolicies.value) {
return "正在加载存储策略";
} else {
if (policyOptions.value.length <= 1) {
return "没有可用的存储策略请前往【附件】添加S3存储策略";
} else {
if (!policyName.value) {
return "请在左上方选择存储策略";
} else {
return "该存储策略的 桶/文件夹 下没有文件";
}
}
}
if (policyOptions.value.length <= 1) {
return "没有可用的存储策略请前往【附件】添加S3存储策略";
}
if (!policyName.value) {
return "请在左上方选择存储策略";
}
return "该存储策略的 桶/文件夹 下没有文件";
});
const handleCheckAllChange = (e: Event) => {
@@ -94,14 +114,14 @@ const handleCheckAllChange = (e: Event) => {
const fetchPolicies = async () => {
try {
const policiesData = await getApisS3OsHaloRunV1Alpha1PoliciesS3();
if (policiesData.status == 200) {
const {status, data} = await s3LinkControllerApi.listS3Policies();
if (status === 200) {
policyOptions.value = [{
label: "请选择存储策略",
value: "",
attrs: {disabled: true}
}];
policiesData.data.forEach((policy: Policy) => {
data.forEach((policy: Policy) => {
policyOptions.value.push({
label: policy.spec.displayName,
value: policy.metadata.name,
@@ -115,21 +135,6 @@ const fetchPolicies = async () => {
isFetchingPolicies.value = false;
};
onMounted(() => {
fetchPolicies();
});
watch(selectedFiles, (newValue) => {
checkedAll.value = s3Objects.value.objects?.filter(file => !file.isLinked)
.filter(file => !newValue.includes(file.key || "")).length == 0
&& s3Objects.value.objects?.length != 0;
});
watch(selectedLinkedStatusItem, () => {
handleFirstPage();
});
const changeNextTokenAndObject = () => {
s3Objects.value.currentToken = s3Objects.value.nextToken;
s3Objects.value.currentContinuationObject = s3Objects.value.nextContinuationObject;
@@ -153,7 +158,7 @@ const fetchObjects = async () => {
isFetching.value = true;
s3Objects.value.objects = [];
try {
const objectsData = await getApisS3OsHaloRunV1Alpha1ObjectsByPolicyName({
const {status, data} = await s3LinkControllerApi.listObjects({
policyName: policyName.value,
pageSize: size.value,
continuationToken: s3Objects.value.currentToken,
@@ -161,13 +166,12 @@ const fetchObjects = async () => {
unlinked: selectedLinkedStatusItem.value,
filePrefix: filePrefix.value
});
if (objectsData.status == 200) {
s3Objects.value = objectsData.data;
if (s3Objects.value.objects?.length == 0 && s3Objects.value.hasMore && s3Objects.value.nextToken) {
if (status === 200) {
s3Objects.value = data;
if (s3Objects.value.objects?.length === 0 && s3Objects.value.hasMore && s3Objects.value.nextToken) {
changeNextTokenAndObject();
await fetchObjects();
} else if (s3Objects.value.objects?.length == 0 && !s3Objects.value.hasMore && page.value > 1) {
} else if (s3Objects.value.objects?.length === 0 && !s3Objects.value.hasMore && page.value > 1) {
page.value = 1;
clearTokenAndObject();
await fetchObjects();
@@ -191,17 +195,20 @@ const handleLink = async () => {
isShowModal.value = true;
linkTips.value = `正在关联${selectedFiles.value.length}个文件`;
linkFailedTable.value = [];
const linkResult = await postApisS3OsHaloRunV1Alpha1AttachmentsLink({
policyName: policyName.value,
objectKeys: selectedFiles.value
const linkResult = await s3LinkControllerApi.addAttachmentRecord({
linkRequest: {
policyName: policyName.value,
objectKeys: selectedFiles.value,
groupName: selectedGroup.value,
}
});
const successCount = linkResult.data.items.filter(item => item.success).length;
const failedCount = linkResult.data.items.filter(item => !item.success).length;
const items = linkResult.data.items || [];
const successCount = items.filter(item => item.success).length;
const failedCount = items.filter(item => !item.success).length;
linkTips.value = `关联成功${successCount}个文件,关联失败${failedCount}个文件`;
if (failedCount > 0) {
linkFailedTable.value = linkResult.data.items.filter(item => !item.success);
linkFailedTable.value = items.filter(item => !item.success);
}
isLinking.value = false;
};
@@ -212,15 +219,13 @@ const selectOneAndLink = (file: ObjectVo) => {
};
const handleNextPage = () => {
if (!policyName.value) {
if (!policyName.value || !s3Objects.value.hasMore) {
return;
}
if (s3Objects.value.hasMore) {
isFetching.value = true;
page.value += 1;
changeNextTokenAndObject();
fetchObjects();
}
isFetching.value = true;
page.value += 1;
changeNextTokenAndObject();
fetchObjects();
};
const handleFirstPage = () => {
@@ -238,10 +243,34 @@ const handleModalClose = () => {
isShowModal.value = false;
fetchObjects();
};
const fetchCustomGroups = async () => {
const {status, data} = await coreApiClient.storage.group.listGroup({
labelSelector: ["!halo.run/hidden"],
sort: ["metadata.creationTimestamp,asc"],
});
if (status === 200) {
customGroups.value = data.items;
}
};
onMounted(() => {
fetchPolicies();
fetchCustomGroups();
});
watch(selectedFiles, (newValue) => {
checkedAll.value = s3Objects.value.objects?.filter(file => !file.isLinked)
.filter(file => !newValue.includes(file.key || "")).length === 0
&& s3Objects.value.objects?.length !== 0;
});
watch(selectedLinkedStatusItem, handleFirstPage);
</script>
<template>
<VPageHeader title="关联S3文件(Beta)">
<VPageHeader title="关联S3文件">
<template #icon>
<CarbonFolderDetailsReference class="mr-2 self-center"/>
</template>
@@ -336,6 +365,37 @@ const handleModalClose = () => {
class="box-border h-full w-full divide-y divide-gray-100"
role="list"
>
<li style="padding: 0.5rem 1rem 0">
<span class="ml-1 mb-1 block text-sm text-gray-500">关联后所加入的分组</span>
<div class="mb-5 grid grid-cols-2 gap-x-2 gap-y-3 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-6">
<button
type="button"
class="inline-flex h-full w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2.5 text-sm font-medium text-gray-800 hover:bg-gray-50 hover:shadow-sm"
v-for="(group, index) in [defaultGroup, ...customGroups]"
:key="index"
:class="{ '!bg-gray-100 shadow-sm': group.metadata.name === selectedGroup }"
@click="selectedGroup = group.metadata.name"
>
<div class="inline-flex w-full flex-1 gap-x-2 break-all text-left">
<slot name="text">
{{ group?.spec.displayName }}
</slot>
<VStatusDot
v-if="group?.metadata.deletionTimestamp"
v-tooltip="$t('core.common.status.deleting')"
state="warning"
animate
/>
</div>
<div class="flex-none">
<IconCheckboxCircle
v-if="group.metadata.name === selectedGroup"
class="text-primary"
/>
</div>
</button>
</div>
</li>
<li v-for="(file, index) in s3Objects.objects" :key="index">
<VEntity :is-selected="checkSelection(file)">
<template
@@ -400,11 +460,11 @@ const handleModalClose = () => {
</div>
<div class="inline-flex items-center gap-5">
<div class="inline-flex items-center gap-2">
<VButton size="small" @click="handleFirstPage" :disabled="!policyName">返回第一页</VButton>
<VButton @click="handleFirstPage" :disabled="!policyName">返回第一页</VButton>
<span class="text-sm text-gray-500"> {{ page }} </span>
<VButton size="small" @click="handleNextPage" :disabled="!s3Objects.hasMore || isFetching || !policyName">
<VButton @click="handleNextPage" :disabled="!s3Objects.hasMore || isFetching || !policyName">
下一页
</VButton>
</div>
@@ -456,8 +516,8 @@ const handleModalClose = () => {
<th class="border border-black font-normal">失败原因</th>
</tr>
<tr v-for="failedInfo in linkFailedTable" :key="failedInfo.objectKey">
<th class="border border-black font-normal">{{failedInfo.objectKey}}</th>
<th class="border border-black font-normal">{{failedInfo.message}}</th>
<th class="border border-black font-normal">{{ failedInfo.objectKey }}</th>
<th class="border border-black font-normal">{{ failedInfo.message }}</th>
</tr>
</table>
</div>
@@ -467,6 +527,6 @@ const handleModalClose = () => {
<style lang="scss" scoped>
.page-size-select:focus {
--tw-border-opacity: 1;
border-color: rgba(var(--colors-primary),var(--tw-border-opacity));
border-color: rgba(var(--colors-primary), var(--tw-border-opacity));
}
</style>

View File

@@ -1,8 +1,11 @@
<script setup lang="ts">
import {deleteApisS3OsHaloRunV1Alpha1AttachmentsByName} from "@/controller";
import type {Attachment} from "@halo-dev/api-client";
import {Dialog, Toast, VDropdownDivider, VDropdownItem} from "@halo-dev/components";
import {useQueryClient} from "@tanstack/vue-query";
import {axiosInstance} from "@halo-dev/api-client"
import type {Attachment} from "@halo-dev/api-client";
import {S3UnlinkControllerApi} from "@/api"
const s3UnlinkControllerApi = new S3UnlinkControllerApi(undefined, axiosInstance.defaults.baseURL, axiosInstance);
const props = defineProps<{
attachment: Attachment;
@@ -18,12 +21,12 @@ const handleUnlink = () => {
cancelText: "取消",
onConfirm: async () => {
try {
await deleteApisS3OsHaloRunV1Alpha1AttachmentsByName({name: props.attachment.metadata.name});
await s3UnlinkControllerApi.unlink({name: props.attachment.metadata.name});
Toast.success("解除关联成功");
} catch (e) {
console.error("Failed to delete attachment", e);
} finally {
queryClient.invalidateQueries({queryKey: ["attachments"]});
await queryClient.invalidateQueries({queryKey: ["attachments"]});
}
},
});

View File

@@ -1,5 +1,5 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["./env.d.ts", "./src/**/*", "./src/**/*.vue"],
"exclude": ["./src/**/__tests__/*"],
"compilerOptions": {

View File

@@ -1,5 +1,5 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"extends": ["@tsconfig/node18/tsconfig.json", "@vue/tsconfig/tsconfig.json"],
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
"compilerOptions": {
"composite": true,

View File

@@ -1 +1 @@
version=1.9.0-SNAPSHOT
version=1.11.0-SNAPSHOT

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists

View File

@@ -1,6 +1,7 @@
pluginManagement {
repositories {
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/spring-plugin' }
maven { url 'https://repo.spring.io/milestone' }

View File

@@ -9,4 +9,5 @@ import lombok.RequiredArgsConstructor;
public class LinkRequest {
private String policyName;
private Set<String> objectKeys;
private String groupName;
}

View File

@@ -41,6 +41,6 @@ public class S3LinkController {
@PostMapping("/attachments/link")
public Mono<LinkResult> addAttachmentRecord(@RequestBody LinkRequest linkRequest) {
return s3LinkService.addAttachmentRecords(linkRequest.getPolicyName(),
linkRequest.getObjectKeys());
linkRequest.getObjectKeys(), linkRequest.getGroupName());
}
}

View File

@@ -10,10 +10,12 @@ public interface S3LinkService {
Flux<Policy> listS3Policies();
Mono<S3ListResult> listObjects(String policyName, String continuationToken,
Integer pageSize, String filePrefix);
Integer pageSize, String filePrefix);
Mono<LinkResult> addAttachmentRecords(String policyName, Set<String> objectKeys);
Mono<LinkResult> addAttachmentRecords(String policyName, Set<String> objectKeys,
String groupName);
Mono<S3ListResult> listObjectsUnlinked(String policyName, String continuationToken,
String continuationObject, Integer pageSize, String filePrefix);
String continuationObject, Integer pageSize,
String filePrefix);
}

View File

@@ -113,11 +113,11 @@ public class S3LinkServiceImpl implements S3LinkService {
}
@Override
public Mono<LinkResult> addAttachmentRecords(String policyName, Set<String> objectKeys) {
public Mono<LinkResult> addAttachmentRecords(String policyName, Set<String> objectKeys, String groupName) {
return getOperableObjectKeys(objectKeys, policyName)
.flatMap(operableObjectKeys -> getExistingAttachments(objectKeys, policyName)
.flatMap(existingAttachments -> getLinkResultItems(objectKeys, operableObjectKeys,
existingAttachments, policyName)
existingAttachments, policyName, groupName)
.collectList()
.map(LinkResult::new)));
}
@@ -147,12 +147,13 @@ public class S3LinkServiceImpl implements S3LinkService {
private Flux<LinkResult.LinkResultItem> getLinkResultItems(Set<String> objectKeys,
Set<String> operableObjectKeys,
Set<String> existingAttachments,
String policyName) {
String policyName,
String groupName) {
return Flux.fromIterable(objectKeys)
.flatMap((objectKey) -> {
if (operableObjectKeys.contains(objectKey) &&
!existingAttachments.contains(objectKey)) {
return addAttachmentRecord(policyName, objectKey)
return addAttachmentRecord(policyName, objectKey, groupName)
.onErrorResume((throwable) -> Mono.just(
new LinkResult.LinkResultItem(objectKey, false,
throwable.getMessage())));
@@ -223,7 +224,7 @@ public class S3LinkServiceImpl implements S3LinkService {
}
public Mono<LinkResult.LinkResultItem> addAttachmentRecord(String policyName,
String objectKey) {
String objectKey, String groupName) {
return authenticationConsumer(authentication -> client.fetch(Policy.class, policyName)
.flatMap((policy) -> {
var configMapName = policy.getSpec().getConfigMapName();
@@ -255,6 +256,9 @@ public class S3LinkServiceImpl implements S3LinkService {
}
spec.setOwnerName(authentication.getName());
spec.setPolicyName(policyName);
if (StringUtils.isNotBlank(groupName)){
spec.setGroupName(groupName);
}
})
.flatMap(client::create)
.thenReturn(new LinkResult.LinkResultItem(objectKey, true, null));

View File

@@ -4,7 +4,7 @@ metadata:
name: PluginS3ObjectStorage
spec:
enabled: true
requires: ">=2.14.0"
requires: ">=2.17.0"
author:
name: Halo
website: https://github.com/halo-dev