terrac
Version:
A minimal private module registry for Terraform and OpenTofu
42 lines (41 loc) • 1.22 kB
TypeScript
import { IBackend, IModuleListItem } from './shared';
import { IModuleMeta } from '../types/module';
import { Storage } from '@google-cloud/storage';
import * as Joi from 'joi';
export declare const configSchemaGCP: Joi.ObjectSchema<any>;
export interface IBackendConfigGCP {
/**
* Backend type
*/
type: 'gcp';
/**
* Bucket name
*/
bucket: string;
/**
* Google Cloud project ID for the bucket
*/
projectId: string;
/**
* Object path prefix
*/
pathPrefix?: string;
}
export declare class BackendGCP implements IBackend {
config: IBackendConfigGCP;
client: Storage;
apiEndpoint: string;
constructor(config: IBackendConfigGCP);
upload(name: string, version: string, packagePath: string): Promise<void>;
getSourceUrl(name: string, version?: string): Promise<string>;
list(name?: string): Promise<IModuleListItem[]>;
exists(name: string, version?: string): Promise<boolean>;
getMeta(name: string): Promise<IModuleMeta>;
saveMeta(meta: IModuleMeta): Promise<void>;
private uploadFile;
private uploadObject;
private pathExists;
private listPaths;
private getMetaPath;
private getPackagePath;
}