• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. APIs
  5. Private IP Address
  6. Assigning a Private IP Address

Assigning a Private IP Address

Function

This interface is used to assign a private IP address.

URI

POST /v1/{project_id}/privateips
Table 1 Parameter description

Name

Mandatory

Description

project_id

Yes

Specifies the project ID.

Request Message

  • Request parameter
    Table 2 Request parameter

    Name

    Mandatory

    Type

    Description

    privateips

    Yes

    List data structure

    Specifies the private IP address list objects.

    Table 3 Description of the privateips field

    Name

    Mandatory

    Type

    Description

    subnet_id

    Yes

    String

    Specifies the ID of the subnet from which IP addresses are assigned.

    ip_address

    No

    String

    • Specifies the target IP address.
    • The value can be an available IP address in the subnet. If it is not specified, the system automatically assigns an IP address.
  • Example request
    {
      "privateips": 
       [ 
        {
            "subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd"
        },
        {
            "subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
             "ip_address": "192.168.1.17"
        }
       ]
    }

Response Message

  • Response parameter
    Table 4 Response parameter

    Name

    Type

    Description

    privateips

    List data structure

    Specifies the private IP address list objects.

    Table 5 Description of the privateips field

    Name

    Type

    Description

    status

    String

    • Specifies the status of the private IP address.
    • The value can be ACTIVE or DOWN.

    id

    String

    Specifies the ID of the private IP address, which uniquely identifies the private IP address.

    subnet_id

    String

    Specifies the ID of the subnet from which IP addresses are assigned.

    tenant_id

    String

    Specifies the project ID.

    device_owner

    String

    • Specifies the resource using the private IP address. The parameter is left blank if it is not used.
    • The value can be network:dhcp, network:router_interface_distributed, compute:xxx, or neutron:VIP_PORT. (In value compute:xxx, xxx specifies the AZ name, for example, compute:aa-bb-cc indicates that the private IP address is used by a VM in the aa-bb-cc AZ).
    • The value range specifies only the type of private IP addresses supported by the current service.

    ip_address

    String

    Specifies the assigned private IP address.

  • Example response
    {
        "privateips": [
            {
                "status": "DOWN",
                "id": "c60c2ce1-1e73-44bd-bf48-fd688448ff7b",
                "subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
                "tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
                "device_owner": "",
                "ip_address": "192.168.1.10"
            },
            {
                "status": "DOWN",
                "id": "4b123c18-ae92-4dfa-92cd-d44002359aa1",
                "subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
                "tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
                "device_owner": "",
                "ip_address": "192.168.1.17"
            }
        ]
    }

Status Codes

For details, see section Status Codes.