api

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForImageReady added in v1.15.0

func WaitForImageReady(c *APIClient, ctx context.Context, config *TestConfig, imageID string)

WaitForImageReady polls until the image appears in the region with state ready. Uses a 1-hour timeout to accommodate image download and import times.

func WaitForLoadBalancerGone added in v1.16.5

func WaitForLoadBalancerGone(c *APIClient, ctx context.Context, lbID string)

WaitForLoadBalancerGone polls until GET for the load balancer returns the expected not-found error.

func WaitForLoadBalancerProvisioned added in v1.16.5

func WaitForLoadBalancerProvisioned(c *APIClient, ctx context.Context, lbID string)

WaitForLoadBalancerProvisioned polls until the load balancer reaches Provisioned.

Types

type APIClient

type APIClient struct {
	*coreclient.APIClient
	// contains filtered or unexported fields
}

APIClient wraps the core API client with region-specific methods. Add methods here as you write tests for specific endpoints.

func NewAPIClient

func NewAPIClient(baseURL string) (*APIClient, error)

NewAPIClient creates a new Region API client.

func NewAPIClientWithConfig

func NewAPIClientWithConfig(config *TestConfig) *APIClient

NewAPIClientWithConfig creates a new Region API client with the given config.

func (*APIClient) CreateFileStorage added in v1.15.0

CreateFileStorage creates a new file storage resource.

func (*APIClient) CreateImage added in v1.15.0

func (c *APIClient) CreateImage(ctx context.Context, orgID, regionID string, request regionopenapi.ImageCreate) (*regionopenapi.Image, error)

CreateImage creates a custom image in a region.

func (*APIClient) CreateLoadBalancer added in v1.16.1

CreateLoadBalancer creates a new load balancer.

func (*APIClient) CreateNetwork added in v1.15.0

CreateNetwork creates a new network resource.

func (*APIClient) DeleteFileStorage added in v1.15.0

func (c *APIClient) DeleteFileStorage(ctx context.Context, filestorageID string) error

DeleteFileStorage deletes a file storage resource.

func (*APIClient) DeleteImage added in v1.15.0

func (c *APIClient) DeleteImage(ctx context.Context, orgID, regionID, imageID string) error

DeleteImage deletes a specific image from a region. Returns ErrResourceNotFound if the image does not exist.

func (*APIClient) DeleteLoadBalancer added in v1.16.1

func (c *APIClient) DeleteLoadBalancer(ctx context.Context, loadBalancerID string) error

DeleteLoadBalancer deletes a load balancer.

func (*APIClient) DeleteNetwork added in v1.15.0

func (c *APIClient) DeleteNetwork(ctx context.Context, networkID string) error

DeleteNetwork deletes a network resource.

func (*APIClient) DoRegionRequest added in v1.15.0

func (c *APIClient) DoRegionRequest(ctx context.Context, method, path string, body io.Reader, expectedStatus int) (*http.Response, []byte, error)

DoRegionRequest performs a request using the region base URL client. Use this for direct API calls that need to hit the region API.

func (*APIClient) GetEndpoints added in v1.15.0

func (c *APIClient) GetEndpoints() *Endpoints

GetEndpoints returns the endpoints instance for direct path access in tests.

func (*APIClient) GetFileStorage added in v1.15.0

func (c *APIClient) GetFileStorage(ctx context.Context, filestorageID string) (*regionopenapi.StorageV2Read, error)

GetFileStorage gets a specific file storage resource by ID.

func (*APIClient) GetListRegionsPath

func (c *APIClient) GetListRegionsPath(orgID string) string

GetListRegionsPath returns the path for listing regions. This is useful for tests that need direct access to the endpoint path.

func (*APIClient) GetLoadBalancer added in v1.16.1

func (c *APIClient) GetLoadBalancer(ctx context.Context, loadBalancerID string) (*regionopenapi.LoadBalancerV2Read, error)

GetLoadBalancer gets a specific load balancer by ID.

func (*APIClient) GetNetwork added in v1.16.5

