Documentation ¶
Overview ¶
Sample Code, This interface is used to create a port.
result, err := ports.Create(client, ports.CreateOpts{ Name: "EricTestPort", NetworkId: "5ae24488-454f-499c-86c4-c0355704005d", }).Extract() if err != nil { panic(err) }
Sample Code, This interface is used to update a port.
result, err := ports.Update(client,"5e56a480-f337-4985-8ca4-98546cb4fdae", ports.UpdateOpts{ Name: "ModifiedPort", }).Extract() if err != nil { panic(err) }
Sample Code, This interface is used to query a single port.
result, err := ports.Get(client, "5e56a480-f337-4985-8ca4-98546cb4fdae").Extract() if err != nil { panic(err) }
Sample Code, This interface is used to query ports and to display the ports in a list.
result, err := ports.List(client, ports.ListOpts{ Limit: 3, }).Extract() if err != nil { panic(err) }
Sample Code, This interface is used to delete a port.
result := ports.Delete(client, "5e56a480-f337-4985-8ca4-98546cb4fdae") if err != nil { panic(err) }
Index ¶
- func CreateURL(c *gophercloud.ServiceClient) string
- func DeleteURL(c *gophercloud.ServiceClient, portId string) string
- func GetURL(c *gophercloud.ServiceClient, portId string) string
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func ListURL(c *gophercloud.ServiceClient) string
- func UpdateURL(c *gophercloud.ServiceClient, portId string) string
- type AllowedAddressPair
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type DnsAssignment
- type ExtraDHCPOpt
- type FixedIp
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type ListResult
- type Port
- type PortPage
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
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, portId string) string
func GetURL ¶
func GetURL(c *gophercloud.ServiceClient, portId string) string
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
func ListURL ¶
func ListURL(c *gophercloud.ServiceClient) string
func UpdateURL ¶
func UpdateURL(c *gophercloud.ServiceClient, portId string) string
Types ¶
type AllowedAddressPair ¶
type AllowedAddressPair struct { // Specifies the IP address. You cannot set it to 0.0.0.0. // Configure an independent security group for the port if a large CIDR block (subnet // mask less than 24) is configured for parameter allowed_address_pairs. IpAddress string `json:"ip_address,omitempty"` // Specifies the MAC address. MacAddress string `json:"mac_address,omitempty"` }
type CreateOpts ¶
type CreateOpts struct { // Specifies the port name. The value can contain no more than 255 // characters. This parameter is left blank by default. Name string `json:"name,omitempty"` // Specifies the ID of the network to which the port belongs. The // network ID must be a real one in the network environment. NetworkId string `json:"network_id" required:"true"` // Specifies the administrative state of the port. The value can // only be?true, and the default value is?true. AdminStateUp *bool `json:"admin_state_up,omitempty"` // Specifies the port IP address. A port supports only one fixed // IP address that cannot be changed. FixedIps []FixedIp `json:"fixed_ips,omitempty"` // Specifies the ID of the tenant. Only the administrator can // specify the tenant ID of other tenants. TenantId string `json:"tenant_id,omitempty"` // Specifies the UUID of the security group. This attribute is // extended. SecurityGroups []string `json:"security_groups,omitempty"` // 1. Specifies a set of zero or more allowed address pairs. An // address pair consists of an IP address and MAC address. This attribute is extended. // For details, see parameter?allow_address_pair. 2. The IP address cannot be?0.0.0.0. // 3. Configure an independent security group for the port if a large CIDR block (subnet // mask less than 24) is configured for parameter?allowed_address_pairs. AllowedAddressPairs []AllowedAddressPair `json:"allowed_address_pairs,omitempty"` // Specifies a set of zero or more extra DHCP option pairs. An // option pair consists of an option value and name. This attribute is extended. ExtraDhcpOpts []ExtraDHCPOpt `json:"extra_dhcp_opts,omitempty"` }
func (CreateOpts) ToPortsCreateMap ¶
func (opts CreateOpts) ToPortsCreateMap() (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() (*Port, error)
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
func Delete ¶
func Delete(client *gophercloud.ServiceClient, portId string) (r DeleteResult)
type DnsAssignment ¶
type ExtraDHCPOpt ¶
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
func Get ¶
func Get(client *gophercloud.ServiceClient, portId string) (r GetResult)
type ListOpts ¶
type ListOpts struct { // Specifies that the port ID is used as the filter. ID string `q:"id"` // Specifies that the port name is used as the filter. Name string `q:"name"` // Specifies that the administrative state is used as the // filter. AdminStateUp bool `q:"admin_state_up"` // Specifies that the network ID is used as the filter. NetworkId string `q:"network_id"` // Specifies that the MAC address is used as the filter. MacAddress string `q:"mac_address"` // Specifies that the device ID is used as the filter. DeviceId string `q:"device_id"` // Specifies that the device owner is used as the filter. DeviceOwner string `q:"device_owner"` // Specifies that the status is used as the filter. Status string `q:"status"` // 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"` // Specifies that the EnterpriseProjectId is used as the filter. EnterpriseProjectId string `q:"enterprise_project_id"` }
func (ListOpts) ToListQuery ¶
type ListOptsBuilder ¶
type ListResult ¶
type ListResult struct {
// contains filtered or unexported fields
}
func (ListResult) Extract ¶
func (r ListResult) Extract() (*[]Port, error)
type Port ¶
type Port struct { // Specifies the port ID, which uniquely identifies the port. ID string `json:"id"` // Specifies the port name. The value can contain no more than 255 // characters. This parameter is left blank by default. Name string `json:"name"` // Specifies the ID of the network to which the port belongs. The // network ID must be a real one in the network environment. NetworkId string `json:"network_id"` // Specifies the administrative state of the port. The value can // only be?true, and the default value is?true. AdminStateUp bool `json:"admin_state_up"` // Specifies the port MAC address. The system automatically sets // this parameter, and you are not allowed to configure the parameter value. MacAddress string `json:"mac_address"` // Specifies the port IP address. A port supports only one fixed // IP address that cannot be changed. FixedIps []FixedIp `json:"fixed_ips"` // Specifies the ID of the device to which the port belongs. The // system automatically sets this parameter, and you are not allowed to configure or // change the parameter value. DeviceId string `json:"device_id"` // Specifies the belonged device, which can be the DHCP server, // router, load balancers, or Nova. The system automatically sets this parameter, and // you are not allowed to configure or change the parameter value. DeviceOwner string `json:"device_owner"` // Specifies the ID of the tenant. Only the administrator can // specify the tenant ID of other tenants. TenantId string `json:"tenant_id"` // Specifies the status of the port. The value can // be?ACTIVE,?BUILD, or?DOWN. Status string `json:"status"` // Specifies the UUID of the security group. This attribute is // extended. SecurityGroups []string `json:"security_groups"` // 1. Specifies a set of zero or more allowed address pairs. An // address pair consists of an IP address and MAC address. This attribute is extended. // For details, see parameter?allow_address_pair. 2. The IP address cannot be?0.0.0.0. // 3. Configure an independent security group for the port if a large CIDR block (subnet // mask less than 24) is configured for parameter?allowed_address_pairs. AllowedAddressPairs []AllowedAddressPair `json:"allowed_address_pairs"` // Specifies a set of zero or more extra DHCP option pairs. An // option pair consists of an option value and name. This attribute is extended. ExtraDhcpOpts []ExtraDHCPOpt `json:"extra_dhcp_opts"` // Specifies the type of the bound vNIC. The value can // be?normal?or?direct. Parameter?normal?indicates software switching. // Parameter?direct?indicates SR-IOV PCIe passthrough, which is not supported. BindingvnicType string `json:"binding:vnic_type"` DnsAssignment []DnsAssignment `json:"dns_assignment"` DnsName string `json:"dns_name"` }
func ExtractPorts ¶
func ExtractPorts(r pagination.Page) ([]Port, error)
type UpdateOpts ¶
type UpdateOpts struct { // Specifies the port name. The value can contain no more than 255 // characters. This parameter is left blank by default. Name string `json:"name,omitempty"` // Specifies the UUID of the security group. This attribute is // extended. SecurityGroups []string `json:"security_groups,omitempty"` // 1. Specifies a set of zero or more allowed address pairs. An // address pair consists of an IP address and MAC address. This attribute is extended. // For details, see parameter?allow_address_pair. 2. The IP address cannot be?0.0.0.0. // 3. Configure an independent security group for the port if a large CIDR block (subnet // mask less than 24) is configured for parameter?allowed_address_pairs. AllowedAddressPairs []AllowedAddressPair `json:"allowed_address_pairs,omitempty"` // Specifies a set of zero or more extra DHCP option pairs. An // option pair consists of an option value and name. This attribute is extended. ExtraDhcpOpts []ExtraDHCPOpt `json:"extra_dhcp_opts,omitempty"` }
func (UpdateOpts) ToPortsUpdateMap ¶
func (opts UpdateOpts) ToPortsUpdateMap() (map[string]interface{}, error)
type UpdateOptsBuilder ¶
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
func Update ¶
func Update(client *gophercloud.ServiceClient, portId string, opts UpdateOptsBuilder) (r UpdateResult)
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*Port, error)
Click to show internal directories.
Click to hide internal directories.