liara_create_network
Create a new network with a specified name and optional CIDR block to organize and isolate resources in your cloud infrastructure.
Instructions
Create a new network
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Network name | |
| cidr | No | CIDR block (optional) |
Implementation Reference
- src/services/network.ts:34-47 (handler)The core handler function that implements the logic for creating a new Liara network by making a POST request to the /v1/networks API endpoint with name and optional CIDR.export async function createNetwork( client: LiaraClient, name: string, cidr?: string ): Promise<Network> { validateRequired(name, 'Network name'); const request: any = { name }; if (cidr) { request.cidr = cidr; } return await client.post<Network>('/v1/networks', request); }
- src/api/types.ts:304-309 (schema)Type definition for the Network object returned by the createNetwork API call.export interface Network { _id: string; name: string; cidr: string; createdAt: string; }
- src/services/network.ts:7-7 (helper)Imports validation helper used in createNetwork.import { validateRequired } from '../utils/errors.js';
- src/services/network.ts:39-40 (helper)Uses validation helper to ensure network name is provided.validateRequired(name, 'Network name');