mirror of
https://github.com/halo-dev/plugin-s3.git
synced 2025-10-15 14:40:46 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0f4e69e0df | ||
![]() |
42e27da86b | ||
![]() |
19469d0537 | ||
![]() |
545b7ac4ea | ||
![]() |
26038491f2 | ||
![]() |
538c5f3ef9 | ||
![]() |
a7919266d5 | ||
![]() |
68b0bee948 | ||
![]() |
97f653bd42 | ||
![]() |
d4df735759 | ||
![]() |
63be3ed3dc |
8
.github/workflows/cd.yaml
vendored
8
.github/workflows/cd.yaml
vendored
@@ -7,11 +7,13 @@ on:
|
||||
|
||||
jobs:
|
||||
cd:
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v1
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v3
|
||||
secrets:
|
||||
halo-username: ${{ secrets.HALO_USERNAME }}
|
||||
halo-password: ${{ secrets.HALO_PASSWORD }}
|
||||
halo-pat: ${{ secrets.HALO_PAT }}
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
app-id: app-Qxhpp
|
||||
pnpm-version: 9
|
||||
node-version: 22
|
||||
java-version: 21
|
||||
|
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@@ -10,4 +10,8 @@ on:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v1
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v3
|
||||
with:
|
||||
pnpm-version: 9
|
||||
node-version: 22
|
||||
java-version: 21
|
||||
|
63
build.gradle
63
build.gradle
@@ -1,26 +1,35 @@
|
||||
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 "com.github.node-gradle.node" version "7.1.0"
|
||||
id "io.freefair.lombok" version "8.13.1"
|
||||
id "run.halo.plugin.devtools" version "0.6.0"
|
||||
id 'org.openapi.generator' version '7.12.0'
|
||||
}
|
||||
|
||||
group 'run.halo.s3os'
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
options.release = 21
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform('run.halo.tools.platform:plugin:2.14.0-SNAPSHOT')
|
||||
implementation platform('run.halo.tools.platform:plugin:2.21.0-alpha.1')
|
||||
compileOnly 'run.halo.app:api'
|
||||
|
||||
implementation platform('software.amazon.awssdk:bom:2.19.8')
|
||||
implementation ('software.amazon.awssdk:s3') {
|
||||
implementation platform('software.amazon.awssdk:bom:2.31.58')
|
||||
implementation('software.amazon.awssdk:s3') {
|
||||
exclude group: 'org.slf4j'
|
||||
exclude group: 'commons-logging'
|
||||
}
|
||||
@@ -28,6 +37,7 @@ dependencies {
|
||||
testImplementation 'run.halo.app:api'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'io.projectreactor:reactor-test'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
configurations.runtimeClasspath {
|
||||
@@ -36,7 +46,7 @@ configurations.runtimeClasspath {
|
||||
|
||||
|
||||
halo {
|
||||
version = '2.14.0'
|
||||
version = '2.21.0-alpha.2'
|
||||
}
|
||||
|
||||
haloPlugin {
|
||||
@@ -55,15 +65,36 @@ node {
|
||||
nodeProjectDir = file("${project.projectDir}/console")
|
||||
}
|
||||
|
||||
task buildFrontend(type: PnpmTask) {
|
||||
tasks.register('buildFrontend', PnpmTask) {
|
||||
args = ['build']
|
||||
dependsOn(tasks.named('pnpmInstall'))
|
||||
}
|
||||
|
||||
tasks.named('buildFrontend') {
|
||||
dependsOn 'pnpmInstall'
|
||||
tasks.named('processResources') {
|
||||
dependsOn(tasks.named('buildFrontend'))
|
||||
}
|
||||
|
||||
build {
|
||||
// build frontend before build
|
||||
tasks.getByName('compileJava').dependsOn('buildFrontend')
|
||||
tasks.register('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"
|
||||
]
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@halo-dev/plugin-starter",
|
||||
"name": "@halo-dev/plugin-s3",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -11,38 +11,41 @@
|
||||
"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": "https://pkg.pr.new/@halo-dev/components@7383",
|
||||
"@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"
|
||||
},
|
||||
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
|
||||
}
|
||||
|
6340
console/pnpm-lock.yaml
generated
6340
console/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
4
console/src/api/.gitignore
vendored
Normal file
4
console/src/api/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
1
console/src/api/.npmignore
Normal file
1
console/src/api/.npmignore
Normal file
@@ -0,0 +1 @@
|
||||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
25
console/src/api/.openapi-generator-ignore
Normal file
25
console/src/api/.openapi-generator-ignore
Normal 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
|
31
console/src/api/.openapi-generator/FILES
Normal file
31
console/src/api/.openapi-generator/FILES
Normal 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
|
1
console/src/api/.openapi-generator/VERSION
Normal file
1
console/src/api/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
7.7.0
|
20
console/src/api/api.ts
Normal file
20
console/src/api/api.ts
Normal 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';
|
||||
|
151
console/src/api/api/policy-config-validation-controller-api.ts
Normal file
151
console/src/api/api/policy-config-validation-controller-api.ts
Normal 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));
|
||||
}
|
||||
}
|
||||
|
377
console/src/api/api/s3-link-controller-api.ts
Normal file
377
console/src/api/api/s3-link-controller-api.ts
Normal 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));
|
||||
}
|
||||
}
|
||||
|
149
console/src/api/api/s3-unlink-controller-api.ts
Normal file
149
console/src/api/api/s3-unlink-controller-api.ts
Normal 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
86
console/src/api/base.ts
Normal 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
150
console/src/api/common.ts
Normal 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);
|
||||
};
|
||||
}
|
110
console/src/api/configuration.ts
Normal file
110
console/src/api/configuration.ts
Normal 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
18
console/src/api/index.ts
Normal 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";
|
49
console/src/api/models/add-operation.ts
Normal file
49
console/src/api/models/add-operation.ts
Normal 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];
|
||||
|
||||
|
66
console/src/api/models/attachment-spec.ts
Normal file
66
console/src/api/models/attachment-spec.ts
Normal 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>;
|
||||
}
|
||||
|
30
console/src/api/models/attachment-status.ts
Normal file
30
console/src/api/models/attachment-status.ts
Normal 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;
|
||||
}
|
||||
|
63
console/src/api/models/attachment.ts
Normal file
63
console/src/api/models/attachment.ts
Normal 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;
|
||||
}
|
||||
|
49
console/src/api/models/copy-operation.ts
Normal file
49
console/src/api/models/copy-operation.ts
Normal 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];
|
||||
|
||||
|
20
console/src/api/models/index.ts
Normal file
20
console/src/api/models/index.ts
Normal 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';
|
41
console/src/api/models/json-patch-inner.ts
Normal file
41
console/src/api/models/json-patch-inner.ts
Normal 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;
|
||||
|
||||
|
42
console/src/api/models/link-request.ts
Normal file
42
console/src/api/models/link-request.ts
Normal 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;
|
||||
}
|
||||
|
42
console/src/api/models/link-result-item.ts
Normal file
42
console/src/api/models/link-result-item.ts
Normal 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;
|
||||
}
|
||||
|
33
console/src/api/models/link-result.ts
Normal file
33
console/src/api/models/link-result.ts
Normal 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>;
|
||||
}
|
||||
|
72
console/src/api/models/metadata.ts
Normal file
72
console/src/api/models/metadata.ts
Normal 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;
|
||||
}
|
||||
|
49
console/src/api/models/move-operation.ts
Normal file
49
console/src/api/models/move-operation.ts
Normal 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];
|
||||
|
||||
|
48
console/src/api/models/object-vo.ts
Normal file
48
console/src/api/models/object-vo.ts
Normal 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;
|
||||
}
|
||||
|
42
console/src/api/models/policy-spec.ts
Normal file
42
console/src/api/models/policy-spec.ts
Normal 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;
|
||||
}
|
||||
|
54
console/src/api/models/policy.ts
Normal file
54
console/src/api/models/policy.ts
Normal 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;
|
||||
}
|
||||
|
43
console/src/api/models/remove-operation.ts
Normal file
43
console/src/api/models/remove-operation.ts
Normal 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];
|
||||
|
||||
|
49
console/src/api/models/replace-operation.ts
Normal file
49
console/src/api/models/replace-operation.ts
Normal 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];
|
||||
|
||||
|
63
console/src/api/models/s3-list-result.ts
Normal file
63
console/src/api/models/s3-list-result.ts
Normal 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>;
|
||||
}
|
||||
|
151
console/src/api/models/s3-os-properties.ts
Normal file
151
console/src/api/models/s3-os-properties.ts
Normal 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];
|
||||
|
||||
|
49
console/src/api/models/test-operation.ts
Normal file
49
console/src/api/models/test-operation.ts
Normal 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];
|
||||
|
||||
|
36
console/src/api/models/url-suffix-item.ts
Normal file
36
console/src/api/models/url-suffix-item.ts
Normal 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;
|
||||
}
|
||||
|
@@ -1,2 +0,0 @@
|
||||
export * from "./s-3-link-controller";
|
||||
export * from "./s-3-unlink-controller";
|
@@ -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;
|
||||
}
|
@@ -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`);
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
export * from "./postApisS3OsHaloRunV1Alpha1AttachmentsLink";
|
||||
export * from "./getApisS3OsHaloRunV1Alpha1ObjectsByPolicyName";
|
||||
export * from "./getApisS3OsHaloRunV1Alpha1PoliciesS3";
|
@@ -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);
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -1 +0,0 @@
|
||||
export * from "./deleteApisS3OsHaloRunV1Alpha1AttachmentsByName";
|
@@ -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: {},
|
||||
|
@@ -1,4 +0,0 @@
|
||||
export interface LinkRequest {
|
||||
objectKeys?: string[];
|
||||
policyName?: string;
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
import { LinkResultItem } from "../../interface";
|
||||
|
||||
export interface LinkResult {
|
||||
items?: LinkResultItem[];
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
export interface LinkResultItem {
|
||||
message?: string;
|
||||
objectKey?: string;
|
||||
success?: boolean;
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
export interface ObjectVo {
|
||||
displayName?: string;
|
||||
isLinked?: boolean;
|
||||
key?: string;
|
||||
lastModified?: string;
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
import { Metadata, PolicySpec } from "../../interface";
|
||||
|
||||
export interface Policy {
|
||||
apiVersion: string;
|
||||
kind: string;
|
||||
metadata: Metadata;
|
||||
spec: PolicySpec;
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
import { ObjectVo } from "../../interface";
|
||||
|
||||
export interface S3ListResult {
|
||||
currentContinuationObject?: string;
|
||||
currentToken?: string;
|
||||
hasMore?: boolean;
|
||||
nextContinuationObject?: string;
|
||||
nextToken?: string;
|
||||
objects?: ObjectVo[];
|
||||
}
|
@@ -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]> };
|
@@ -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": ""
|
||||
}
|
@@ -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;
|
||||
|
@@ -1,37 +1,66 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, getCurrentInstance, onMounted, ref, watch } from "vue";
|
||||
import {
|
||||
IconCheckboxCircle,
|
||||
IconRefreshLine,
|
||||
Toast,
|
||||
VButton,
|
||||
VCard,
|
||||
VEmpty,
|
||||
VEntity,
|
||||
VEntityContainer,
|
||||
VEntityField,
|
||||
VLoading,
|
||||
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 policyOptions = ref<{ label: string; value: string; attrs: any }[]>([{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: {disabled: true}
|
||||
}]);
|
||||
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 +73,7 @@ const s3Objects = ref<S3ListResult>({
|
||||
currentContinuationObject: "",
|
||||
nextContinuationObject: "",
|
||||
});
|
||||
const customGroups = ref<Group[]>([]);
|
||||
// view state
|
||||
const isFetching = ref(false);
|
||||
const isShowModal = ref(false);
|
||||
@@ -53,59 +83,61 @@ const isFetchingPolicies = ref(true);
|
||||
const linkTips = ref("");
|
||||
const linkFailedTable = ref<LinkResultItem[]>([]);
|
||||
const linkedStatusItems: { label: string; value?: boolean }[] = [
|
||||
{label: "全部"},
|
||||
{label: "未关联", value: true},
|
||||
{ label: "全部" },
|
||||
{ label: "未关联", value: true },
|
||||
];
|
||||
|
||||
// action state
|
||||
const checkedAll = ref(false);
|
||||
const selectedLinkedStatusItem = ref<boolean | undefined>(linkedStatusItems[0].value);
|
||||
const selectedLinkedStatusItem = ref<boolean | undefined>(
|
||||
linkedStatusItems[0].value
|
||||
);
|
||||
|
||||
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) => {
|
||||
const {checked} = e.target as HTMLInputElement;
|
||||
const { checked } = e.target as HTMLInputElement;
|
||||
|
||||
if (checked) {
|
||||
selectedFiles.value =
|
||||
s3Objects.value.objects?.filter(file => !file.isLinked).map((file) => {
|
||||
return file.key || "";
|
||||
}) || [];
|
||||
s3Objects.value.objects
|
||||
?.filter((file) => !file.isLinked)
|
||||
.map((file) => {
|
||||
return file.key || "";
|
||||
}) || [];
|
||||
} else {
|
||||
selectedFiles.value.length = 0;
|
||||
checkedAll.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const fetchPolicies = async () => {
|
||||
try {
|
||||
const policiesData = await getApisS3OsHaloRunV1Alpha1PoliciesS3();
|
||||
if (policiesData.status == 200) {
|
||||
policyOptions.value = [{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: {disabled: true}
|
||||
}];
|
||||
policiesData.data.forEach((policy: Policy) => {
|
||||
const { status, data } = await s3LinkControllerApi.listS3Policies();
|
||||
if (status === 200) {
|
||||
policyOptions.value = [
|
||||
{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: { disabled: true },
|
||||
},
|
||||
];
|
||||
data.forEach((policy: Policy) => {
|
||||
policyOptions.value.push({
|
||||
label: policy.spec.displayName,
|
||||
value: policy.metadata.name,
|
||||
attrs: {}
|
||||
attrs: {},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -115,24 +147,10 @@ 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;
|
||||
s3Objects.value.currentContinuationObject =
|
||||
s3Objects.value.nextContinuationObject;
|
||||
s3Objects.value.nextToken = "";
|
||||
s3Objects.value.nextContinuationObject = "";
|
||||
};
|
||||
@@ -153,21 +171,28 @@ 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,
|
||||
continuationObject: s3Objects.value.currentContinuationObject,
|
||||
unlinked: selectedLinkedStatusItem.value,
|
||||
filePrefix: filePrefix.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 +216,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 +240,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,12 +264,37 @@ 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"/>
|
||||
<CarbonFolderDetailsReference class="mr-2 self-center" />
|
||||
</template>
|
||||
</VPageHeader>
|
||||
<div class="m-0 md:m-4">
|
||||
@@ -256,7 +307,6 @@ const handleModalClose = () => {
|
||||
<div class="hidden items-center sm:flex">
|
||||
<input
|
||||
v-model="checkedAll"
|
||||
class="h-4 w-4 rounded border-gray-300 text-indigo-600"
|
||||
type="checkbox"
|
||||
@change="handleCheckAllChange"
|
||||
/>
|
||||
@@ -270,14 +320,14 @@ const handleModalClose = () => {
|
||||
<FormKit
|
||||
id="policyChoose"
|
||||
outer-class="!p-0"
|
||||
style="min-width: 10rem;"
|
||||
style="min-width: 10rem"
|
||||
v-model="policyName"
|
||||
name="policyName"
|
||||
type="select"
|
||||
:options="policyOptions"
|
||||
@change="handleFirstPage"
|
||||
></FormKit>
|
||||
<icon-error-warning v-if="!policyName" class="text-red-500"/>
|
||||
<icon-error-warning v-if="!policyName" class="text-red-500" />
|
||||
<SearchInput
|
||||
v-model="filePrefixBind"
|
||||
v-if="policyName"
|
||||
@@ -286,9 +336,7 @@ const handleModalClose = () => {
|
||||
></SearchInput>
|
||||
</div>
|
||||
<VSpace v-else>
|
||||
<VButton type="primary" @click="handleLink">
|
||||
关联
|
||||
</VButton>
|
||||
<VButton type="primary" @click="handleLink"> 关联 </VButton>
|
||||
</VSpace>
|
||||
</div>
|
||||
<VSpace spacing="lg" class="flex-wrap">
|
||||
@@ -310,8 +358,8 @@ const handleModalClose = () => {
|
||||
<IconRefreshLine
|
||||
v-tooltip="$t('core.common.buttons.refresh')"
|
||||
:class="{
|
||||
'animate-spin text-gray-900': isFetching,
|
||||
}"
|
||||
'animate-spin text-gray-900': isFetching,
|
||||
}"
|
||||
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
|
||||
/>
|
||||
</div>
|
||||
@@ -321,31 +369,64 @@ const handleModalClose = () => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<VLoading v-if="isFetching"/>
|
||||
<VLoading v-if="isFetching" />
|
||||
|
||||
<Transition v-else-if="!s3Objects.objects?.length" appear name="fade">
|
||||
<VEmpty
|
||||
message="空空如也"
|
||||
:title="emptyTips"
|
||||
>
|
||||
</VEmpty>
|
||||
<VEmpty message="空空如也" :title="emptyTips"> </VEmpty>
|
||||
</Transition>
|
||||
|
||||
<Transition v-else appear name="fade">
|
||||
<ul
|
||||
class="box-border h-full w-full divide-y divide-gray-100"
|
||||
role="list"
|
||||
>
|
||||
<li v-for="(file, index) in s3Objects.objects" :key="index">
|
||||
<VEntity :is-selected="checkSelection(file)">
|
||||
<template
|
||||
#checkbox
|
||||
<div class="box-border h-full w-full">
|
||||
<div 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>
|
||||
</div>
|
||||
<VEntityContainer>
|
||||
<VEntity
|
||||
v-for="(file, index) in s3Objects.objects"
|
||||
:key="index"
|
||||
:is-selected="checkSelection(file)"
|
||||
>
|
||||
<template #checkbox>
|
||||
<input
|
||||
v-model="selectedFiles"
|
||||
:value="file.key || ''"
|
||||
class="h-4 w-4 rounded border-gray-300 text-indigo-600"
|
||||
name="post-checkbox"
|
||||
:disabled="file.isLinked"
|
||||
type="checkbox"
|
||||
/>
|
||||
@@ -369,10 +450,8 @@ const handleModalClose = () => {
|
||||
<template #end>
|
||||
<VEntityField>
|
||||
<template #description>
|
||||
<VTag :theme="file.isLinked ? 'default':'primary'">
|
||||
{{
|
||||
file.isLinked ? '已关联' : '未关联'
|
||||
}}
|
||||
<VTag :theme="file.isLinked ? 'default' : 'primary'">
|
||||
{{ file.isLinked ? "已关联" : "未关联" }}
|
||||
</VTag>
|
||||
</template>
|
||||
</VEntityField>
|
||||
@@ -388,23 +467,32 @@ const handleModalClose = () => {
|
||||
</VEntityField>
|
||||
</template>
|
||||
</VEntity>
|
||||
</li>
|
||||
</ul>
|
||||
</VEntityContainer>
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
<template #footer>
|
||||
<div class="bg-white sm:flex sm:items-center justify-between">
|
||||
<div class="inline-flex items-center gap-5">
|
||||
<span class="text-xs text-gray-500 hidden md:flex">共 {{ s3Objects.objects?.length }} 项数据</span>
|
||||
<span class="text-xs text-gray-500 hidden md:flex">已自动过滤文件夹对象,页面实际显示数量少为正常现象</span>
|
||||
<span class="text-xs text-gray-500 hidden md:flex"
|
||||
>共 {{ s3Objects.objects?.length }} 项数据</span
|
||||
>
|
||||
<span class="text-xs text-gray-500 hidden md:flex"
|
||||
>已自动过滤文件夹对象,页面实际显示数量少为正常现象</span
|
||||
>
|
||||
</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>
|
||||
@@ -439,11 +527,7 @@ const handleModalClose = () => {
|
||||
>
|
||||
<template #footer>
|
||||
<VSpace>
|
||||
<VButton
|
||||
:loading="isLinking"
|
||||
type="primary"
|
||||
@click="handleModalClose"
|
||||
>
|
||||
<VButton :loading="isLinking" type="primary" @click="handleModalClose">
|
||||
确定
|
||||
</VButton>
|
||||
</VSpace>
|
||||
@@ -456,8 +540,12 @@ 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 +555,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>
|
||||
|
@@ -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"]});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@@ -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": {
|
||||
|
@@ -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,
|
||||
|
@@ -1 +1 @@
|
||||
version=1.9.0-SNAPSHOT
|
||||
version=1.11.0-SNAPSHOT
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
47
gradlew
vendored
47
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +82,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -133,22 +133,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
41
gradlew.bat
vendored
41
gradlew.bat
vendored
@@ -13,8 +13,10 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +27,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
@@ -1,6 +1,6 @@
|
||||
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' }
|
||||
@@ -8,4 +8,3 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
rootProject.name = 'plugin-s3'
|
||||
|
||||
|
@@ -9,4 +9,5 @@ import lombok.RequiredArgsConstructor;
|
||||
public class LinkRequest {
|
||||
private String policyName;
|
||||
private Set<String> objectKeys;
|
||||
private String groupName;
|
||||
}
|
@@ -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());
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ public class S3LinkServiceImpl implements S3LinkService {
|
||||
return client.fetch(ConfigMap.class, configMapName);
|
||||
})
|
||||
.flatMap((configMap) -> {
|
||||
var properties = handler.getProperties(configMap);
|
||||
var properties = S3OsProperties.convertFrom(configMap);
|
||||
var finalLocation = FilePathUtils.getFilePathByPlaceholder(properties.getLocation());
|
||||
return Mono.using(() -> handler.buildS3Client(properties),
|
||||
// 执行 listObjects
|
||||
@@ -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,14 +224,14 @@ 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();
|
||||
return client.fetch(ConfigMap.class, configMapName);
|
||||
})
|
||||
.flatMap(configMap -> {
|
||||
var properties = handler.getProperties(configMap);
|
||||
var properties = S3OsProperties.convertFrom(configMap);
|
||||
return Mono.using(() -> handler.buildS3Client(properties),
|
||||
(s3Client) -> Mono.fromCallable(
|
||||
() -> s3Client.headObject(
|
||||
@@ -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));
|
||||
|
@@ -3,7 +3,6 @@ package run.halo.s3os;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
@@ -23,7 +22,6 @@ import org.springframework.http.MediaTypeFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.server.ServerErrorException;
|
||||
import org.springframework.web.server.ServerWebInputException;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
import reactor.core.Exceptions;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -38,7 +36,6 @@ import run.halo.app.core.extension.attachment.endpoint.AttachmentHandler;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.Metadata;
|
||||
import run.halo.app.extension.MetadataUtil;
|
||||
import run.halo.app.infra.utils.JsonUtils;
|
||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||
import software.amazon.awssdk.awscore.presigner.SdkPresigner;
|
||||
import software.amazon.awssdk.core.SdkResponse;
|
||||
@@ -47,16 +44,7 @@ import software.amazon.awssdk.http.SdkHttpResponse;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.s3.S3Client;
|
||||
import software.amazon.awssdk.services.s3.S3Configuration;
|
||||
import software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest;
|
||||
import software.amazon.awssdk.services.s3.model.CompletedMultipartUpload;
|
||||
import software.amazon.awssdk.services.s3.model.CompletedPart;
|
||||
import software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest;
|
||||
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.HeadObjectRequest;
|
||||
import software.amazon.awssdk.services.s3.model.HeadObjectResponse;
|
||||
import software.amazon.awssdk.services.s3.model.NoSuchKeyException;
|
||||
import software.amazon.awssdk.services.s3.model.UploadPartRequest;
|
||||
import software.amazon.awssdk.services.s3.model.*;
|
||||
import software.amazon.awssdk.services.s3.presigner.S3Presigner;
|
||||
import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest;
|
||||
import software.amazon.awssdk.utils.SdkAutoCloseable;
|
||||
@@ -79,7 +67,7 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
public Mono<Attachment> upload(UploadContext uploadContext) {
|
||||
return Mono.just(uploadContext).filter(context -> this.shouldHandle(context.policy()))
|
||||
.flatMap(context -> {
|
||||
final var properties = getProperties(context.configMap());
|
||||
final var properties = S3OsProperties.convertFrom(context.configMap());
|
||||
return upload(context, properties)
|
||||
.subscribeOn(Schedulers.boundedElastic())
|
||||
.map(objectDetail -> this.buildAttachment(properties, objectDetail))
|
||||
@@ -89,41 +77,46 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
|
||||
@Override
|
||||
public Mono<Attachment> delete(DeleteContext deleteContext) {
|
||||
return Mono.just(deleteContext).filter(context -> this.shouldHandle(context.policy()))
|
||||
return Mono.just(deleteContext)
|
||||
.filter(context -> this.shouldHandle(context.policy()))
|
||||
.flatMap(context -> {
|
||||
var objectKey = getObjectKey(context.attachment());
|
||||
if (objectKey == null) {
|
||||
log.warn(
|
||||
"Cannot obtain object key from attachment {}, skip deleting object from S3.",
|
||||
context.attachment().getMetadata().getName());
|
||||
return Mono.just(context);
|
||||
return Mono.just(context.attachment());
|
||||
} else if (MetadataUtil.nullSafeAnnotations(context.attachment())
|
||||
.containsKey(SKIP_REMOTE_DELETION_ANNO)) {
|
||||
log.info("Skip deleting object {} from S3.", objectKey);
|
||||
return Mono.just(context);
|
||||
return Mono.just(context.attachment());
|
||||
}
|
||||
var properties = getProperties(deleteContext.configMap());
|
||||
return Mono.using(() -> buildS3Client(properties),
|
||||
var properties = S3OsProperties.convertFrom(deleteContext.configMap());
|
||||
return Mono.using(
|
||||
() -> buildS3Client(properties),
|
||||
client -> Mono.fromCallable(
|
||||
() -> client.deleteObject(DeleteObjectRequest.builder()
|
||||
.bucket(properties.getBucket())
|
||||
.key(objectKey)
|
||||
.build())).subscribeOn(Schedulers.boundedElastic()),
|
||||
S3Client::close)
|
||||
.build())),
|
||||
S3Client::close
|
||||
)
|
||||
.subscribeOn(Schedulers.boundedElastic())
|
||||
.doOnNext(response -> {
|
||||
checkResult(response, "delete object");
|
||||
log.info("Delete object {} from bucket {} successfully",
|
||||
objectKey, properties.getBucket());
|
||||
})
|
||||
.thenReturn(context);
|
||||
})
|
||||
.onErrorMap(S3ExceptionHandler::map)
|
||||
.map(DeleteContext::attachment);
|
||||
// ignore when the object does not exist
|
||||
.onErrorComplete(NoSuchKeyException.class::isInstance)
|
||||
.onErrorMap(S3ExceptionHandler::map)
|
||||
.thenReturn(context.attachment());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<URI> getSharedURL(Attachment attachment, Policy policy, ConfigMap configMap,
|
||||
Duration ttl) {
|
||||
Duration ttl) {
|
||||
if (!this.shouldHandle(policy)) {
|
||||
return Mono.empty();
|
||||
}
|
||||
@@ -132,7 +125,7 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
return Mono.error(new IllegalArgumentException(
|
||||
"Cannot obtain object key from attachment " + attachment.getMetadata().getName()));
|
||||
}
|
||||
var properties = getProperties(configMap);
|
||||
var properties = S3OsProperties.convertFrom(configMap);
|
||||
|
||||
return Mono.using(() -> buildS3Presigner(properties),
|
||||
s3Presigner -> {
|
||||
@@ -168,8 +161,8 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
// fallback to default handler for backward compatibility
|
||||
return Mono.empty();
|
||||
}
|
||||
var properties = getProperties(configMap);
|
||||
var objectURL = getObjectURL(properties, objectKey);
|
||||
var properties = S3OsProperties.convertFrom(configMap);
|
||||
var objectURL = properties.toObjectURL(objectKey);
|
||||
var urlSuffix = getUrlSuffixAnnotation(attachment);
|
||||
if (StringUtils.isNotBlank(urlSuffix)) {
|
||||
objectURL += urlSuffix;
|
||||
@@ -195,13 +188,8 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
return annotations.get(URL_SUFFIX_ANNO_KEY);
|
||||
}
|
||||
|
||||
S3OsProperties getProperties(ConfigMap configMap) {
|
||||
var settingJson = configMap.getData().getOrDefault("default", "{}");
|
||||
return JsonUtils.jsonToObject(settingJson, S3OsProperties.class);
|
||||
}
|
||||
|
||||
Attachment buildAttachment(S3OsProperties properties, ObjectDetail objectDetail) {
|
||||
String externalLink = getObjectURL(properties, objectDetail.uploadState.objectKey);
|
||||
String externalLink = properties.toObjectURL(objectDetail.uploadState.objectKey);
|
||||
var urlSuffix = UrlUtils.findUrlSuffix(properties.getUrlSuffixes(),
|
||||
objectDetail.uploadState.fileName);
|
||||
|
||||
@@ -229,22 +217,6 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
String getObjectURL(S3OsProperties properties, String objectKey) {
|
||||
String objectURL;
|
||||
if (StringUtils.isBlank(properties.getDomain())) {
|
||||
String host;
|
||||
if (properties.getEnablePathStyleAccess()) {
|
||||
host = properties.getEndpoint() + "/" + properties.getBucket();
|
||||
} else {
|
||||
host = properties.getBucket() + "." + properties.getEndpoint();
|
||||
}
|
||||
objectURL = properties.getProtocol() + "://" + host + "/" + objectKey;
|
||||
} else {
|
||||
objectURL = properties.getProtocol() + "://" + properties.getDomain() + "/" + objectKey;
|
||||
}
|
||||
return UriUtils.encodePath(objectURL, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
S3Client buildS3Client(S3OsProperties properties) {
|
||||
return S3Client.builder()
|
||||
.region(Region.of(properties.getRegion()))
|
||||
|
@@ -1,16 +1,17 @@
|
||||
package run.halo.s3os;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.infra.utils.JsonUtils;
|
||||
|
||||
@Data
|
||||
class S3OsProperties {
|
||||
public class S3OsProperties {
|
||||
|
||||
private String bucket;
|
||||
|
||||
@@ -49,6 +50,8 @@ class S3OsProperties {
|
||||
|
||||
private List<urlSuffixItem> urlSuffixes;
|
||||
|
||||
private String thumbnailParamPattern;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@@ -103,14 +106,14 @@ class S3OsProperties {
|
||||
if (length >= 4 && length <= 16) {
|
||||
this.randomStringLength = length;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
catch (NumberFormatException ignored) { }
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
if (!StringUtils.hasText(region)) {
|
||||
this.region = "Auto";
|
||||
}else {
|
||||
} else {
|
||||
this.region = region;
|
||||
}
|
||||
}
|
||||
@@ -118,4 +121,25 @@ class S3OsProperties {
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = UrlUtils.removeHttpPrefix(endpoint);
|
||||
}
|
||||
|
||||
public String toObjectURL(String objectKey) {
|
||||
String objectURL;
|
||||
if (!StringUtils.hasText(this.getDomain())) {
|
||||
String host;
|
||||
if (this.getEnablePathStyleAccess()) {
|
||||
host = this.getEndpoint() + "/" + this.getBucket();
|
||||
} else {
|
||||
host = this.getBucket() + "." + this.getEndpoint();
|
||||
}
|
||||
objectURL = this.getProtocol() + "://" + host + "/" + objectKey;
|
||||
} else {
|
||||
objectURL = this.getProtocol() + "://" + this.getDomain() + "/" + objectKey;
|
||||
}
|
||||
return UriUtils.encodePath(objectURL, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static S3OsProperties convertFrom(ConfigMap configMap) {
|
||||
var settingJson = configMap.getData().getOrDefault("default", "{}");
|
||||
return JsonUtils.jsonToObject(settingJson, S3OsProperties.class);
|
||||
}
|
||||
}
|
||||
|
106
src/main/java/run/halo/s3os/S3ThumbnailProvider.java
Normal file
106
src/main/java/run/halo/s3os/S3ThumbnailProvider.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package run.halo.s3os;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import lombok.Builder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import run.halo.app.core.attachment.ThumbnailProvider;
|
||||
import run.halo.app.core.attachment.ThumbnailSize;
|
||||
import run.halo.app.extension.ConfigMap;
|
||||
import run.halo.app.extension.ReactiveExtensionClient;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class S3ThumbnailProvider implements ThumbnailProvider {
|
||||
static final String WIDTH_PLACEHOLDER = "{width}";
|
||||
private final Cache<String, S3PropsCacheValue> s3PropsCache = CacheBuilder.newBuilder()
|
||||
.maximumSize(50)
|
||||
.build();
|
||||
|
||||
private final ReactiveExtensionClient client;
|
||||
private final S3LinkService s3LinkService;
|
||||
|
||||
@Override
|
||||
public Mono<URI> generate(ThumbnailContext thumbnailContext) {
|
||||
var url = thumbnailContext.getImageUrl().toString();
|
||||
var size = thumbnailContext.getSize();
|
||||
return getCacheValue(url)
|
||||
.mapNotNull(cacheValue -> placedPattern(cacheValue.pattern(), size))
|
||||
.map(param -> {
|
||||
if (param.startsWith("?")) {
|
||||
return UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam(param.substring(1))
|
||||
.build()
|
||||
.toString();
|
||||
}
|
||||
return url + param;
|
||||
})
|
||||
.map(URI::create);
|
||||
}
|
||||
|
||||
private static String placedPattern(String pattern, ThumbnailSize size) {
|
||||
return StringUtils.replace(pattern, WIDTH_PLACEHOLDER, String.valueOf(size.getWidth()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> delete(URL url) {
|
||||
// do nothing for s3
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Boolean> supports(ThumbnailContext thumbnailContext) {
|
||||
var url = thumbnailContext.getImageUrl().toString();
|
||||
return getCacheValue(url).hasElement();
|
||||
}
|
||||
|
||||
private Mono<S3PropsCacheValue> getCacheValue(String imageUrl) {
|
||||
return Flux.fromIterable(s3PropsCache.asMap().entrySet())
|
||||
.filter(entry -> imageUrl.startsWith(entry.getKey()))
|
||||
.next()
|
||||
.map(Map.Entry::getValue)
|
||||
.switchIfEmpty(Mono.defer(() -> listAllS3ObjectDomain()
|
||||
.filter(entry -> imageUrl.startsWith(entry.getKey()))
|
||||
.map(Map.Entry::getValue)
|
||||
.next()
|
||||
));
|
||||
}
|
||||
|
||||
@Builder
|
||||
record S3PropsCacheValue(String pattern, String configMapName) {
|
||||
}
|
||||
|
||||
private Flux<Map.Entry<String, S3PropsCacheValue>> listAllS3ObjectDomain() {
|
||||
return s3LinkService.listS3Policies()
|
||||
.flatMap(s3Policy -> {
|
||||
var s3ConfigMapName = s3Policy.getSpec().getConfigMapName();
|
||||
return fetchS3PropsByConfigMapName(s3ConfigMapName)
|
||||
.mapNotNull(properties -> {
|
||||
var thumbnailParam = properties.getThumbnailParamPattern();
|
||||
if (StringUtils.isBlank(thumbnailParam)) {
|
||||
return null;
|
||||
}
|
||||
var objectDomain = properties.toObjectURL("");
|
||||
var cacheValue = S3PropsCacheValue.builder()
|
||||
.pattern(thumbnailParam)
|
||||
.configMapName(s3ConfigMapName)
|
||||
.build();
|
||||
return Map.entry(objectDomain, cacheValue);
|
||||
});
|
||||
})
|
||||
.doOnNext(cache -> s3PropsCache.put(cache.getKey(), cache.getValue()));
|
||||
}
|
||||
|
||||
private Mono<S3OsProperties> fetchS3PropsByConfigMapName(String name) {
|
||||
return client.fetch(ConfigMap.class, name)
|
||||
.map(S3OsProperties::convertFrom);
|
||||
}
|
||||
}
|
9
src/main/resources/extensions/ext-definitions.yaml
Normal file
9
src/main/resources/extensions/ext-definitions.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: plugin.halo.run/v1alpha1
|
||||
kind: ExtensionDefinition
|
||||
metadata:
|
||||
name: s3os-thumbnail-provider
|
||||
spec:
|
||||
className: run.halo.s3os.S3ThumbnailProvider
|
||||
extensionPointName: thumbnail-provider
|
||||
displayName: "S3 协议 OSS 缩略图生成"
|
||||
description: "为上传到支持 S3 协议的 OSS 的图片生成缩略图"
|
@@ -144,4 +144,28 @@ spec:
|
||||
name: urlSuffix
|
||||
label: 网址后缀
|
||||
placeholder: 例如:?imageMogr2/format/webp
|
||||
validation: required
|
||||
validation: required
|
||||
- $formkit: select
|
||||
name: thumbnailParamPattern
|
||||
label: 缩略图参数
|
||||
allowCreate: true
|
||||
searchable: true
|
||||
value: ""
|
||||
help: |
|
||||
请根据您的对象存储服务商选择对应的缩略图参数或自定义参数,{width} 为宽度占位符将被替换为所需缩略图宽度值,
|
||||
如: 400,参数需要以 ? 开头,间隔符除外
|
||||
options:
|
||||
- label: 无
|
||||
value: ""
|
||||
- label: 腾讯云 COS / 七牛云 KODO
|
||||
value: "?imageView2/0/w/{width}"
|
||||
- label: 阿里云 OSS
|
||||
value: "?x-oss-process=image/resize,w_{width},m_lfit"
|
||||
- label: 百度云 BOS
|
||||
value: "?x-bce-process=image/resize,m_lfit,w_{width}"
|
||||
- label: 青云 OSS
|
||||
value: "?image&action=resize:w_{width},m_2"
|
||||
- label: 京东云
|
||||
value: "?x-oss-process=img/sw/{width}"
|
||||
- label: 又拍云
|
||||
value: "!/fw/{width}"
|
||||
|
@@ -4,7 +4,7 @@ metadata:
|
||||
name: PluginS3ObjectStorage
|
||||
spec:
|
||||
enabled: true
|
||||
requires: ">=2.14.0"
|
||||
requires: ">=2.21.0"
|
||||
author:
|
||||
name: Halo
|
||||
website: https://github.com/halo-dev
|
||||
|
Reference in New Issue
Block a user