func (c *APIClient) GetNetwork(ctx context.Context, networkID string) (*regionopenapi.NetworkV2Read, error)

GetNetwork gets a specific network by ID.

func (*APIClient) GetRegionDetail

func (c *APIClient) GetRegionDetail(ctx context.Context, orgID, regionID string) (*regionopenapi.RegionDetailRead, error)

GetRegionDetail gets detailed information about a specific region.

func (*APIClient) ListExternalNetworks

func (c *APIClient) ListExternalNetworks(ctx context.Context, orgID, regionID string) (regionopenapi.ExternalNetworks, error)

ListExternalNetworks lists all external networks available in a region.

func (*APIClient) ListFileStorage added in v1.15.0

func (c *APIClient) ListFileStorage(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.StorageV2List, error)

ListFileStorage lists all file storage resources for a project in a region.

func (*APIClient) ListFileStorageClasses added in v1.15.0

func (c *APIClient) ListFileStorageClasses(ctx context.Context, regionID string) (regionopenapi.StorageClassListV2Read, error)

ListFileStorageClasses lists all available file storage classes for a region.

func (*APIClient) ListFlavors

func (c *APIClient) ListFlavors(ctx context.Context, orgID, regionID string) (regionopenapi.Flavors, error)

ListFlavors lists all flavors available in a region.

func (*APIClient) ListImages

func (c *APIClient) ListImages(ctx context.Context, orgID, regionID string) (regionopenapi.Images, error)

ListImages lists all images available in a region.

func (*APIClient) ListLoadBalancers added in v1.16.1

func (c *APIClient) ListLoadBalancers(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.LoadBalancersV2Read, error)

ListLoadBalancers lists all load balancers for a project in a region.

func (*APIClient) ListNetworks added in v1.15.0

func (c *APIClient) ListNetworks(ctx context.Context, orgID, projectID, regionID string) (regionopenapi.NetworksV2Read, error)

ListNetworks lists all networks for a project in a region.

func (*APIClient) ListRegions

func (c *APIClient) ListRegions(ctx context.Context, orgID string) (regionopenapi.Regions, error)

ListRegions lists all regions for an organization.

func (*APIClient) UpdateFileStorage added in v1.15.0

func (c *APIClient) UpdateFileStorage(ctx context.Context, filestorageID string, request regionopenapi.StorageV2UpdateRequest) (*regionopenapi.StorageV2Read, error)

UpdateFileStorage updates a file storage resource.

func (*APIClient) UpdateLoadBalancer added in v1.16.1

func (c *APIClient) UpdateLoadBalancer(ctx context.Context, loadBalancerID string, request regionopenapi.LoadBalancerV2Update) (*regionopenapi.LoadBalancerV2Read, error)

UpdateLoadBalancer updates a load balancer.

func (*APIClient) UpdateNetwork added in v1.16.5

func (c *APIClient) UpdateNetwork(ctx context.Context, networkID string, request regionopenapi.NetworkV2Update) (*regionopenapi.NetworkV2Read, error)

UpdateNetwork updates a network resource.

type Endpoints

type Endpoints struct{}

Endpoints contains API endpoint patterns. Add endpoint methods here as you write tests for them.

func NewEndpoints

func NewEndpoints() *Endpoints

NewEndpoints creates a new Endpoints instance.

func (*Endpoints) CreateFileStorage added in v1.15.0

func (e *Endpoints) CreateFileStorage() string

CreateFileStorage returns the endpoint for creating file storage.

func (*Endpoints) CreateLoadBalancer added in v1.16.1

func (e *Endpoints) CreateLoadBalancer() string

CreateLoadBalancer returns the endpoint for creating a load balancer.

func (*Endpoints) CreateNetwork added in v1.15.0

func (e *Endpoints) CreateNetwork() string

CreateNetwork returns the endpoint for creating a network.

func (*Endpoints) DeleteFileStorage added in v1.15.0

func (e *Endpoints) DeleteFileStorage(filestorageID string) string

