调用 AssignPrivateIpAddresses 接口,为网卡(主网卡/辅助网卡)分配辅助私网IPv4地址。
Available
或InUse
状态下的辅助网卡,可分配辅助私网IPv4地址。RUNNING
或STOPPED
状态。Available
状态,最多可以分配49个辅助私网IPv4地址;辅助网卡处于InUse
状态,可分配的辅助私网IPv4地址数量受挂载实例的规格限制。参数名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AssignPrivateIpAddresses | 要执行的操作。取值:AssignPrivateIpAddresses。 |
Version | String | 是 | 2020-04-01 | API版本信息,取值为:2020-04-01。 |
NetworkInterfaceId | String | 是 | eni-bp67acfmxazb4p**** | 网卡的ID。 |
PrivateIpAddress.N | String | 否 | PrivateIpAddress.1=192.168.XX.10&PrivateIpAddress.2=192.168.XX.12 | 为网卡指定私网IP地址的IP和数量。
说明
|
SecondaryPrivateIpAddressCount | Integer | 否 | 1 | 为网卡分配辅助私网IPv4地址数量。系统会自动从网卡所属子网中,分配相应数量的空闲IP地址作为网卡的辅助私网IPv4地址。 说明 参数 |
参数名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | 请求ID。 |
NetworkInterfaceId | String | eni-bp125p95hhdhn3ot**** | 网卡ID。 |
PrivateIpSet | Array | [ "192.168.XX.10","192.168.XX.12" ] | 网卡辅助私网IPv4地址集合。 |
GET /?Action=AssignPrivateIpAddresses&Version=2020-04-01&NetworkInterfaceId=eni-bp67acfmxazb4p****&PrivateIpAddress.1=192.168.XX.10&PrivateIpAddress.2=192.168.XX.12 HTTP/1.1 Host: open.volcengineapi.com Service: vpc Region: cn-beijing
{ "ResponseMetadata": { "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****", "Action": "AssignPrivateIpAddresses", "Version": "2020-04-01", "Service": "vpc", "Region": "cn-beijing" }, "Result": { "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****", "NetworkInterfaceId": "eni-bp125p95hhdhn3ot****", "PrivateIpSet": [ "192.168.XX.10", "192.168.XX.12" ] } }
此处仅展示当前API的错误码,更多错误码请参见公共错误码。
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InsufficientIpInSubnet | The specified subnet does not contain enough free private IP addresses to fulfill your request. | 指定子网下可用IP不足。 |
400 | InvalidEni.InvalidStatus | The specified elastic network interface is not in the correct status for the request. | 指定的弹性网卡所处的状态无法响应该请求。 |
400 | InvalidEniIp.Malformed | The specified elastic network interface ip is malformed. If you are specifying an IP of an elastic network interface, ensure it must fall into the range of the CIDR block of the subnet to which the elastic network interface belongs to. | 指定的弹性网卡IP不合法。请确保网卡IP必须从属于所在子网的网段。 |
400 | InvalidInstance.InvalidStatus | The specified instance is not in the correct status for the request. | 指定的ECS实例所处的状态无法响应该请求。 |
400 | InvalidPrivateIp.Malformed | The specified private ip is malformed. | 指定的私网IP不合法。 |
400 | LimitExceeded.Ipv6AddressesPerEni | You've reached the limit on the number of IPv6 addresses per ENI that you can assign. | 已达到网卡可分配的IPv6地址的数量上限。 |
400 | LimitExceeded.PrivateIpsPerEni | You've reached the limit on the number of private IPs per ENI that you can assign. | 已达到网卡可分配的辅助IP的数量上限。 |
400 | QuotaExceeded.SecurityGroupIp | The number of IP addresses bound to the security group exceeded quota. | 已达到安全组可绑定IP地址的数量上限。 |
403 | Forbidden | You are not authorized to perform operations on the specified elastic network interface. The specified elastic network interface is a service-managed elastic network interface. | 无权限对指定弹性网卡进行操作。指定的弹性网卡为云产品托管的弹性网卡。 |
404 | InvalidEniId.NotFound | The specified elastic network interface does not exist. | 指定的弹性网卡不存在。 |
409 | InvalidIpAddress.InUse | The specified IP address is in use. | 指定的IP地址已被占用。 |
409 | InvalidParameter.ParameterConflict | The parameters for IP address number and IP addresses cannot be specified at the same time. | 该请求不允许同时传入IP地址数量以及IP地址。 |