ProfileManager
Manage profile storage and retrieval.
Getting Instance
Section titled “Getting Instance”import { getProfileManager } from '@robinmordasiewicz/f5xc-auth';
const profileManager = getProfileManager();Methods
Section titled “Methods”list(): Promise<string[]>
Section titled “list(): Promise<string[]>”List all available profile names.
const profiles = await profileManager.list();// Returns: ['production', 'staging', 'development']load(name: string): Promise<Profile | null>
Section titled “load(name: string): Promise<Profile | null>”Load a specific profile.
const profile = await profileManager.load('production');if (profile) { console.log('Loaded profile:', profile.name);}save(profile: Profile): Promise<void>
Section titled “save(profile: Profile): Promise<void>”Save a new or updated profile.
await profileManager.save({ name: 'production', apiUrl: 'https://mytenant.console.ves.volterra.io', apiToken: 'token', defaultNamespace: 'my-ns'});delete(name: string): Promise<void>
Section titled “delete(name: string): Promise<void>”Delete a specific profile.
await profileManager.delete('old-profile');getActiveProfile(): Promise<Profile | null>
Section titled “getActiveProfile(): Promise<Profile | null>”Get the currently active profile.
const active = await profileManager.getActiveProfile();console.log('Active:', active?.name);setActive(name: string): Promise<void>
Section titled “setActive(name: string): Promise<void>”Set a profile as active.
await profileManager.setActive('production');deleteActive(): Promise<void>
Section titled “deleteActive(): Promise<void>”Delete the active profile marker.
await profileManager.deleteActive();isActive(name: string): Promise<boolean>
Section titled “isActive(name: string): Promise<boolean>”Check if a specific profile is active.
const isActive = await profileManager.isActive('production');See Also
Section titled “See Also”- Profile Management Guide - Usage examples
- Authentication - Configure authentication methods
- Profile Switcher Example - Real-world example