DeleteFileStorage returns the endpoint for deleting a specific file storage resource.

func (*Endpoints) DeleteImage added in v1.15.0

func (e *Endpoints) DeleteImage(orgID, regionID, imageID string) string

DeleteImage returns the endpoint for deleting a specific image.

func (*Endpoints) DeleteLoadBalancer added in v1.16.1

func (e *Endpoints) DeleteLoadBalancer(loadBalancerID string) string

DeleteLoadBalancer returns the endpoint for deleting a specific load balancer.

func (*Endpoints) DeleteNetwork added in v1.15.0

func (e *Endpoints) DeleteNetwork(networkID string) string

DeleteNetwork returns the endpoint for deleting a specific network resource.

func (*Endpoints) GetFileStorage added in v1.15.0

func (e *Endpoints) GetFileStorage(filestorageID string) string

GetFileStorage returns the endpoint for getting a specific file storage resource.

func (*Endpoints) GetLoadBalancer added in v1.16.1

func (e *Endpoints) GetLoadBalancer(loadBalancerID string) string

GetLoadBalancer returns the endpoint for getting a specific load balancer.

func (*Endpoints) GetNetwork added in v1.16.5

func (e *Endpoints) GetNetwork(networkID string) string

GetNetwork returns the endpoint for getting a specific network resource.

func (*Endpoints) GetRegionDetail

func (e *Endpoints) GetRegionDetail(orgID, regionID string) string

GetRegionDetail returns the endpoint for getting detailed region information.

func (*Endpoints) ListExternalNetworks

func (e *Endpoints) ListExternalNetworks(orgID, regionID string) string

ListExternalNetworks returns the endpoint for listing external networks in a region.

func (*Endpoints) ListFileStorage added in v1.15.0

func (e *Endpoints) ListFileStorage(orgID, projectID, regionID string) string

ListFileStorage returns the endpoint for listing file storage in a project.

func (*Endpoints) ListFileStorageClasses added in v1.15.0

func (e *Endpoints) ListFileStorageClasses(regionID string) string

ListFileStorageClasses returns the endpoint for listing available file storage classes.

func (*Endpoints) ListFlavors

func (e *Endpoints) ListFlavors(orgID, regionID string) string

ListFlavors returns the endpoint for listing flavors in a region.

func (*Endpoints) ListImages

func (e *Endpoints) ListImages(orgID, regionID string) string

ListImages returns the endpoint for listing images in a region.

func (*Endpoints) ListLoadBalancers added in v1.16.1

func (e *Endpoints) ListLoadBalancers(orgID, projectID, regionID string) string

ListLoadBalancers returns the endpoint for listing load balancers in a project.

func (*Endpoints) ListNetworks added in v1.15.0

func (e *Endpoints) ListNetworks(orgID, projectID, regionID string) string

ListNetworks returns the endpoint for listing networks in a project.

func (*Endpoints) ListRegions

func (e *Endpoints) ListRegions(orgID string) string

ListRegions returns the endpoint for listing all regions in an organization.

func (*Endpoints) UpdateFileStorage added in v1.15.0

func (e *Endpoints) UpdateFileStorage(filestorageID string) string

UpdateFileStorage returns the endpoint for updating a specific file storage resource.

func (*Endpoints) UpdateLoadBalancer added in v1.16.1

func (e *Endpoints) UpdateLoadBalancer(loadBalancerID string) string

UpdateLoadBalancer returns the endpoint for updating a specific load balancer.

func (*Endpoints) UpdateNetwork added in v1.16.5

func (e *Endpoints) UpdateNetwork(networkID string) string

UpdateNetwork returns the endpoint for updating a specific network resource.

type GinkgoLogger

type GinkgoLogger struct{}

GinkgoLogger implements the Logger interface for Ginkgo tests.

func (*GinkgoLogger) Printf

func (g *GinkgoLogger) Printf(format string, args ...interface{})

type ImagePayloadBuilder added in v1.15.0

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

