Skip to content

HTTP Client

Create a pre-configured Axios HTTP client for F5 Distributed Cloud API calls.


Function Signature

function createHttpClient(
  credentialManager: CredentialManager,
  options?: HttpClientOptions
): HttpClient

Options

interface HttpClientOptions {
  timeout?: number;           // Request timeout in ms (default: 30000)
  debug?: boolean;            // Enable debug logging (default: false)
  maxRetries?: number;        // Max retry attempts (default: 3)
  retryDelay?: number;        // Delay between retries in ms (default: 1000)
  validateStatus?: (status: number) => boolean;  // Custom status validation
}

Returns

interface HttpClient extends AxiosInstance {
  isAvailable(): boolean;     // Check if client is ready
}

Example

const httpClient = createHttpClient(credentialManager, {
  timeout: 30000,
  debug: true,
  maxRetries: 3
});

if (httpClient.isAvailable()) {
  const response = await httpClient.get('/web/namespaces');
}

See Also