segments

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSegmentsInto

func ExtractSegmentsInto(r pagination.Page, v any) error

ExtractSegmentsInto extracts the elements into a slice of Segment structs.

func List

func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List all segments.

Types

type CreateOpts

type CreateOpts struct {
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	NetworkID       string `json:"network_id" required:"true"`
	NetworkType     string `json:"network_type" required:"true"`
	PhysicalNetwork string `json:"physical_network,omitempty"`
	SegmentationID  int    `json:"segmentation_id,omitempty"`
}

CreateOpts contains the fields needed for creating a segment.

func (CreateOpts) ToSegmentCreateMap

func (opts CreateOpts) ToSegmentCreateMap() (map[string]any, error)

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters.

type CreateResult

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

func Create

func Create(ctx context.Context, c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create a new segment.

func (CreateResult) Extract

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

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v any) error

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

func Delete

func Delete(ctx context.Context, c *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete removes a segment by ID.

type GetResult

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

func Get

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

Get retrieves a segment by ID.

func (GetResult) Extract

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

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v any) error

type ListOpts

type ListOpts struct {
	Name            string `q:"name"`
	Description     string `q:"description"`
	NetworkID       string `q:"network_id"`
	PhysicalNetwork string `q:"physical_network"`
	NetworkType     string `q:"network_type"`
	SegmentationID  int    `q:"segmentation_id"`
	RevisionNumber  int    `q:"revision_number"`
	SortDir         string `q:"sort_dir"`
	SortKey         string `q:"sort_key"`
	Fields          string `q:"fields"`
}

ListOpts allows filtering when listing segments.

func (ListOpts) ToSegmentListQuery

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

type ListOptsBuilder

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

ListOptsBuilder interface for listing.

type Segment

type Segment struct {
	ID              string    `json:"id"`
	Name            string    `json:"name"`
	Description     string    `json:"description"`
	NetworkID       string    `json:"network_id"`
	NetworkType     string    `json:"network_type"`
	PhysicalNetwork string    `json:"physical_network"`
	SegmentationID  int       `json:"segmentation_id"`
	RevisionNumber  int       `json:"revision_number"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

Segment model

func ExtractSegments

func ExtractSegments(r pagination.Page) ([]Segment, error)

type SegmentPage

type SegmentPage struct {
	pagination.LinkedPageBase
}

SegmentPage wraps a page of segments.

func (SegmentPage) IsEmpty

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

type UpdateOpts

type UpdateOpts struct {
	Name           *string `json:"name,omitempty"`
	Description    *string `json:"description,omitempty"`
	SegmentationID *int    `json:"segmentation_id,omitempty"`
}

UpdateOpts contains fields to update a segment.

func (UpdateOpts) ToSegmentUpdateMap

func (opts UpdateOpts) ToSegmentUpdateMap() (map[string]any, error)

type UpdateOptsBuilder

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

UpdateOptsBuilder is the interface for update options.

type UpdateResult

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

func Update

func Update(ctx context.Context, c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update a segment.

func (UpdateResult) Extract

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

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v any) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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