rabbitmqclient

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoSuchRabbitmqClusterError = errors.New("RabbitmqCluster object does not exist")
	ResourceNotAllowedError    = errors.New("resource is not allowed to reference defined cluster reference. Check the namespace of the resource is allowed as part of the cluster's `rabbitmq.com/topology-allowed-namespaces` annotation")
	NoServiceReferenceSetError = errors.New("RabbitmqCluster has no ServiceReference set in status.defaultUser")
)
View Source
var (
	ReadServiceAccountTokenFunc = ReadServiceAccountToken
	ReadVaultClientSecretFunc   = ReadVaultClientSecret
	LoginToVaultFunc            = LoginToVault
)

Created - and exported from package - for testing purposes

View Source
var (
	SecretClient              SecretStoreClient
	SecretClientCreationError error
)
View Source
var SecretStoreClientProvider = GetSecretStoreClient

Functions

func AllowedNamespace

func AllowedNamespace(rmq topology.RabbitmqClusterReference, requestNamespace string, cluster *rabbitmqv1beta1.RabbitmqCluster) bool

func AllowedNamespaceSecret

func AllowedNamespaceSecret(rmq topology.RabbitmqClusterReference, requestNamespace string, secret *corev1.Secret) bool

func InitializeClient

func InitializeClient() func()

func LoginToVault

func LoginToVault(vaultClient *vault.Client, authPath string, params map[string]interface{}) (*vault.Secret, error)

func ParseReference

func ParseReference(ctx context.Context, c client.Client, rmq topology.RabbitmqClusterReference, requestNamespace string, clusterDomain string, connectUsingHTTP bool) (map[string]string, bool, error)

func ReadServiceAccountToken

func ReadServiceAccountToken() ([]byte, error)

func ReadVaultClientSecret

func ReadVaultClientSecret(vaultClient *vault.Client, jwtToken string, vaultRole string, authPath string) (*vault.Secret, error)

Types

type Client

type Client interface {
	PutUser(string, rabbithole.UserSettings) (*http.Response, error)
	DeleteUser(string) (*http.Response, error)
	DeclareBinding(string, rabbithole.BindingInfo) (*http.Response, error)
	DeleteBinding(string, rabbithole.BindingInfo) (*http.Response, error)
	ListQueueBindingsBetween(string, string, string) ([]rabbithole.BindingInfo, error)
	ListExchangeBindingsBetween(string, string, string) ([]rabbithole.BindingInfo, error)
	UpdatePermissionsIn(string, string, rabbithole.Permissions) (*http.Response, error)
	ClearPermissionsIn(string, string) (*http.Response, error)
	PutPolicy(string, string, rabbithole.Policy) (*http.Response, error)
	DeletePolicy(string, string) (*http.Response, error)
	DeclareQueue(string, string, rabbithole.QueueSettings) (*http.Response, error)
	DeleteQueue(string, string, ...rabbithole.QueueDeleteOptions) (*http.Response, error)
	DeclareExchange(string, string, rabbithole.ExchangeSettings) (*http.Response, error)
	DeleteExchange(string, string) (*http.Response, error)
	PutVhost(string, rabbithole.VhostSettings) (*http.Response, error)
	DeleteVhost(string) (*http.Response, error)
	PutGlobalParameter(name string, value interface{}) (*http.Response, error)
	DeleteGlobalParameter(name string) (*http.Response, error)
	PutFederationUpstream(vhost, name string, def rabbithole.FederationDefinition) (res *http.Response, err error)
	DeleteFederationUpstream(vhost, name string) (res *http.Response, err error)
	DeclareShovel(vhost, shovel string, info rabbithole.ShovelDefinition) (res *http.Response, err error)
	DeleteShovel(vhost, shovel string) (res *http.Response, err error)
	GetVhost(vhost string) (rec *rabbithole.VhostInfo, err error)
	PutOperatorPolicy(string, string, rabbithole.OperatorPolicy) (*http.Response, error)
	DeleteOperatorPolicy(vhost, name string) (res *http.Response, err error)
	UpdateTopicPermissionsIn(vhost, username string, TopicPermissions rabbithole.TopicPermissions) (res *http.Response, err error)
	DeleteTopicPermissionsIn(vhost, username string, exchange string) (res *http.Response, err error)
}

type ClusterCredentials

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

func (ClusterCredentials) Data

func (c ClusterCredentials) Data(key string) ([]byte, bool)

type Factory

type Factory func(connectionCreds map[string]string, tlsEnabled bool, certPool *x509.CertPool) (Client, error)
var RabbitholeClientFactory Factory = func(connectionCreds map[string]string, tlsEnabled bool, certPool *x509.CertPool) (Client, error) {
	return generateRabbitholeClient(connectionCreds, tlsEnabled, certPool)
}

type SecretReader

type SecretReader interface {
	ReadSecret(path string) (*vault.Secret, error)
}

type SecretStoreClient

type SecretStoreClient interface {
	ReadCredentials(path string) (string, string, error)
}

func GetSecretStoreClient

func GetSecretStoreClient() (SecretStoreClient, error)

type VaultClient

type VaultClient struct {
	Reader SecretReader
}

func (VaultClient) ReadCredentials

func (vc VaultClient) ReadCredentials(path string) (string, string, error)

type VaultSecretReader

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

func (VaultSecretReader) ReadSecret

func (s VaultSecretReader) ReadSecret(path string) (*vault.Secret, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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