azureblobstorage

package
v0.0.0-...-ecdd364 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 4 Imported by: 0

README

azureblobstorage

Package azureblobstorage is an Ambient plugin that provides storage in Azure Blob Storage.

Import: github.com/ambientkit/plugin/storage/azureblobstorage

Version: 1.0.0

Plugin Type

The plugin can be used as the following core types:

  • Logger: false
  • Storage System: true
  • Router: false
  • Template Engine: false
  • Session Manager: false

Grants

The plugin does not request any grants.

Settings

The plugin does not have any settings.

Routes

The plugin does not have any routes.

Middleware

The plugin does not have any middleware.

FuncMap

The plugin does not have a FuncMap.

Assets

The plugin does not inject any assets.

Embedded Files

The plugin does not have any embedded files.

Example Usage

package main

import (
	"log"

	"github.com/ambientkit/ambient"
	"github.com/ambientkit/ambient/pkg/ambientapp"
	"github.com/ambientkit/plugin/logger/zaplogger"
	"github.com/ambientkit/plugin/storage/azureblobstorage"
)

func main() {
	var (
		// StorageSitePath is the location of the site file.
		StorageSitePath = "storage/site.bin"
		// StorageSessionPath is the location of the session file.
		StorageSessionPath = "storage/session.bin"
	)

	plugins := &ambient.PluginLoader{
		// Core plugins are implicitly trusted.
		Router:         nil,
		TemplateEngine: nil,
		SessionManager: nil,
		// Trusted plugins are those that are typically needed to boot so they
		// will be enabled and given full access.
		TrustedPlugins: map[string]bool{},
		Plugins:        []ambient.Plugin{},
		Middleware:     []ambient.MiddlewarePlugin{
			// Middleware - executes top to bottom.
		},
	}
	_, _, err := ambientapp.NewApp("myapp", "1.0",
		zaplogger.New(),
		ambient.StoragePluginGroup{
			Storage: azureblobstorage.New(StorageSitePath, StorageSessionPath),
		},
		plugins)
	if err != nil {
		log.Fatalln(err.Error())
	}
}

Docgen by Ambient

Documentation

Overview

Package azureblobstorage is an Ambient plugin that provides storage in Azure Blob Storage.

Index

Examples

Constants

View Source
const (
	// ContainerEnv is the Azure Storage container environment variable.
	ContainerEnv = "AMB_AZURE_CONTAINER"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

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

Plugin represents an Ambient plugin.

func New

func New(sitePath string, sessionPath string) *Plugin

New returns an Ambient plugin that provides storage in Azure Blob Storage.

Example
package main

import (
	"log"

	"github.com/ambientkit/ambient"
	"github.com/ambientkit/ambient/pkg/ambientapp"
	"github.com/ambientkit/plugin/logger/zaplogger"
	"github.com/ambientkit/plugin/storage/azureblobstorage"
)

func main() {
	var (
		// StorageSitePath is the location of the site file.
		StorageSitePath = "storage/site.bin"
		// StorageSessionPath is the location of the session file.
		StorageSessionPath = "storage/session.bin"
	)

	plugins := &ambient.PluginLoader{
		// Core plugins are implicitly trusted.
		Router:         nil,
		TemplateEngine: nil,
		SessionManager: nil,
		// Trusted plugins are those that are typically needed to boot so they
		// will be enabled and given full access.
		TrustedPlugins: map[string]bool{},
		Plugins:        []ambient.Plugin{},
		Middleware:     []ambient.MiddlewarePlugin{
			// Middleware - executes top to bottom.
		},
	}
	_, _, err := ambientapp.NewApp("myapp", "1.0",
		zaplogger.New(),
		ambient.StoragePluginGroup{
			Storage: azureblobstorage.New(StorageSitePath, StorageSessionPath),
		},
		plugins)
	if err != nil {
		log.Fatalln(err.Error())
	}
}
Output:

func (*Plugin) PluginName

func (p *Plugin) PluginName() string

PluginName returns the plugin name.

func (*Plugin) PluginVersion

func (p *Plugin) PluginVersion() string

PluginVersion returns the plugin version.

func (*Plugin) Storage

Storage returns data and session storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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