utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_FILTER_NOP = iota
	OP_FILTER_USED
	OP_FILTER_UNUSED
)

Variables

This section is empty.

Functions

func AddTargetToTargetPool

func AddTargetToTargetPool(targetPool *loadbalancer.TargetPool, target *loadbalancer.Target) error

func FilterCredentials added in v0.6.0

func FilterCredentials(ctx context.Context, client LoadBalancerClient, allCredentials []loadbalancer.CredentialsResponse, projectId string, filterOp int) ([]loadbalancer.CredentialsResponse, error)

FilterCredentials filters a list of credentials based on the used and unused flags. If used is true, it returns only the credentials that are used by load balancers for observability metrics or logs. If unused is true, it returns only the credentials that are not used by any load balancer for observability metrics or logs. If both used and unused are true, it returns an error. If both used and unused are false, it returns the original list of credentials.

func FindLoadBalancerListenerByTargetPool

func FindLoadBalancerListenerByTargetPool(listeners []loadbalancer.Listener, targetPoolName string) *loadbalancer.Listener

func FindLoadBalancerTargetPoolByName

func FindLoadBalancerTargetPoolByName(targetPools []loadbalancer.TargetPool, targetPoolName string) *loadbalancer.TargetPool

func GetCredentialsDisplayName

func GetCredentialsDisplayName(ctx context.Context, apiClient LoadBalancerClient, projectId, credentialsRef string) (string, error)

func GetLoadBalancerTargetPool

func GetLoadBalancerTargetPool(ctx context.Context, apiClient LoadBalancerClient, projectId, loadBalancerName, targetPoolName string) (*loadbalancer.TargetPool, error)

func GetTargetName

func GetTargetName(ctx context.Context, apiClient LoadBalancerClient, projectId, loadBalancerName, targetPoolName, targetIp string) (string, error)

func GetUnusedObsCredentials added in v0.6.0

func GetUnusedObsCredentials(usedCredentials, allCredentials []loadbalancer.CredentialsResponse) []loadbalancer.CredentialsResponse

GetUnusedObsCredentials returns a list of credentials that are not used by any load balancer for observability metrics or logs. It compares the list of all credentials with the list of used credentials and returns a list of credentials that are not used.

func GetUsedObsCredentials added in v0.6.0

func GetUsedObsCredentials(ctx context.Context, apiClient LoadBalancerClient, allCredentials []loadbalancer.CredentialsResponse, projectId string) ([]loadbalancer.CredentialsResponse, error)

GetUsedObsCredentials returns a list of credentials that are used by load balancers for observability metrics or logs. It goes through all load balancers and checks what observability credentials are being used, then returns a list of those credentials.

func RemoveTargetFromTargetPool

func RemoveTargetFromTargetPool(targetPool *loadbalancer.TargetPool, ip string) error

Types

type LoadBalancerClient

type LoadBalancerClient interface {
	GetCredentialsExecute(ctx context.Context, projectId, credentialsRef string) (*loadbalancer.GetCredentialsResponse, error)
	GetLoadBalancerExecute(ctx context.Context, projectId, name string) (*loadbalancer.LoadBalancer, error)
	UpdateTargetPool(ctx context.Context, projectId, loadBalancerName, targetPoolName string) loadbalancer.ApiUpdateTargetPoolRequest
	ListLoadBalancersExecute(ctx context.Context, projectId string) (*loadbalancer.ListLoadBalancersResponse, error)
}

Jump to

Keyboard shortcuts

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