client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestIDHeaderName is the name of the header that carries the request ID.
	RequestIDHeaderName = "NTNX-Request-Id"
)

Variables

View Source
var (
	// ErrTaskFailed is returned when a task has failed.
	ErrTaskFailed = fmt.Errorf("task failed")
	// ErrTaskCancelled is returned when a task has been cancelled.
	ErrTaskCancelled = fmt.Errorf("task cancelled")
	// ErrTaskOngoing is returned when a task is still ongoing.
	ErrTaskOngoing = fmt.Errorf("task ongoing")
)

Functions

This section is empty.

Types

type AsyncTaskOpts added in v0.2.0

type AsyncTaskOpts struct {
	// RequestID is the ID of the request. This will be used to set the request ID header.
	RequestID string
}

AsyncTaskOpts contains options for asynchronous tasks.

func (AsyncTaskOpts) ToRequestHeaders added in v0.2.0

func (o AsyncTaskOpts) ToRequestHeaders() map[string]interface{}

ToRequestHeaders converts the options to a map of request headers.

type CachedClientParams

type CachedClientParams = v4.CachedClientParams

type Client

type Client interface {
	Networking() NetworkingClient
	Prism() PrismClient
	Cluster() ClusterClient
}

func GetClient

func GetClient(params CachedClientParams) (Client, error)

type Cluster

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

func (*Cluster) ExtID

func (c *Cluster) ExtID() uuid.UUID

type ClusterClient

type ClusterClient interface {
	GetCluster(cluster string) (*Cluster, error)
}

type GetSubnetOpts

type GetSubnetOpts struct {
	// Cluster is the name of the cluster where the subnet is located. Only required if using the subnet
	// name rather than the extID.
	Cluster string
}

GetSubnetOpts holds optional configuration for getting a subnet.

type IPReservationTypeFunc added in v0.2.0

type IPReservationTypeFunc func(*internalReserveSpec)

IPReservationTypeFunc is a function that configures an IP reservation.

func ReserveIPCountFunc added in v0.3.0

func ReserveIPCountFunc(count int64) IPReservationTypeFunc

ReserveIPCountFunc configures the IP reservation to reserve a specific number of IP addresses.

func ReserveIPListFunc added in v0.3.0

func ReserveIPListFunc(ips ...string) (IPReservationTypeFunc, error)

ReserveIPListFunc configures the IP reservation to reserve a list of specific IP addresses.

func ReserveIPRangeFunc added in v0.3.0

func ReserveIPRangeFunc(ipRange string) (IPReservationTypeFunc, error)

ReserveIPRangeFunc configures the IP reservation to reserve a range of IP addresses. A range out of two IPs separated by a hyphen.

type IPUnreservationTypeFunc added in v0.2.0

type IPUnreservationTypeFunc func(*internalUnreserveSpec)

IPUnreservationTypeFunc is a function that configures an IP unreservation.

func UnreserveIPClientContext added in v0.2.0

func UnreserveIPClientContext(clientContext string) IPUnreservationTypeFunc

UnreserveIPClientContext configures the IP unreservation to unreserve an IP address by client context.

func UnreserveIPListFunc added in v0.3.0

func UnreserveIPListFunc(ips ...string) (IPUnreservationTypeFunc, error)

func UnreserveIPRangeFunc added in v0.3.0

func UnreserveIPRangeFunc(ipRange string) (IPUnreservationTypeFunc, error)

UnreserveIPRangeFunc configures the IP unreservation to unreserve a range of IP addresses. A range out of two IPs separated by a hyphen.

type NetworkingClient

type NetworkingClient interface {
	ReserveIPs(
		reserveType IPReservationTypeFunc,
		subnet string,
		opts ReserveIPOpts,
	) ([]netip.Addr, error)
	UnreserveIPs(unreserveType IPUnreservationTypeFunc, subnet string, opts UnreserveIPOpts) error
	GetSubnet(subnet string, opts GetSubnetOpts) (*Subnet, error)
}

NetworkingClient is the interface for interacting with the networking API.

type PrismClient

type PrismClient interface {
	GetTaskData(taskID string) ([]prismcommonapi.KVPair, error)
}

PrismClient is the interface for interacting with Prism.

type ReserveIPOpts

type ReserveIPOpts struct {
	AsyncTaskOpts

	// Cluster is the name of the cluster where the subnet is located. Only required if using the subnet
	// name rather than the extIDi.
	Cluster string

	// ClientContext is an optional context to associate with the reservation. This can be used to unreserve
	// the IP address later, ensuring that no IPs are leaked.
	ClientContext string
}

ReserveIPOpts holds optional configuration for reserving an IP address.

type Subnet

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

Subnet represents a subnet in the networking API.

func (*Subnet) ExtID

func (s *Subnet) ExtID() uuid.UUID

ExtID returns the external ID of the subnet.

type UnreserveIPOpts

type UnreserveIPOpts struct {
	AsyncTaskOpts

	// Cluster is the name of the cluster where the subnet is located. Only required if using the subnet
	// name rather than the extID.
	Cluster string
}

UnreserveIPOpts holds optional configuration for unreserving an IP address.

Jump to

Keyboard shortcuts

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