clients

package
v1.22.0 Latest Latest
Warning

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

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

Documentation

Overview

Package clients provides gRPC client implementations for inventory services.

Index

Constants

View Source
const (
	// DefaultInventoryTimeout is the default timeout for inventory operations.
	DefaultInventoryTimeout = 5 * time.Second

	// ListAllDefaultTimeout is the default timeout for list all operations.
	ListAllDefaultTimeout = time.Minute // Longer timeout for reconciling all resources

)

Variables

View Source
var (

	// ListAllInventoryTimeout is the timeout used for list all inventory operations.
	ListAllInventoryTimeout = flag.Duration(
		"timeoutInventoryListAll",
		ListAllDefaultTimeout,
		"Timeout used when listing all resources for a given type from Inventory",
	)
)

Functions

This section is empty.

Types

type NetInventoryClient

type NetInventoryClient struct {
	Client  client.TenantAwareInventoryClient
	Watcher chan *client.WatchEvents
}

NetInventoryClient implements the methods to interact with the inventory gRPC server for the networking manager.

func NewNetInventoryClient

func NewNetInventoryClient(invClient client.TenantAwareInventoryClient, watcher chan *client.WatchEvents) (
	*NetInventoryClient, error,
)

NewNetInventoryClient creates a client that wraps an existing Inventory client. Mainly for testing.

func NewNetInventoryClientWithOptions

func NewNetInventoryClientWithOptions(opts ...Option) (*NetInventoryClient, error)

NewNetInventoryClientWithOptions creates a client by instantiating a new Inventory client. To be used in production.

func (*NetInventoryClient) FindIPAddresses

func (n *NetInventoryClient) FindIPAddresses(ctx context.Context) ([]*client.ResourceTenantIDCarrier, error)

FindIPAddresses finds existing IP addresses in Inventory.

func (*NetInventoryClient) GetIPAddress

func (n *NetInventoryClient) GetIPAddress(ctx context.Context, tenantID, resourceID string) (
	*network_v1.IPAddressResource, error,
)

GetIPAddress retrieves the IP address from Inventory.

func (*NetInventoryClient) GetIPAddressesInSite

func (n *NetInventoryClient) GetIPAddressesInSite(ctx context.Context, tenantID string, ipAddress *network_v1.IPAddressResource,
) ([]*network_v1.IPAddressResource, error)

GetIPAddressesInSite retrieves the IP address from Inventory associated to a given site. Site can be undefined; meaning a query for all addresses not yet onboarded.

func (*NetInventoryClient) Stop

func (n *NetInventoryClient) Stop()

Stop stops the client.

func (*NetInventoryClient) UpdateIPAddressStatusAndState

func (n *NetInventoryClient) UpdateIPAddressStatusAndState(ctx context.Context, tenantID, resourceID string,
	ipAddress *network_v1.IPAddressResource,
) error

UpdateIPAddressStatusAndState updates an existing IPAddress status, status_detail and current state in Inventory.

type Option

type Option func(*Options)

Option is an Inventory client option.

func WithEnableMetrics

func WithEnableMetrics(enableMetrics bool) Option

WithEnableMetrics returns an option to enable or disable metrics collection.

func WithEnableTracing

func WithEnableTracing(enableTracing bool) Option

WithEnableTracing enable tracing.

func WithInventoryAddress

func WithInventoryAddress(invAddr string) Option

WithInventoryAddress sets the Inventory Address.

func WithOptions

func WithOptions(options Options) Option

WithOptions sets the Inventory client options.

type Options

type Options struct {
	InventoryAddress string
	EnableTracing    bool
	EnableMetrics    bool
}

Options is options for init of the Inventory client.

Jump to

Keyboard shortcuts

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