百度智能云

All Product Document

          Elastic IP

          EIP

          Apply for EIP

          • Apply for an EIP, which can be used to bind to any BCC instance.
          • Real name authentication is required for creation of EIP, if you fail to pass real name authentication, you can go to real name authentication under security authentication in [Baidu Open Cloud official website console](https://console.bce.baidu.com/qualify/? _=1567871861163#/qualify/result) for authentication.
          args := &CreateEipArgs{ 
              Name:            "sdk-eip", 
              BandWidthInMbps: 1, 
              Billing: &Billing{ 
                  PaymentTiming: "Postpaid", 
                  BillingMethod: "ByTraffic", 
              }, 
              ClientToken: getClientToken(), 
          } 
          result, err := EIP_CLIENT.CreateEip(args) 
          
          EIP_ADDRESS = result.Eip 

          Capacity Expansion and Reduction of EIP Bandwidth

          • Used for the bandwidth capacity expansion and reduction of specified EIP.
          • Check whether EIP capacity expansion and reduction state is completed by querying EIP list.
          args := &ResizeEipArgs{ 
              NewBandWidthInMbps: 2, 
              ClientToken:        getClientToken(), 
          } 
          err := EIP_CLIENT.ResizeEip(EIP_ADDRESS, args) 
            

          Bind EIP

          • Bind EIP to an instance.
          • Only the EIP in available state supports binding operation.
          • The bound instance cannot have any existing EIP binding relationship.
          • The bound instance cannot be in arrearage state.
          args := &BindEipArgs{ 
              InstanceType: "BCC", 
              InstanceId:   BCC_TEST_ID, 
              ClientToken:  getClientToken(), 
          } 
          err := EIP_CLIENT.BindEip(EIP_ADDRESS, args) 

          Unbind EIP

          • Unbind the specified EIP.
          • The unbound EIP must have been bound to any instance.
          err := EIP_CLIENT.UnBindEip(EIP_ADDRESS, getClientToken()) 

          Release EIP

          • Release the specified EIP, and the released EIP cannot be recovered.
          • If EIP is bound to any instance, it can be released before unbinding.
          err := EIP_CLIENT.DeleteEip(EIP_ADDRESS, getClientToken()) 

          Query EIP List

          • You can query EIP list according to multiple conditions.
          • If it is only needed to query the details of a single EIP, you only need to provide eip parameters.
          • If you only need to query the EIP bound to a specified instance, you only need to provide instanceType parameter.
          • If you only need to query the details of EIP bound to a specified instance, you only need to provide instanceType and instanceId parameters.
          • If you do not provide the query conditions, all EIPs are overwritten by default.
          • The returned result is the query result of intersection of multiple conditions, i.e. when multiple conditions are provided, EIP 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.
          args := &ListEipArgs{} 
          result, err := EIP_CLIENT.ListEip(args) 
          ExpectEqual(t.Errorf, nil, err) 
          for _, e := range result.EipList { 
              if e.Eip == EIP_ADDRESS { 
                  ExpectEqual(t.Errorf, "Postpaid", e.PaymentTiming) 
                  ExpectEqual(t.Errorf, "ByTraffic", e.BillingMethod) 
                  ExpectEqual(t.Errorf, 2, e.BandWidthInMbps) 
              } 
          } 

          EIP Renewal

          • For the renewal operation of specified EIP, extend the expiration time.
          • No renewal operation can be conducted during EIP capacity expansion and reduction.
          args := &PurchaseReservedEipArgs{ 
              Billing: &Billing{ 
                  Reservation: &Reservation{ 
                      ReservationLength:   1, 
                      ReservationTimeUnit: "month", 
                  }, 
              }, 
          } 
          err := EIP_CLIENT.PurchaseReservedEip(EIP_ADDRESS, args) 
          ExpectEqual(t.Errorf, nil, err) 
          Previous
          Exception Handling
          Next
          SDK Installation Toolkit