api

package
v0.2.45 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RequestTimeout = 1200
)

Variables

View Source
var (
	ErrParentPrefixExhausted           = errors.New("parent prefix exhausted")
	ErrParentPrefixNotFound            = errors.New("parent prefix not found")
	ErrWrongMatchingPrefixSubnetFormat = errors.New("wrong matchingPrefix subnet format")
	ErrInvalidIpFamily                 = errors.New("invalid IP Family")
	ErrRestorationHashMismatch         = errors.New("restoration hash mismatch")
)
View Source
var (
	// TODO(henrybear327): centralize errors
	ErrNoPrefixMatchsSizeCriteria = errors.New("no available prefix matches size criteria")
)

Functions

func AssertError

func AssertError(t *testing.T, err error, msg string)

func AssertIpAddress

func AssertIpAddress(t *testing.T, given *netboxModels.WritableIPAddress, actual *netboxModels.IPAddress)

func AssertNil

func AssertNil(t *testing.T, err error)

func SetIpAddressMask

func SetIpAddressMask(ip string, ipFamily int64) (string, error)

func TruncateDescription

func TruncateDescription(description string) string

Types

type CustomFieldEntry

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

type IPFamily

type IPFamily int64
const (
	IPv4Family IPFamily = iota + 4

	IPv6Family
)

type InstrumentedRoundTripper

type InstrumentedRoundTripper struct {
	Transport http.RoundTripper
}

func (*InstrumentedRoundTripper) RoundTrip

func (irt *InstrumentedRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type NetboxClientV3 added in v0.2.38

type NetboxClientV3 struct {
	Ipam    interfaces.IpamInterface
	Tenancy interfaces.TenancyInterface
	Extras  interfaces.ExtrasInterface
	Dcim    interfaces.DcimInterface
}

func GetNetboxClient

func GetNetboxClient() (*NetboxClientV3, error)

type NetboxClientV4 added in v0.2.38

type NetboxClientV4 struct {
	IpamAPI   interfaces.IpamAPI
	StatusAPI interfaces.StatusAPI
	// contains filtered or unexported fields
}

func GetNetboxClientV4 added in v0.2.38

func GetNetboxClientV4() (*NetboxClientV4, error)

type NetboxCompositeClient added in v0.2.38

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

NetboxCompositeClient holds both the v3 and v4 clients, presenting a single unified interface to callers (controllers). The v4 client was introduced because of braking changes in the ip ranges and prefixes endpoints of the NetBox api in newer (4.2+) NetBox versions for requests where the v3 client is still compatible the client was not replaced

func NewNetboxCompositeClient added in v0.2.38

func NewNetboxCompositeClient(clientV3 *NetboxClientV3, clientV4 *NetboxClientV4) *NetboxCompositeClient

NewNetboxCompositeClient creates a new composite client wrapping both v3 and v4 clients.

func (*NetboxCompositeClient) DeleteIpAddress added in v0.2.38

func (c *NetboxCompositeClient) DeleteIpAddress(ipAddressId int64) error

func (*NetboxCompositeClient) DeleteIpRange added in v0.2.38

func (c *NetboxCompositeClient) DeleteIpRange(ctx context.Context, ipRangeId int32) (err error)

func (*NetboxCompositeClient) DeletePrefix added in v0.2.38

func (c *NetboxCompositeClient) DeletePrefix(ctx context.Context, prefixId int32) (err error)

func (*NetboxCompositeClient) GetAvailableIpAddressByClaim added in v0.2.38

func (c *NetboxCompositeClient) GetAvailableIpAddressByClaim(ctx context.Context, ipAddressClaim *models.IPAddressClaim) (*models.IPAddress, error)

GetAvailableIpAddressByClaim searches an available IpAddress in Netbox matching IpAddressClaim requirements

func (*NetboxCompositeClient) GetAvailableIpAddressesByParentPrefix added in v0.2.38

func (c *NetboxCompositeClient) GetAvailableIpAddressesByParentPrefix(parentPrefixId int32) (*ipam.IpamPrefixesAvailableIpsListOK, error)

func (*NetboxCompositeClient) GetAvailableIpRangeByClaim added in v0.2.38

func (c *NetboxCompositeClient) GetAvailableIpRangeByClaim(ctx context.Context, ipRangeClaim *models.IpRangeClaim) (*models.IpRange, error)

GetAvailableIpRangeByClaim searches an available IpRange in Netbox matching IpRangeClaim requirements

func (*NetboxCompositeClient) GetAvailablePrefixByClaim added in v0.2.38

func (c *NetboxCompositeClient) GetAvailablePrefixByClaim(ctx context.Context, prefixClaim *models.PrefixClaim) (*models.Prefix, error)

GetAvailablePrefixByClaim searches an available Prefix in Netbox matching PrefixClaim requirements

func (*NetboxCompositeClient) GetAvailablePrefixesByParentPrefix added in v0.2.38

func (c *NetboxCompositeClient) GetAvailablePrefixesByParentPrefix(parentPrefixId int32) (*ipam.IpamPrefixesAvailablePrefixesListOK, error)

func (*NetboxCompositeClient) GetAvailablePrefixesByParentPrefixSelector added in v0.2.38

func (c *NetboxCompositeClient) GetAvailablePrefixesByParentPrefixSelector(ctx context.Context, prefixClaimSpec *netboxv1.PrefixClaimSpec) ([]*models.Prefix, error)

func (*NetboxCompositeClient) ReserveOrUpdateIpAddress added in v0.2.38

func (c *NetboxCompositeClient) ReserveOrUpdateIpAddress(ipAddress *models.IPAddress) (*netboxModels.IPAddress, error)

func (*NetboxCompositeClient) ReserveOrUpdateIpRange added in v0.2.38

func (c *NetboxCompositeClient) ReserveOrUpdateIpRange(ctx context.Context, ipRange *models.IpRange) (*v4client.IPRange, error)

func (*NetboxCompositeClient) ReserveOrUpdatePrefix added in v0.2.38

func (c *NetboxCompositeClient) ReserveOrUpdatePrefix(ctx context.Context, prefix *models.Prefix) (*v4client.Prefix, error)

ReserveOrUpdatePrefix creates or updates the prefix passed as parameter

func (*NetboxCompositeClient) RestoreExistingIpByHash added in v0.2.38

func (c *NetboxCompositeClient) RestoreExistingIpByHash(hash string) (*models.IPAddress, error)

func (*NetboxCompositeClient) RestoreExistingIpRangeByHash added in v0.2.38

func (c *NetboxCompositeClient) RestoreExistingIpRangeByHash(hash string) (*models.IpRange, error)

func (*NetboxCompositeClient) RestoreExistingPrefixByHash added in v0.2.38

func (c *NetboxCompositeClient) RestoreExistingPrefixByHash(hash string, requestedPrefixLength string) (*models.Prefix, error)

func (*NetboxCompositeClient) VerifyNetboxConfiguration added in v0.2.38

func (c *NetboxCompositeClient) VerifyNetboxConfiguration() error

Checks that the Netbox host is properly configured for the operator to function. Currently only checks that the required custom fields for IP address handling have been added.

type QueryFilter

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

func (*QueryFilter) WriteToRequest

func (o *QueryFilter) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

Jump to

Keyboard shortcuts

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