Documentation ¶
Index ¶
Constants ¶
const (
// RequestIDHeaderName is the name of the header that carries the request ID.
RequestIDHeaderName = "NTNX-Request-Id"
)
Variables ¶
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 ClusterClient ¶
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.
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.