Documentation
¶
Index ¶
- Constants
- Variables
- func AssertError(t *testing.T, err error, msg string)
- func AssertIpAddress(t *testing.T, given *netboxModels.WritableIPAddress, ...)
- func AssertNil(t *testing.T, err error)
- func SetIpAddressMask(ip string, ipFamily int64) (string, error)
- func TruncateDescription(description string) string
- type CustomFieldEntry
- type IPFamily
- type InstrumentedRoundTripper
- type NetboxClientV3
- type NetboxClientV4
- type NetboxCompositeClient
- func (c *NetboxCompositeClient) DeleteIpAddress(ipAddressId int64) error
- func (c *NetboxCompositeClient) DeleteIpRange(ctx context.Context, ipRangeId int32) (err error)
- func (c *NetboxCompositeClient) DeletePrefix(ctx context.Context, prefixId int32) (err error)
- func (c *NetboxCompositeClient) GetAvailableIpAddressByClaim(ctx context.Context, ipAddressClaim *models.IPAddressClaim) (*models.IPAddress, error)
- func (c *NetboxCompositeClient) GetAvailableIpAddressesByParentPrefix(parentPrefixId int32) (*ipam.IpamPrefixesAvailableIpsListOK, error)
- func (c *NetboxCompositeClient) GetAvailableIpRangeByClaim(ctx context.Context, ipRangeClaim *models.IpRangeClaim) (*models.IpRange, error)
- func (c *NetboxCompositeClient) GetAvailablePrefixByClaim(ctx context.Context, prefixClaim *models.PrefixClaim) (*models.Prefix, error)
- func (c *NetboxCompositeClient) GetAvailablePrefixesByParentPrefix(parentPrefixId int32) (*ipam.IpamPrefixesAvailablePrefixesListOK, error)
- func (c *NetboxCompositeClient) GetAvailablePrefixesByParentPrefixSelector(ctx context.Context, prefixClaimSpec *netboxv1.PrefixClaimSpec) ([]*models.Prefix, error)
- func (c *NetboxCompositeClient) ReserveOrUpdateIpAddress(ipAddress *models.IPAddress) (*netboxModels.IPAddress, error)
- func (c *NetboxCompositeClient) ReserveOrUpdateIpRange(ctx context.Context, ipRange *models.IpRange) (*v4client.IPRange, error)
- func (c *NetboxCompositeClient) ReserveOrUpdatePrefix(ctx context.Context, prefix *models.Prefix) (*v4client.Prefix, error)
- func (c *NetboxCompositeClient) RestoreExistingIpByHash(hash string) (*models.IPAddress, error)
- func (c *NetboxCompositeClient) RestoreExistingIpRangeByHash(hash string) (*models.IpRange, error)
- func (c *NetboxCompositeClient) RestoreExistingPrefixByHash(hash string, requestedPrefixLength string) (*models.Prefix, error)
- func (c *NetboxCompositeClient) VerifyNetboxConfiguration() error
- type QueryFilter
Constants ¶
const (
RequestTimeout = 1200
)
Variables ¶
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") )
var ( // TODO(henrybear327): centralize errors ErrNoPrefixMatchsSizeCriteria = errors.New("no available prefix matches size criteria") )
Functions ¶
func AssertIpAddress ¶
func AssertIpAddress(t *testing.T, given *netboxModels.WritableIPAddress, actual *netboxModels.IPAddress)
func TruncateDescription ¶
Types ¶
type CustomFieldEntry ¶
type CustomFieldEntry struct {
// contains filtered or unexported fields
}
type InstrumentedRoundTripper ¶
type InstrumentedRoundTripper struct {
Transport http.RoundTripper
}
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 (*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 (*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