Update documentation structure and enhance .gitignore
- Added generated index files and report directories to .gitignore to prevent unnecessary tracking of transient files. - Updated README links to reflect new documentation paths for better navigation. - Improved documentation organization by ensuring all links point to the correct locations, enhancing user experience and accessibility.
This commit is contained in:
@@ -8,17 +8,50 @@ import { ResourceProvider } from '../../types/resource.js'
|
||||
import { logger } from '../../lib/logger.js'
|
||||
import type { ProxmoxCluster, ProxmoxVM, ProxmoxVMConfig } from './types.js'
|
||||
|
||||
/**
|
||||
* Proxmox VE Infrastructure Adapter
|
||||
*
|
||||
* Implements the InfrastructureAdapter interface for Proxmox VE infrastructure.
|
||||
* Provides resource discovery, creation, update, deletion, metrics, and health checks.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const adapter = new ProxmoxAdapter({
|
||||
* apiUrl: 'https://proxmox.example.com:8006',
|
||||
* apiToken: 'token-id=...'
|
||||
* });
|
||||
* const resources = await adapter.discoverResources();
|
||||
* ```
|
||||
*/
|
||||
export class ProxmoxAdapter implements InfrastructureAdapter {
|
||||
readonly provider: ResourceProvider = 'PROXMOX'
|
||||
|
||||
private apiUrl: string
|
||||
private apiToken: string
|
||||
|
||||
/**
|
||||
* Create a new Proxmox adapter instance
|
||||
*
|
||||
* @param config - Configuration object
|
||||
* @param config.apiUrl - Proxmox API URL (e.g., 'https://proxmox.example.com:8006')
|
||||
* @param config.apiToken - Proxmox API token in format 'token-id=...' or 'username@realm!token-id=...'
|
||||
*/
|
||||
constructor(config: { apiUrl: string; apiToken: string }) {
|
||||
this.apiUrl = config.apiUrl
|
||||
this.apiToken = config.apiToken
|
||||
}
|
||||
|
||||
/**
|
||||
* Discover all resources across all Proxmox nodes
|
||||
*
|
||||
* @returns Array of normalized resources (VMs) from all nodes
|
||||
* @throws {Error} If API connection fails or nodes cannot be retrieved
|
||||
* @example
|
||||
* ```typescript
|
||||
* const resources = await adapter.discoverResources();
|
||||
* console.log(`Found ${resources.length} VMs`);
|
||||
* ```
|
||||
*/
|
||||
async discoverResources(): Promise<NormalizedResource[]> {
|
||||
try {
|
||||
const nodes = await this.getNodes()
|
||||
|
||||
Reference in New Issue
Block a user