Skip to main content
Glama
storage.ts2.82 kB
import { AzureService, ServiceResult } from './base-service.js'; import { CacheKeys } from '../lib/cache.js'; interface StorageAccount { name: string; resourceGroup: string; location: string; kind: string; sku: { name: string }; } interface Container { name: string; publicAccess: string; lastModified: string; } interface Blob { name: string; contentLength: number; contentType: string; lastModified: string; } export class StorageService extends AzureService { readonly serviceName = 'Storage'; readonly cliPrefix = 'storage'; async list(resourceGroup?: string): Promise<ServiceResult<StorageAccount[]>> { const cacheKey = CacheKeys.service('storage', 'accounts', resourceGroup ?? ''); return this.cachedExecute(cacheKey, async () => { const opts: Record<string, string> = {}; if (resourceGroup) opts['resource-group'] = resourceGroup; const result = await this.execute('account list', opts); return this.toResult<StorageAccount[]>(result, 'az storage account list'); }); } async listContainers(accountName: string): Promise<ServiceResult<Container[]>> { const cacheKey = CacheKeys.service('storage', 'containers', accountName); return this.cachedExecute(cacheKey, async () => { const result = await this.execute('container list', { 'account-name': accountName, 'auth-mode': 'login' }); return this.toResult<Container[]>(result); }); } async listBlobs(accountName: string, containerName: string): Promise<ServiceResult<Blob[]>> { const result = await this.execute('blob list', { 'account-name': accountName, 'container-name': containerName, 'auth-mode': 'login' }); return this.toResult<Blob[]>(result); } async getContainerProperties(accountName: string, containerName: string): Promise<ServiceResult> { const result = await this.execute('container show', { 'account-name': accountName, 'name': containerName, 'auth-mode': 'login' }); return this.toResult(result); } async listTables(accountName: string): Promise<ServiceResult> { const result = await this.execute('table list', { 'account-name': accountName, 'auth-mode': 'login' }); return this.toResult(result); } async queryTable(accountName: string, tableName: string, filter?: string): Promise<ServiceResult> { const opts: Record<string, string> = { 'account-name': accountName, 'table-name': tableName, 'auth-mode': 'login' }; if (filter) opts['filter'] = filter; const result = await this.execute('entity query', opts); return this.toResult(result); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vedantparmar12/Azure-_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server