ImagePayloadBuilder builds ImageCreate payloads for testing.

func NewImagePayload added in v1.15.0

func NewImagePayload() *ImagePayloadBuilder

NewImagePayload creates a builder with sensible defaults.

func (*ImagePayloadBuilder) Build added in v1.15.0

Build returns the typed ImageCreate struct.

func (*ImagePayloadBuilder) WithArchitecture added in v1.15.0

WithArchitecture overrides the CPU architecture.

func (*ImagePayloadBuilder) WithName added in v1.15.0

func (b *ImagePayloadBuilder) WithName(name string) *ImagePayloadBuilder

WithName overrides the image name.

func (*ImagePayloadBuilder) WithOSCodename added in v1.15.0

func (b *ImagePayloadBuilder) WithOSCodename(codename string) *ImagePayloadBuilder

WithOSCodename overrides the OS codename (e.g. "noble").

func (*ImagePayloadBuilder) WithOSDistro added in v1.15.0

WithOSDistro overrides the OS distribution.

func (*ImagePayloadBuilder) WithOSFamily added in v1.15.0

WithOSFamily overrides the OS family.

func (*ImagePayloadBuilder) WithOSKernel added in v1.15.0

WithOSKernel overrides the OS kernel type.

func (*ImagePayloadBuilder) WithOSVersion added in v1.15.0

func (b *ImagePayloadBuilder) WithOSVersion(version string) *ImagePayloadBuilder

WithOSVersion overrides the OS version string.

func (*ImagePayloadBuilder) WithURI added in v1.15.0

WithURI overrides the image source URI.

func (*ImagePayloadBuilder) WithVirtualization added in v1.15.0

WithVirtualization overrides the virtualization type.

type LoadBalancerPayloadBuilder added in v1.16.1

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

LoadBalancerPayloadBuilder builds LoadBalancerV2Create payloads for testing.

func NewLoadBalancerPayload added in v1.16.1

func NewLoadBalancerPayload(networkID string) *LoadBalancerPayloadBuilder

NewLoadBalancerPayload creates a builder with a single TCP listener and one pool member, wired to the given network. The default member ensures the payload is ready to provision against the OpenStack provider, which yields indefinitely while the pool has no effective members.

func (*LoadBalancerPayloadBuilder) Build added in v1.16.1

Build returns the typed LoadBalancerV2Create struct.

func (*LoadBalancerPayloadBuilder) WithListeners added in v1.16.1

WithListeners overrides the listener list.

func (*LoadBalancerPayloadBuilder) WithName added in v1.16.1

WithName overrides the load balancer name.

func (*LoadBalancerPayloadBuilder) WithPublicIP added in v1.16.1

func (b *LoadBalancerPayloadBuilder) WithPublicIP(publicIP bool) *LoadBalancerPayloadBuilder

WithPublicIP sets whether a public IP should be allocated.

type NetworkPayloadBuilder added in v1.16.1

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

NetworkPayloadBuilder builds NetworkV2Create payloads for testing.

func NewNetworkPayload added in v1.16.1

func NewNetworkPayload(orgID, projectID, regionID string) *NetworkPayloadBuilder

NewNetworkPayload creates a builder with sensible defaults for a project-scoped v2 network.

func (*NetworkPayloadBuilder) Build added in v1.16.1

Build returns the typed NetworkV2Create struct.

func (*NetworkPayloadBuilder) WithName added in v1.16.1

WithName overrides the network name.

type TestConfig

type TestConfig struct {
	coreconfig.BaseConfig
	OrgID              string
	ProjectID          string
	RegionBaseURL      string
	RegionID           string
	PrivateRegionID    string
	SecondaryOrgID     string
	SecondaryProjectID string
	SecondaryAuthToken string
}

TestConfig extends the base config with Region-specific fields.

func LoadTestConfig

func LoadTestConfig() (*TestConfig, error)

LoadTestConfig loads configuration from environment variables and .env files using viper. Returns an error if required configuration values are missing.

Jump to

Keyboard shortcuts

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