bindings

package
v0.0.0-...-e59b3ac Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMessage

func GetMessage(ctx context.Context, count int, queueName string, client *azservicebus.Client) ([]string, error)

// GetMessage creates a new receiver for a given queue, receives messages from the queue, logs the messages and returns them as a slice of strings. It returns an error if any of the operations fail.

func SendMessage

func SendMessage(ctx context.Context, message string, queueName string, client *azservicebus.Client) error

SendMessage creates a new sender, sends a message and returns an error if any of the operations fail.

Types

type BindingProvider

type BindingProvider func(map[string]string) BindingStatus

type BindingStatus

type BindingStatus struct {
	Ok      bool
	Message string
}

func DaprHttpBinding

func DaprHttpBinding(envParams map[string]string) BindingStatus

DaprHttpBinding checks if the environment parameter "APPID" is present and if so, creates a Dapr client and invokes a method on it, returning a BindingStatus object with a boolean and a message. If an error occurs, the BindingStatus object will contain false and an error message.

requires both the value to be set as env variables - CONNECTION_DAPRHTTP_APPID - DAPR_GRPC_PORT

func DaprPubSubBinding

func DaprPubSubBinding(envParams map[string]string) BindingStatus

DaprPubSubBinding checks if the environment parameter COMPONENTNAME is set and if so, creates a Dapr client and publishes an event to a topic.

Use this with a values like: - CONNECTION_DAPRPUBSUB_COMPONENTNAME - DAPR_GRPC_PORT

func DaprSecretStoreBinding

func DaprSecretStoreBinding(envParams map[string]string) BindingStatus

DaprSecretStoreBinding checks if the required environment parameters are present and if so, creates a Dapr client and attempts to get the secret from the Dapr secret store.

func DaprStateStoreBinding

func DaprStateStoreBinding(envParams map[string]string) BindingStatus

DaprStateStoreBinding checks if the environment parameter COMPONENTNAME is set and if so, creates a Dapr client, saves a value to the state store and returns a BindingStatus indicating success or failure.

func KeyVaultBinding

func KeyVaultBinding(envParams map[string]string) BindingStatus

KeyVaultBinding attempts to connect to a Key Vault client, create a secret, and get the secret, returning a BindingStatus indicating success or failure.

func MicrosoftSqlBinding

func MicrosoftSqlBinding(envParams map[string]string) BindingStatus

MicrosoftSqlBinding checks if the connection string is provided, creates a connection to the mssql database, pings the database and checks if the database can be accessed. If any of these steps fail, an error is returned.

func MongoBinding

func MongoBinding(envParams map[string]string) BindingStatus

MongoBinding checks if the CONNECTIONSTRING environment parameter is present and if so, attempts to connect to a MongoDB

instance using the provided URI, returning a BindingStatus indicating success or failure.

func RabbitMQBinding

func RabbitMQBinding(envParams map[string]string) BindingStatus

RabbitMQBinding checks the environment parameters for a connection string and queue name, connects to RabbitMQ, declares a queue, publishes a message and returns a BindingStatus indicating success or failure.

func RedisBinding

func RedisBinding(envParams map[string]string) BindingStatus

RedisBinding checks if a connection can be established with a Redis instance using the provided environment parameters and returns a BindingStatus indicating if the connection was successful.

func ServiceBusBinding

func ServiceBusBinding(envParams map[string]string) BindingStatus

ServiceBusBinding checks if the environment variables are set, creates a service bus connection, sends and receives a message and returns a BindingStatus.

func StorageBinding

func StorageBinding(envParams map[string]string) BindingStatus

StorageBinding checks for required environment variables, creates a credential and a client, creates a container and marks it for deletion.

requires the following environment variables: - CONNECTION_STORAGE_ACCOUNT

type Providers

type Providers struct {
	BindingProviders BindingProvider
	EnvVars          map[string]string
}

func LoadBindings

func LoadBindings(registeredProviders map[string]BindingProvider) []Providers

LoadBindings parses environment variables and creates a slice of Providers based on the registered BindingProviders.

Jump to

Keyboard shortcuts

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