EIPGroup Instance
Last Updated:2020-08-05
EIPGroup instance is an EIP shared bandwidth created in Baidu AI Cloud. Identity Verification is required for the creation of EIP shared bandwidth, if you fail to pass identity verification, you can go to identity verification under security authentication in Baidu Open Cloud Console for authentication, and currently, only the creation of prepaid EIP shared bandwidth is supported.
Create Instance
Billing class can be referred to Billing.
The following codes can be used to create EIPGroup instance.
public void createEipGroup(EipGroupClient eipGroupClient, String name, Integer eipCount, Integer bandwidthInMbps, Billing billing) {
CreateEipGroupRequest createEipGroupRequest = new CreateEipGroupRequest();
// Set the name of EipGroup created
createEipGroupRequest.setName(name);
// Set the number of EIP in EIP shared bandwidth
createEipGroupRequest.setEipCount(eipCount);
// Set public network bandwidth, in Mbps
createEipGroupRequest.setBandwidthInMbps(bandwidthInMbps);
// Set order information
createEipGroupRequest.setBilling(billing);
IdResponse idResponse = eipGroupClient.createEipGroup(createEipGroupRequest);
System.out.println(idResponse.getId());
}
Bandwidth Capacity Expansion in EIP Shared Bandwidth
Specify the bandwidth capacity expansion of EIP shared bandwidth
public void resizeBandwidth(EipGroupClient eipGroupClient, Integer bandwidthInMbps) {
BandwidthInMbpsRequest bandwidthInMbpsRequest = new BandwidthInMbpsRequest();
// Set bandwidth size
bandwidthInMbpsRequest.setBandwidthInMbps(bandwidthInMbps);
// Execute capacity expansion and shrinkage
eipGroupClient.resizeBandwidth(bandwidthInMbpsRequest);
}
Quantity Expansion of EIP in EIP Shared Bandwidth
It is used to specify quantity expansion of EIP in EIP shared bandwidth.
public void addCount(EipGroupClient eipGroupClient, Integer eipAddCount) {
EipCountRequest eipCountRequest = new EipCountRequest();
// Set EIP quantity
eipCountRequest.setEipAddCount(eipAddCount);
// Execute EIP quantity expansion
eipGroupClient.addCount(eipCountRequest);
}
Update of EIP Shared Bandwidth
Update of EIP shared bandwidth
public void update(EipGroupClient eipGroupClient, String name) {
EipNameRequest eipNameRequest = new EipNameRequest();
// Set new name
eipNameRequest.setName(name);
// Execute update
eipGroupClient.update(eipNameRequest);
}
Query EIP Shared Bandwidth List
- EIP shared bandwidth list can be queried according to multiple conditions.
- If no query condition is provided, the default query overwrites all EIPs.
- The returned result is the query result of intersection of multiple conditions, i.e. when multiple conditions are provided, EIP shared bandwidth meeting all conditions simultaneously is returned.
- The query result above supports marker paging, with paging size of 1,000 by default, which can be specified via maxKeys parameter.
public void listEipInstance(EipGroupClient eipGroupClient, String marker, Integer maxKeys, String name) {
ListEipGroupRequest listEipGroupRequest = new ListEipGroupRequest();
// Set paging mark
listEipGroupRequest.setMarker(marker);
// Set size of paging return data
listEipGroupRequest.setMaxKeys(maxKeys);
// Set name
listEipGroupRequest.setName(name);
// Execute query list operation
ListEipGroupResponse listEipGroupResponse = eipGroupClient.listEipGroup(listEipGroupRequest);
for (EipGroup eipGroup : listEipGroupResponse.getEipgroups()) {
System.out.println(eipGroup.getId());
}
}
Query Details of EIP Shared Bandwidth
Query details of EIP shared bandwidth.
public void getEipGroup(EipGroupClient eipGroupClient, Integer id) {
GetEipGroupRequest getEipGroupRequest = new GetEipGroupRequest();
// Query details of EIP shared bandwidth.
GetEipGroupResponse getEipGroupResponse = eipGroupClient.getEipGroup(getEipGroupRequest.setId(id));
System.out.println(getEipGroupResponse.getBandwidthInMbps());
List<Eip> eips = getEipGroupResponse.getEips();
}
Renewal of EIP Shared Bandwidth
- For the renewal operation of specified EIP shared bandwidth, extend the expiration time.
- No renewal operation can be conducted during EIP shared bandwidth capacity expansion and reduction.
public void purchaseReservedEipGroup(EipGroupClient eipGroupClient, Integer id, Billing billing) {
PurchaseReservedEipGroupRequest purchaseReservedEipGroupRequest = new PurchaseReservedEipGroupRequest();
// Set id
purchaseReservedEipGroupRequest.setId(id);
// Set billing information
purchaseReservedEipGroupRequest.setBilling(billing);
// Execute renewal
eipGroupClient.purchaseReservedEipGroup(purchaseReservedEipGroupRequest);
}