# Subnets

## Get an available subnet

> Get the value of "id" and "cidr" of an available subnet in the inventory. These values are used to create a new subnet.<br>

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"subnets"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v2/vmware/vpc/{vpc_id}/hpc/subnets/available":{"get":{"summary":"Get an available subnet","deprecated":false,"description":"Get the value of \"id\" and \"cidr\" of an available subnet in the inventory. These values are used to create a new subnet.\n","operationId":"getAvailableSubnets","tags":["subnets"],"parameters":[{"name":"vpc_id","in":"path","description":"The unique ID of a specified VPC.","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"A list of available subnets.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The unique ID of the subnet."},"cidr":{"type":"string","description":"CIDR block of the available subnet."}}}}}},"headers":{}},"401":{"description":"Unauthorized access.","headers":{}},"403":{"description":"Forbidden.","headers":{}},"500":{"description":"Internal server error.","headers":{}}}}}}}
```

## List all subnets

> Returns all of the subnets that have been created within a specified VPC.

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"subnets"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v2/vmware/vpc/{vpc_id}/hpc/subnets":{"get":{"summary":"List all subnets","deprecated":false,"description":"Returns all of the subnets that have been created within a specified VPC.","operationId":"listSubnets","tags":["subnets"],"parameters":[{"name":"vpc_id","in":"path","description":"The unique ID of a specified VPC.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","description":"The page number for pagination.","required":false,"schema":{"type":"integer","default":1}},{"name":"page_size","in":"query","description":"The number of items per page.","required":false,"schema":{"type":"integer","default":10,"maximum":100}}],"responses":{"200":{"description":"A list of subnets.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The unique ID of the subnet."},"name":{"type":"string","description":"The unique name of the subnet."},"subnet_cidr":{"type":"string","description":"The CIDR block of the subnet."},"description":{"type":"string","description":"The description of the subnet."},"status":{"type":"string","description":"The status of the subnet. The value must be 'creating' or 'available' or 'error'."},"osp_network_id":{"type":"string","description":"The unique ID of the network is associated with the subnet in the infrastructure platform. Only for FPT management."},"network_acl_id":{"type":"string","description":"The unique ID of the Network ACL."},"network_acl_name":{"type":"string","description":"The unique name of the Network ACL."},"created_at":{"type":"string","description":"Date and time when the subnet is created."}},"required":["network_acl_id","osp_network_id","status","network_acl_name","name","id","created_at"]}},"total":{"type":"integer","description":"The number of subnets within a VPC."}}}}},"headers":{}},"401":{"description":"Unauthorized access.","headers":{}},"403":{"description":"Forbidden.","headers":{}},"500":{"description":"Internal server error.","headers":{}}}}}}}
```

## Create a subnet

> A CIDR range is allocated automatically.\
> A network ACL is required and auto-created with a subnet. By default, only outbound traffic from the Bare Metal GPU server to the internet will be allowed.\
> The quota of the subnet is equal to the quota of the Bare Metal GPU server per Tenant.<br>

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"subnets"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v2/vmware/vpc/{vpc_id}/hpc/subnets":{"post":{"summary":"Create a subnet","deprecated":false,"description":"A CIDR range is allocated automatically.\nA network ACL is required and auto-created with a subnet. By default, only outbound traffic from the Bare Metal GPU server to the internet will be allowed.\nThe quota of the subnet is equal to the quota of the Bare Metal GPU server per Tenant.\n","operationId":"createSubnet","tags":["subnets"],"parameters":[{"name":"vpc_id","in":"path","description":"The unique ID of a specified VPC.","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"A unique name for your new subnet."},"id":{"type":"string","description":"Unique ID of an available subnet."},"cidr":{"type":"string","description":"CIDR block of an available subnet."},"network_acl_name":{"type":"string","description":"A unique name for your new Network ACL."},"description":{"type":"string","description":"Description of the subnet.","nullable":true}},"required":["name","cidr","network_acl_name","id"]}}}},"responses":{"201":{"description":"Subnet created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"data":{"type":"object","properties":{}}}}}},"headers":{}},"400":{"description":"Invalid request payload.","headers":{}},"401":{"description":"Unauthorized access.","headers":{}},"403":{"description":"Forbidden.","headers":{}},"500":{"description":"Internal server error.","headers":{}}}}}}}
```

## Update a subnet

> Update the name and description of a subnet.<br>

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"subnets"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v2/vmware/vpc/{vpc_id}/hpc/subnets/{network_id}/":{"put":{"summary":"Update a subnet","deprecated":false,"description":"Update the name and description of a subnet.\n","operationId":"update Subnet","tags":["subnets"],"parameters":[{"name":"vpc_id","in":"path","description":"The unique ID of a specified VPC.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"network_id","in":"path","description":"The ID of the subnet to update.","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The new name of the subnet that you want to update."},"description":{"type":"string","description":"The new name of the description that you want to update."}}}}}},"responses":{"200":{"description":"Subnet updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"data":{"type":"object","properties":{}}}}}},"headers":{}},"400":{"description":"Invalid request payload.","headers":{}},"401":{"description":"Unauthorized access.","headers":{}},"403":{"description":"Forbidden.","headers":{}},"500":{"description":"Internal server error.","headers":{}}}}}}}
```

## Delete a subnet

> You cannot delete a subnet that is associated with other resources.<br>

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"subnets"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v2/vmware/vpc/{vpc_id}/hpc/subnets/{network_id}/":{"delete":{"summary":"Delete a subnet","deprecated":false,"description":"You cannot delete a subnet that is associated with other resources.\n","operationId":"deleteSubnet","tags":["subnets"],"parameters":[{"name":"vpc_id","in":"path","description":"The unique ID of a specified VPC.","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"network_id","in":"path","description":"The unique ID of the subnet to delete.","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Subnet deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}},"headers":{}},"401":{"description":"Unauthorized access.","headers":{}},"403":{"description":"Forbidden.","headers":{}},"500":{"description":"Internal server error.","headers":{}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-docs.fptcloud.com/api-reference/ai-infrastructure/metal-cloud/subnets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
