synology

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 13 Imported by: 1

README

Synology

Synology backend for QOR OSS

Usage

import "github.com/qor/oss/synology"

func main() {
  storage := synology.New(&synology.Config{
    AccessID:  "access_id",
    AccessKey: "access_key",
    Endpoint:  "your endpoint",
  })

  // Save a reader interface into storage
  storage.Put("/sample.txt", reader)

  // Get file with path
  storage.Get("/sample.txt")

  // Get object as io.ReadCloser
  storage.GetStream("/sample.txt")

  // Delete file with path
  storage.Delete("/sample.txt")

  // List all objects under path
  storage.List("/")

  // Get Public Accessible URL (useful if current file saved privately)
  storage.GetURL("/sample.txt")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config      *Config
	SID         string
	SynoToken   string
	AppAPIList  map[string]map[string]interface{}
	FullAPIList map[string]map[string]interface{}
}

Client Synology NAS storage

func New

func New(config *Config) *Client

func (Client) Delete

func (client Client) Delete(path string) error

Delete delete file

func (Client) Get

func (client Client) Get(path string) (file *os.File, err error)

Get receive file with given path

func (*Client) GetAPIList

func (client *Client) GetAPIList(app string) error

func (Client) GetEndpoint

func (client Client) GetEndpoint() string

GetEndpoint get endpoint, FileSystem's endpoint is /

func (Client) GetStream

func (client Client) GetStream(path string) (io.ReadCloser, error)

GetStream get file as stream

func (Client) GetURL

func (client Client) GetURL(path string) (get_url string, err error)

GetURL get public accessible URL

func (Client) List

func (client Client) List(path string) (objects []*oss.Object, err error)

List list all objects under current path

func (*Client) Login

func (client *Client) Login(application string) error

func (*Client) Put

func (client *Client) Put(urlPath string, reader io.Reader) (r *oss.Object, err error)

type Config

type Config struct {
	Endpoint      string
	AccessID      string
	AccessKey     string
	SessionExpire bool
	Verify        bool
	Debug         bool
	OtpCode       string
	SharedFolder  string
}

Config Synology NAS client config

Jump to

Keyboard shortcuts

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