Add ListTemplatingExtensions

Signed-off-by: solimant <solimant@users.noreply.github.com>
This commit is contained in:
solimant
2025-04-29 17:25:43 +00:00
parent 67caec27bf
commit 563ff4da0b
26 changed files with 870 additions and 49 deletions
+51 -7
View File
@@ -25,13 +25,8 @@ export type Action = {
examples?: ActionExample[];
};
// @public
export interface ActionExample {
// (undocumented)
description: string;
// (undocumented)
example: string;
}
// @public @deprecated
export type ActionExample = ScaffolderUsageExample;
// @public
export const isTemplateEntityV1beta3: (
@@ -41,6 +36,15 @@ export const isTemplateEntityV1beta3: (
// @public
export type ListActionsResponse = Array<Action>;
// @public
export type ListTemplatingExtensionsResponse = {
filters: Record<string, TemplateFilter>;
globals: {
functions: Record<string, TemplateGlobalFunction>;
values: Record<string, TemplateGlobalValue>;
};
};
// @public
export type LogEvent = {
type: TaskEventType;
@@ -109,6 +113,9 @@ export interface ScaffolderApi {
tasks: ScaffolderTask[];
totalTasks?: number;
}>;
listTemplatingExtensions?(
options?: ScaffolderRequestOptions,
): Promise<ListTemplatingExtensionsResponse>;
retry?(
{
secrets,
@@ -205,6 +212,9 @@ export class ScaffolderClient implements ScaffolderApi {
tasks: ScaffolderTask[];
totalTasks?: number;
}>;
listTemplatingExtensions(
options?: ScaffolderRequestOptions,
): Promise<ListTemplatingExtensionsResponse>;
retry?(
{
secrets,
@@ -359,6 +369,13 @@ export const ScaffolderTaskStatus: {
Skipped: ScaffolderTaskStatus;
};
// @public
export type ScaffolderUsageExample = {
description?: string;
example: string;
notes?: string;
};
// @public (undocumented)
export type TaskEventType = 'cancelled' | 'completion' | 'log' | 'recovered';
@@ -448,6 +465,33 @@ export interface TemplateEntityV1beta3 extends Entity {
// @public
export const templateEntityV1beta3Validator: KindValidator;
// @public
export type TemplateFilter = {
description?: string;
schema?: {
input?: JSONSchema7;
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
// @public
export type TemplateGlobalFunction = {
description?: string;
schema?: {
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
// @public
export type TemplateGlobalValue = {
description?: string;
value: JsonValue;
};
// @public
export type TemplateInfo = {
entityRef: string;
@@ -355,15 +355,15 @@ export class ScaffolderClient implements ScaffolderApi {
);
}
async listTemplatingExtensions(): Promise<ListTemplatingExtensionsResponse> {
const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');
const response = await this.fetchApi.fetch(
`${baseUrl}/v2/templating-extensions`,
/**
* {@inheritdoc ScaffolderApi.listTemplatingExtensions}
*/
async listTemplatingExtensions(
options?: ScaffolderRequestOptions,
): Promise<ListTemplatingExtensionsResponse> {
return await this.requestRequired(
await this.apiClient.listTemplatingExtensions(null as any, options),
);
if (!response.ok) {
throw ResponseError.fromResponse(response);
}
return response.json();
}
/**
@@ -29,6 +29,7 @@ import { CancelTask200Response } from '../models/CancelTask200Response.model';
import { DryRun200Response } from '../models/DryRun200Response.model';
import { DryRunRequest } from '../models/DryRunRequest.model';
import { ListTasksResponse } from '../models/ListTasksResponse.model';
import { ListTemplatingExtensionsResponse } from '../models/ListTemplatingExtensionsResponse.model';
import { RetryRequest } from '../models/RetryRequest.model';
import { Scaffold201Response } from '../models/Scaffold201Response.model';
import { ScaffolderScaffoldOptions } from '../models/ScaffolderScaffoldOptions.model';
@@ -111,6 +112,10 @@ export type ListTasks = {
status?: Array<string>;
};
};
/**
* @public
*/
export type ListTemplatingExtensions = {};
/**
* @public
*/
@@ -343,6 +348,29 @@ export class DefaultApiClient {
});
}
/**
* Returns a structure describing the available templating extensions.
*/
public async listTemplatingExtensions(
// @ts-ignore
request: ListTemplatingExtensions,
options?: RequestOptions,
): Promise<TypedResponse<ListTemplatingExtensionsResponse>> {
const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);
const uriTemplate = `/v2/templating-extensions`;
const uri = parser.parse(uriTemplate).expand({});
return await this.fetchApi.fetch(`${baseUrl}${uri}`, {
headers: {
'Content-Type': 'application/json',
...(options?.token && { Authorization: `Bearer ${options?.token}` }),
},
method: 'GET',
});
}
/**
* Starts the task again from the point where it failed.
* @param taskId -
@@ -0,0 +1,30 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
import { ListTemplatingExtensionsResponseGlobals } from '../models/ListTemplatingExtensionsResponseGlobals.model';
import { TemplateFilter } from '../models/TemplateFilter.model';
/**
* The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend`
* @public
*/
export interface ListTemplatingExtensionsResponse {
filters: { [key: string]: TemplateFilter };
globals: ListTemplatingExtensionsResponseGlobals;
}
@@ -0,0 +1,29 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
import { TemplateGlobalFunction } from '../models/TemplateGlobalFunction.model';
import { TemplateGlobalValue } from '../models/TemplateGlobalValue.model';
/**
* @public
*/
export interface ListTemplatingExtensionsResponseGlobals {
functions: { [key: string]: TemplateGlobalFunction };
values: { [key: string]: TemplateGlobalValue };
}
@@ -0,0 +1,29 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
/**
* A single scaffolder usage example
* @public
*/
export interface ScaffolderUsageExample {
description?: string;
example: string;
notes?: string;
}
@@ -0,0 +1,31 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model';
import { TemplateFilterSchema } from '../models/TemplateFilterSchema.model';
/**
* The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend`
* @public
*/
export interface TemplateFilter {
description?: string;
schema?: TemplateFilterSchema;
examples?: Array<ScaffolderUsageExample>;
}
@@ -0,0 +1,34 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
/**
* @public
*/
export interface TemplateFilterSchema {
/**
* A type representing all allowed JSON object values.
*/
input?: { [key: string]: any };
arguments?: Array<{ [key: string]: any }>;
/**
* A type representing all allowed JSON object values.
*/
output?: { [key: string]: any };
}
@@ -0,0 +1,31 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
import { ScaffolderUsageExample } from '../models/ScaffolderUsageExample.model';
import { TemplateGlobalFunctionSchema } from '../models/TemplateGlobalFunctionSchema.model';
/**
* The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend`
* @public
*/
export interface TemplateGlobalFunction {
description?: string;
schema?: TemplateGlobalFunctionSchema;
examples?: Array<ScaffolderUsageExample>;
}
@@ -0,0 +1,30 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
/**
* @public
*/
export interface TemplateGlobalFunctionSchema {
arguments?: Array<{ [key: string]: any }>;
/**
* A type representing all allowed JSON object values.
*/
output?: { [key: string]: any };
}
@@ -0,0 +1,28 @@
/*
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************************************
// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
// ******************************************************************
/**
* The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend`
* @public
*/
export interface TemplateGlobalValue {
description?: string;
value: any | null;
}
@@ -38,11 +38,14 @@ export * from '../models/ErrorResponse.model';
export * from '../models/JsonPrimitive.model';
export * from '../models/JsonValue.model';
export * from '../models/ListTasksResponse.model';
export * from '../models/ListTemplatingExtensionsResponse.model';
export * from '../models/ListTemplatingExtensionsResponseGlobals.model';
export * from '../models/ModelError.model';
export * from '../models/RetryRequest.model';
export * from '../models/Scaffold201Response.model';
export * from '../models/Scaffold400Response.model';
export * from '../models/ScaffolderScaffoldOptions.model';
export * from '../models/ScaffolderUsageExample.model';
export * from '../models/SerializedFile.model';
export * from '../models/SerializedTask.model';
export * from '../models/SerializedTaskEvent.model';
@@ -50,6 +53,11 @@ export * from '../models/TaskEventType.model';
export * from '../models/TaskSecrets.model';
export * from '../models/TaskSecretsAllOf.model';
export * from '../models/TaskStatus.model';
export * from '../models/TemplateFilter.model';
export * from '../models/TemplateFilterSchema.model';
export * from '../models/TemplateGlobalFunction.model';
export * from '../models/TemplateGlobalFunctionSchema.model';
export * from '../models/TemplateGlobalValue.model';
export * from '../models/TemplateParameterSchema.model';
export * from '../models/TemplateParameterSchemaStepsInner.model';
export * from '../models/ValidationError.model';