internal

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MPL-2.0 Imports: 22 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")
)
View Source
var (
	ReadServiceAccountTokenFunc = ReadServiceAccountToken
	ReadVaultClientSecretFunc   = ReadVaultClientSecret
	LoginToVaultFunc            = LoginToVault
	FirstLoginAttemptResultCh   = make(chan error, 1)
)

Created - and exported from package - for testing purposes

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

Functions

func AllowedNamespace added in v1.4.0

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

func GenerateBindingInfo

func GenerateBindingInfo(binding *topology.Binding) (*rabbithole.BindingInfo, error)

func GenerateExchangeSettings

func GenerateExchangeSettings(e *topology.Exchange) (*rabbithole.ExchangeSettings, error)

func GenerateFederationDefinition

func GenerateFederationDefinition(f *topology.Federation, uri string) rabbithole.FederationDefinition

func GeneratePermissions

func GeneratePermissions(p *topology.Permission) rabbithole.Permissions

func GeneratePolicy

func GeneratePolicy(p *topology.Policy) (*rabbithole.Policy, error)

func GeneratePropertiesKey

func GeneratePropertiesKey(binding *topology.Binding) string

func GenerateQueueSettings

func GenerateQueueSettings(q *topology.Queue) (*rabbithole.QueueSettings, error)

generates rabbithole.QueueSettings for a given Queue queue.Spec.Arguments (type k8s runtime.RawExtensions) is unmarshalled Unmarshall stores float64, for JSON numbers See: https://golang.org/pkg/encoding/json/#Unmarshal

func GenerateShovelDefinition

func GenerateShovelDefinition(s *topology.Shovel, srcUri, destUri string) rabbithole.ShovelDefinition

func GenerateUserSettings

func GenerateUserSettings(credentials *corev1.Secret, tags []topology.UserTag) (rabbithole.UserSettings, error)

func GenerateVhostSettings

func GenerateVhostSettings(v *topology.Vhost) *rabbithole.VhostSettings

func InitializeClient added in v1.3.0

func InitializeClient() func()

func LoginToVault added in v1.3.0

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

func RandomEncodedString

func RandomEncodedString(dataLen int) (string, error)

func ReadServiceAccountToken added in v1.3.0

func ReadServiceAccountToken() ([]byte, error)

func ReadVaultClientSecret added in v1.3.0

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

Types

type ClusterCredentials added in v1.3.0

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

func (ClusterCredentials) Data added in v1.3.0

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

type ConnectionCredentials added in v1.4.0

type ConnectionCredentials interface {
	Data(key string) ([]byte, bool)
}

func ParseRabbitmqClusterReference added in v0.7.0

func ParseRabbitmqClusterReference(ctx context.Context, c client.Client, rmq topology.RabbitmqClusterReference, requestNamespace string, clusterDomain string) (ConnectionCredentials, bool, error)

type RabbitMQClient added in v0.5.1

type RabbitMQClient 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)
}

type RabbitMQClientFactory added in v0.5.1

type RabbitMQClientFactory func(connectionCreds ConnectionCredentials, tlsEnabled bool, certPool *x509.CertPool) (RabbitMQClient, error)
var RabbitholeClientFactory RabbitMQClientFactory = func(connectionCreds ConnectionCredentials, tlsEnabled bool, certPool *x509.CertPool) (RabbitMQClient, error) {
	return generateRabbitholeClient(connectionCreds, tlsEnabled, certPool)
}

type SecretReader added in v1.3.0

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

type SecretStoreClient added in v1.3.0

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

func GetSecretStoreClient added in v1.3.0

func GetSecretStoreClient() (SecretStoreClient, error)

type UpstreamEndpoints

type UpstreamEndpoints struct {
	Username  string   `json:"username"`
	Password  string   `json:"password"`
	Endpoints []string `json:"endpoints"`
}

func GenerateSchemaReplicationParameters

func GenerateSchemaReplicationParameters(secret *corev1.Secret, endpoints string) (UpstreamEndpoints, error)

type VaultClient added in v1.3.0

type VaultClient struct {
	Reader SecretReader
}

func (VaultClient) ReadCredentials added in v1.3.0

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

type VaultSecretReader added in v1.3.0

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

func (VaultSecretReader) ReadSecret added in v1.3.0

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