Documentation ¶
Overview ¶
A public IP address is an IP address that can be directly accessed over the Internet. Private IP addresses are all IP addresses on the local area network (LAN) of the public cloud and cannot exist on the Internet. An EIP is a static, public IP address. You can bind an EIP to and unbind an EIP from an ECS in your subnet. An EIP enables an ECS in your VPC to communicate with the Internet through a fixed public IP address.
Sample Code, This interface is used to apply for a private IP address.
tenantID := "57e98940a77f4bb988a21a7d0603a626" result, err := privateips.Create(client, tenantID, privateips.CreateOpts{ Privateips: [] privateips.CreatePrivateIp{ { SubnetId:"5ae24488-454f-499c-86c4-c0355704005d", IpAddress: "192.168.0.12", }, }, }).Extract() if err != nil { panic(err) }
Sample Code, This interface is used to query details about a private IP address using the specified ID.
tenantID := "57e98940a77f4bb988a21a7d0603a626" result, err := privateips.Get(client, tenantID, "ea274524-f1cc-4078-8e67-c002be25c413").Extract() if err != nil { panic(err) }
Sample Code, This interface is used to query private IP addresses using search criteria and to display the private IP addresses in a list.
tenantID := "57e98940a77f4bb988a21a7d0603a626" subnetID := "5ae24488-454f-499c-86c4-c0355704005d" result, err := privateips.List(client, tenantID, subnetID, privateips.ListOpts{ Limit: 2, }).Extract() if err != nil { panic(err) }
Sample Code, This interface is used to delete a private IP address.
tenantID := "57e98940a77f4bb988a21a7d0603a626" result := privateips.Delete(client, tenantID, "ea274524-f1cc-4078-8e67-c002be25c413") if err != nil { panic(err) }
Index ¶
- func CreateURL(c *gophercloud.ServiceClient) string
- func DeleteURL(c *gophercloud.ServiceClient, privateipId string) string
- func GetURL(c *gophercloud.ServiceClient, privateipId string) string
- func List(client *gophercloud.ServiceClient, subnetId string, opts ListOptsBuilder) pagination.Pager
- func ListURL(c *gophercloud.ServiceClient, subnetId string) string
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type ListResult
- type PrivateIp
- type PrivateIpCreate
- type PrivateIpPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateURL ¶
func CreateURL(c *gophercloud.ServiceClient) string
func DeleteURL ¶
func DeleteURL(c *gophercloud.ServiceClient, privateipId string) string
func GetURL ¶
func GetURL(c *gophercloud.ServiceClient, privateipId string) string
func List ¶
func List(client *gophercloud.ServiceClient, subnetId string, opts ListOptsBuilder) pagination.Pager
func ListURL ¶
func ListURL(c *gophercloud.ServiceClient, subnetId string) string
Types ¶
type CreateOpts ¶
type CreateOpts struct { // Specifies the private IP address list objects. Privateips []PrivateIpCreate `json:"privateips"` }
func (CreateOpts) ToPrivateipsCreateMap ¶
func (opts CreateOpts) ToPrivateipsCreateMap() (map[string]interface{}, error)
type CreateOptsBuilder ¶
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
func Create ¶
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*[]PrivateIp, error)
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
func Delete ¶
func Delete(client *gophercloud.ServiceClient, privateipId string) (r DeleteResult)
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
func Get ¶
func Get(client *gophercloud.ServiceClient, privateipId string) (r GetResult)
type ListOpts ¶
type ListOpts struct { // Specifies the resource ID of pagination query. If the parameter // is left blank, only resources on the first page are queried. Marker string `q:"marker"` // Specifies the number of records returned on each page. Limit int `q:"limit"` }
func (ListOpts) ToListQuery ¶
type ListOptsBuilder ¶
type ListResult ¶
type ListResult struct {
// contains filtered or unexported fields
}
func (ListResult) Extract ¶
func (r ListResult) Extract() (*[]PrivateIp, error)
type PrivateIp ¶
type PrivateIp struct { // Specifies the status of the private IP address. The value can // be?ACTIVE?or?DOWN. Status string `json:"status"` // Specifies the ID of the private IP address. ID string `json:"id"` // 功能说明:分配IP的子网标识 SubnetId string `json:"subnet_id"` // Specifies the tenant ID of the operator. TenantId string `json:"tenant_id"` // Specifies the VM 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, or?compute:xxx?(xxx?specifies // the AZ name, for example,?compute:aa-bb-cc?indicates that the private IP address is // used by VM in the?aa-bb-ccAZ). The value range specifies only the type of private IP // addresses supported by the current service. DeviceOwner string `json:"device_owner"` // Specifies the private IP address obtained. IpAddress string `json:"ip_address"` }
func ExtractPrivateIps ¶
func ExtractPrivateIps(r pagination.Page) ([]PrivateIp, error)
type PrivateIpCreate ¶
type PrivateIpPage ¶
type PrivateIpPage struct {
pagination.LinkedPageBase
}
func (PrivateIpPage) IsEmpty ¶
func (r PrivateIpPage) IsEmpty() (bool, error)
func (PrivateIpPage) NextPageURL ¶
func (r PrivateIpPage) NextPageURL() (string, error)