cloud

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cloud provides abstractions and utilities to interact with cloud service providers, allowing easy switching and management of different cloud services based on configuration. This package handles initialization and retrieval of various cloud services like object storage, message queues, and publish-subscribe systems depending on the configured cloud provider.

Index

Constants

View Source
const (
	CloudVendorDefault string = "aws" // Default cloud vendor name
	CloudVendorAws     string = "aws" // cloud vendorn name for AWS
)

Variables

View Source
var (
	AppConfigServiceProvider = getAppConfigService
)

Functions

func GetAppConfigService

func GetAppConfigService() (contract.AppConfigInterface, error)

func GetEmailService

func GetEmailService() (contract.EmailInterface, error)

func GetMessageQueue

func GetMessageQueue() (contract.MessageQueueInterface, error)

GetMessageQueue provides an instance of the MessageQueueInterface based on the configured cloud vendor.

Returns:

  • An implementation of the MessageQueueInterface based on the cloud vendor specified in the configuration.
  • An error if the configured cloud vendor is not supported or if there is an issue initializing the message queue.

func GetObjectStorage

func GetObjectStorage() (contract.ObjectStorageInterface, error)

GetObjectStorage provides an instance of the ObjectStorageInterface based on the configured cloud vendor.

Returns:

  • An implementation of the ObjectStorageInterface based on the cloud vendor specified in the configuration.
  • An error if the configured cloud vendor is not supported or if there is an issue initializing the object storage.

func GetPublishSubscribe

func GetPublishSubscribe() (contract.PublishSubscribeInterface, error)

GetPublishSubscribe returns an instance of the PublishSubscribeInterface based on the configured cloud vendor. It checks for valid configuration and initializes the appropriate publish-subscribe service.

Returns:

  • An implementation of PublishSubscribeInterface if the initialization is successful.
  • An error if the cloud vendor is not supported or other initialization issues occur.

Usage:

  • This function provides access to publish-subscribe services, facilitating communication and notifications in applications.

func GetVisualAnalysisService

func GetVisualAnalysisService() (contract.VisualAnalysisInterface, error)

func IsValidCloudVendor

func IsValidCloudVendor(cloudVendor string) bool

IsValidCloudVendor checks if the given cloudVendor is a valid and supported cloud provider.

Parameters:

  • cloudVendor: The identifier string for the cloud vendor to be checked.

Returns:

  • true if the cloudVendor is valid and supported, false otherwise.

func SetCloudAuthArguments

func SetCloudAuthArguments(args *entity.CloudAuthArguments)

SetCloudAuthArguments sets the global cloud authentication arguments used to initialize cloud services. This function stores the provided CloudAuthArguments into a global variable.

Parameters:

  • args: A pointer to an entity.CloudAuthArguments struct containing authentication data required by cloud services.

Usage:

  • This function should be called prior to initializing any cloud service interfaces to ensure that all services are configured with the correct authentication parameters.

func SetCloudVendor

func SetCloudVendor(vendor string)

SetCloudVendor sets the identifier for the cloud vendor to be used globally across the cloud services. This function assigns the provided vendor string to a global variable.

Parameters:

  • vendor: A string identifier for the cloud vendor (e.g., "AWS", "Azure", "GCP").

Usage:

  • Call this function to define which cloud provider's services should be initialized and used in the application.
  • This is typically set at application startup and used across various cloud service initializations.

Types

type Client

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

func MustNewClient

func MustNewClient(config Config) *Client

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) GetAppConfigService

func (c *Client) GetAppConfigService(ctx context.Context) (contract.AppConfigInterface, error)

func (*Client) GetEmailService

func (c *Client) GetEmailService(ctx context.Context) (contract.EmailInterface, error)

func (*Client) GetMessageQueue

func (c *Client) GetMessageQueue(ctx context.Context) (contract.MessageQueueInterface, error)

func (*Client) GetObjectStorage

func (c *Client) GetObjectStorage(ctx context.Context) (contract.ObjectStorageInterface, error)

func (*Client) GetPublishSubscribe

func (c *Client) GetPublishSubscribe(ctx context.Context) (contract.PublishSubscribeInterface, error)

func (*Client) GetVisualAnalysisService

func (c *Client) GetVisualAnalysisService(ctx context.Context) (contract.VisualAnalysisInterface, error)

type Config

type Config struct {
	Vendor        string
	AuthArguments *entity.CloudAuthArguments
}

Directories

Path Synopsis
PublishSubscribeInterface is a common interface that has to be implemented by all cloud vendor specific implementions (ie AWS, Azure, GCP).
PublishSubscribeInterface is a common interface that has to be implemented by all cloud vendor specific implementions (ie AWS, Azure, GCP).
messagequeue
Package messagequeue provides structures and tools for interacting with a message queue system.
Package messagequeue provides structures and tools for interacting with a message queue system.
objectstorage
Package objectstorage provides structures for interacting with an S3-compatible storage system.
Package objectstorage provides structures for interacting with an S3-compatible storage system.
pubsub
Package pubsub provides structures for publishing messages to topics and managing topic attributes in a messaging system.
Package pubsub provides structures for publishing messages to topics and managing topic attributes in a messaging system.
visualanalysis
Package visualanalysis provides cloud-agnostic inputs for image analysis.
Package visualanalysis provides cloud-agnostic inputs for image analysis.
Package providers contains functionality for managing and interfacing with various AWS services.
Package providers contains functionality for managing and interfacing with various AWS services.
service
aws

Jump to

Keyboard shortcuts

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