ports

package
v0.0.0-...-ae37572 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

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

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 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 CreateOptsBuilder interface {
	ToPortsCreateMap() (map[string]interface{}, error)
}

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 DnsAssignment struct {

	// 功能说明:fqdn
	Fqdn string `json:"fqdn,omitempty"`

	// 功能说明:hostname
	HostName string `json:"hostname,omitempty"`

	// 功能说明:ip_address
	IpAddress string `json:"ip_address,omitempty"`
}

type ExtraDHCPOpt

type ExtraDHCPOpt struct {
	// 功能说明:Option名称
	OptName string `json:"opt_name,omitempty"`

	// 功能说明:Option值
	OptValue string `json:"opt_value,omitempty"`
}

type FixedIp

type FixedIp struct {
	// Specifies the subnet ID. You cannot change the parameter
	// value.
	SubnetId string `json:"subnet_id,omitempty"`

	// Specifies the port IP address. You cannot change the parameter
	// value.
	IpAddress string `json:"ip_address,omitempty"`
}

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

func Get

func Get(client *gophercloud.ServiceClient, portId string) (r GetResult)

func (GetResult) Extract

func (r GetResult) Extract() (*Port, error)

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

func (opts ListOpts) ToListQuery() (string, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToListQuery() (string, error)
}

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 PortPage

type PortPage struct {
	pagination.LinkedPageBase
}

func (PortPage) IsEmpty

func (r PortPage) IsEmpty() (bool, error)

func (PortPage) NextPageURL

func (r PortPage) NextPageURL() (string, 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 UpdateOptsBuilder interface {
	ToPortsUpdateMap() (map[string]interface{}, error)
}

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL