vpcs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNetworksInto

func ExtractNetworksInto(r pagination.Page, v interface{}) error

func List

List returns a Pager which allows you to iterate over a collection of networks. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type CreateOpts

type CreateOpts struct {
	Name     string `json:"name"`
	Cidrv4   string `json:"cidrv4"`
	TenantID string `json:"tenant_id,omitempty"`
}

CreateOpts represents options used to create a network.

func (CreateOpts) ToNetworkCreateMap

func (opts CreateOpts) ToNetworkCreateMap() (map[string]interface{}, error)

ToNetworkCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToNetworkCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

func Create

Create accepts a CreateOpts struct and creates a new network using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

The tenant ID that is contained in the URI is the tenant that creates the network. An admin user, however, has the option of specifying another tenant ID in the CreateOpts struct.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Network, error)

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

func Delete

func Delete(c *gophercloud.ServiceClient, networkID string) (r DeleteResult)

Delete accepts a unique ID and deletes the network associated with it.

type GetResult

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

func Get

func Get(c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific network based on its unique ID.

func (GetResult) Extract

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

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	TenantID string `q:"tenant_id"`
	ID       string `q:"id"`
	Name     string `q:"name"`
	External string `q:"router:external"`
	Shared   *bool  `q:"shared"`
	SortKey  string `q:"sort_key"`
	SortDir  string `q:"sort_dir"`
	Marker   string `q:"marker"`
	Limit    int    `q:"limit"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the network attributes you want to see returned. SortKey allows you to sort by a particular network attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToNetworkListQuery

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

ToNetworkListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add additional parameters to the List request.

type Network

type Network struct {
	// Name of VPC to query
	Name string `json:"name"`

	// Tenant ID to which VPC to query is included
	TenantID string `json:"tenant_id"`

	// Status of VPC to query
	State string `json:"state"`

	// Created time of VPC to query
	CreateTime string `json:"create_time"`

	// CIDR of VPC to query
	Cidrv4 string `json:"cidrv4"`

	// Whether to share VPC to query
	Shared bool `json:"shared"`

	// VPC ID to query
	ID string `json:"id"`

	// Whether network is externally connected
	External bool `json:"router:external"`

	// UpdatedAt and CreatedAt contain ISO-8601 timestamps of when the state of the
	// network last changed, and when it was created.
	UpdatedAt time.Time `json:"-"`
	CreatedAt time.Time `json:"-"`
}

func ExtractNetworks

func ExtractNetworks(r pagination.Page) ([]Network, error)

ExtractNetworks accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Network structs. In other words, a generic collection is mapped into a relevant slice.

func (*Network) UnmarshalJSON

func (r *Network) UnmarshalJSON(b []byte) error

type NetworkDetail

type NetworkDetail struct {
	External      bool `json:"router:external,omitempty"`
	Routingtables []struct {
		DefaultTable bool   `json:"default_table,omitempty"`
		ID           string `json:"id,omitempty"`
		Name         string `json:"name,omitempty"`
	} `json:"routingtables,omitempty"`
	Name    string `json:"name,omitempty"`
	Subnets []struct {
		External   bool   `json:"router:external,omitempty"`
		Name       string `json:"name,omitempty"`
		EnableDHCP bool   `json:"enable_dhcp,omitempty"`
		TenantID   string `json:"tenant_id,omitempty"`
		Gateway    string `json:"gateway,omitempty"`
		Routes     []struct {
			SubnetID string `json:"subnet_id,omitempty"`
			TenantID string `json:"tenant_id,omitempty"`
			Mask     int    `json:"mask,omitempty"`
			Gateway  string `json:"gateway,omitempty"`
			CIDR     string `json:"cidr,omitempty"`
			ID       string `json:"id,omitempty"`
		} `json:"routes,omitempty"`
		State            string `json:"state,omitempty"`
		CreateTime       string `json:"create_time,omitempty"`
		AvailableIPCount int    `json:"available_ip_count,omitempty"`
		Routingtable     struct {
			GatewayID    string `json:"gateway_id,omitempty"`
			DefaultTable bool   `json:"default_table,omitempty"`
			Explicit     bool   `json:"explicit,omitempty"`
			ID           string `json:"id,omitempty"`
			Name         string `json:"name,omitempty"`
		} `json:"routingtable,omitempty"`
		VPC struct {
			Shared bool   `json:"shared,omitempty"`
			State  string `json:"state,omitempty"`
			ID     string `json:"id,omitempty"`
			Cidrv4 string `json:"cidrv4,omitempty"`
			Name   string `json:"name,omitempty"`
		} `json:"vpc,omitempty"`
		Shared bool   `json:"shared,omitempty"`
		ID     string `json:"id,omitempty"`
		VpcId  string `json:"vpc_id,omitempty"`
		CIDR   string `json:"cidr,omitempty"`
	} `json:"subnets,omitempty"`
	TenantID   string `json:"tenant_id,omitempty"`
	State      string `json:"state,omitempty"`
	CreateTime string `json:"create_time,omitempty"`
	Cidrv4     string `json:"cidrv4,omitempty"`
	Shared     bool   `json:"shared,omitempty"`
	ID         string `json:"id,omitempty"`
}

type NetworkPage

type NetworkPage struct {
	pagination.LinkedPageBase
}

NetworkPage is the page returned by a pager when traversing over a collection of networks.

func (NetworkPage) IsEmpty

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

IsEmpty checks whether a NetworkPage struct is empty.

func (NetworkPage) NextPageURL

func (r NetworkPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of networks has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type UpdateOpts

type UpdateOpts struct {
	Name   *string `json:"name,omitempty"`
	Cidrv4 *string `json:"cidrv4,omitempty"`

	// RevisionNumber implements extension:standard-attr-revisions. If != "" it
	// will set revision_number=%s. If the revision number does not match, the
	// update will fail.
	RevisionNumber *int `json:"-" h:"If-Match"`
}

UpdateOpts represents options used to update a network.

func (UpdateOpts) ToNetworkUpdateMap

func (opts UpdateOpts) ToNetworkUpdateMap() (map[string]interface{}, error)

ToNetworkUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToNetworkUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

func Update

func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing network using the values provided. For more information, see the Create function.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Network, error)

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Jump to

Keyboard shortcuts

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