bucket

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package bucket is for buckets * * Author: CZ cz.theng@gmail.com

Package bucket is for buckets

Index

Constants

View Source
const (
	//LHangzhou is Hangzhou
	LHangzhou = "oss-cn-hangzhou"
	//LShenzhen is Shenzhen
	LShenzhen = "oss-cn-shenzhen"
	//LBeijing is Beijing
	LBeijing = "oss-cn-beijing"
	//LQingdao is Qingdao
	LQingdao = "oss-cn-qingdao"
	//LShanghai is Shanghai
	LShanghai = "oss-cn-shanghai"
	//LHongKong is HongKong
	LHongKong = "oss-cn-hongkong"
	//LSiliconValley is SiliconValley
	LSiliconValley = "oss-us-west-1"
	// LSingapore is Singapore
	LSingapore = "oss-ap-southeast-1"

	// PPrivate is private
	PPrivate = "private"
	// PPublicReadOnly is public-read
	PPublicReadOnly = "public-read"
	// PPublicRW is public-read-write
	PPublicRW = "public-read-write"
)

Location and Permission

View Source
const (
	LifecycleStatsEnable  = "Enabled"
	LifecycleStatsDisable = "Disabled"
)

const define

Variables

This section is empty.

Functions

func CloseLogging

func CloseLogging(name, location string) (ossapiError *ossapi.Error)

CloseLogging Close bucket's logging @param name: name of bucket @param locaton: location of bucket @return ossapiError: nil on success

func Create

func Create(name, location, permission string) (ossapiError *ossapi.Error)

Create Bucket with name/location and permission location is list above permission now can be three value @param name : name of bucket @param permission : permission of bucket . it is P_XXX @return ossapiError : nil on success

func CreateDefault

func CreateDefault(name string) (ossapiError *ossapi.Error)

CreateDefault Create Bucket with default

func Delete

func Delete(name, location string) (ossapiError *ossapi.Error)

Delete bucket @param name: bucket's name @param location : bucket's location @return : nil on Success else ossapi.Error

func DeleteLifecycle

func DeleteLifecycle(name, location string) (ossapiError *ossapi.Error)

DeleteLifecycle delete Bucket's Lifecycle. All lifecycle rules will be delete @param name : bucket's Name @param location: bucket's Location @return : nil on Success else ossapi.Error

func DeleteLogging

func DeleteLogging(name, location string) (ossapiError *ossapi.Error)

DeleteLogging delete bucket's logging option @param name: bucket's name @param location : bucket's location @return : nil on Success else ossapi.Error

func DeleteWebsite

func DeleteWebsite(name, location string) (ossapiError *ossapi.Error)

DeleteWebsite delete bucket's website infomation @param name: bucket's name @param location : bucket's location @return : nil on Success else ossapi.Error

func OpenLogging

func OpenLogging(name, location, targetBucket, targetPrefix string) (ossapiError *ossapi.Error)

OpenLogging Open bucket's logging @param name: name of bucket @param locaton: location of bucket @param targetBucket: target bucket to store log @param targetPrefix: object's prefix name of logging file @return ossapiError: nil on success

func QueryLocation

func QueryLocation(name string) (location string, ossapiError *ossapi.Error)

QueryLocation Query bucket's location @param name: name of bucket @return location : location name of bucket @return ossapiError : nil on success

func SetACL

func SetACL(name, location, permission string) (error *ossapi.Error)

SetACL Set bucket's ACL info @param name : name of bucket @param permission : permisson to set @return ossapiError : nil on success

func SetLifecycle

func SetLifecycle(name, location string, rules []RuleInfo) (ossapiError *ossapi.Error)

SetLifecycle Set bucket's lifecycle @param name : name of bucket @param location : location of bucket @param rules : rules to set @return ossapiError : nil on success

func SetReferer

func SetReferer(name, location string, enable bool, urls []string) (ossapiError *ossapi.Error)

SetReferer Set Referer of bucket @param name : name of bucket @param location: locaton of bucket @param enable : wheather allow white access @param url: urls list @return ossapiError: nil on success

func SetWebsite

func SetWebsite(name, location, indexPage, errorPage string) (ossapiError *ossapi.Error)

SetWebsite Set bucket's website @param name: name of bucket @param location: location of bucket @param indexPage : index page @param errorPage : 404 error page @return ossapiError : nil on success

Types

type ACLInfo

type ACLInfo struct {
	XMLName           xml.Name `xml:"AccessControlPolicy"`
	Owner             OwnerInfo
	AccessControlList AccessControlListInfo
}

ACLInfo is ACL XML wraper

func QueryACL

func QueryACL(name, location string) (info *ACLInfo, ossapiError *ossapi.Error)

QueryACL Query bucket's ACL @param name: name of bucket @param location: location of bucket @return info: ACL info of bucket @return ossapiError: nil on success

type AccessControlListInfo

type AccessControlListInfo struct {
	Grant string
}

AccessControlListInfo is ACL real value

type BucktsInfo

type BucktsInfo struct {
	XMLName        xml.Name `xml:"ListBucketResult"`
	Name           string   `xml:"Name"`
	Prefix         string   `xml:"Prefix"`
	Marker         string   `xml:"Marker"`
	MaxKeys        int      `xml:"MaxKeys"`
	EncodingType   string   `xml:"encoding-type"`
	IsTruncated    bool     `xml:"IsTruncated"`
	Contents       []ContentInfo
	CommonPrefixes CommonInfo `xml:"CommonPrefixes"`
}

BucktsInfo is bucket's meta struct

func QueryObjects

func QueryObjects(name, location string, prefix, marker, delimiter, encodingType string, maxKeys int) (info *BucktsInfo, ossapiError *ossapi.Error)

QueryObjects Query all objects of a bucket @param name : name of bucket @param location: location of bucket @param prefix: select valied prefix @param marker: marker after this will be return @param delimiter: valied delimiter, common prefix @param encoding: encoding of content @param maxKeys : at most maxKeys items will return @return info : objects' info @return ossapiError : nil on success

type CloseLoggingInfo

type CloseLoggingInfo struct {
	XMLName xml.Name `xml:"BucketLoggingStatus"`
}

CloseLoggingInfo is Close Logginginfo

type CommonInfo

type CommonInfo struct {
	Prefix string
}

CommonInfo is Common meta

type ContentInfo

type ContentInfo struct {
	Key          string
	LastModified string
	ETag         string
	Type         string
	Size         string
	StorageClass string
	Owner        service.Owner
}

ContentInfo is bucket's conetent info

type CreateBucketConfiguration

type CreateBucketConfiguration struct {
	XMLName            xml.Name `xml:"CreateBucketConfiguration"`
	LocationConstraint string   `xml:"LocationConstraint"`
}

CreateBucketConfiguration Requestion's XML Content

type ExpirationDateInfo

type ExpirationDateInfo struct {
	Date string
}

ExpirationDateInfo is the real Date

type ExpirationDaysInfo

type ExpirationDaysInfo struct {
	Days uint
}

ExpirationDaysInfo is the real Days

type IndexInfo

type IndexInfo struct {
	Suffix string
}

IndexInfo is Index info with suffix

type KeyInfo

type KeyInfo struct {
	Key string
}

KeyInfo is real key value

type LifecycleConfiguration

type LifecycleConfiguration struct {
	XMLName xml.Name `xml:"LifecycleConfiguration"`
	Rule    []RuleInfo
}

LifecycleConfiguration is Lifecycle XML info

type LocationInfo

type LocationInfo struct {
	XMLName  xml.Name `xml:"LocationConstraint"`
	Location string   `xml:",chardata"`
}

LocationInfo is locaiton struct

type LoggingInfo

type LoggingInfo struct {
	TargetBucket string
	TargetPrefix string
}

LoggingInfo is Logging info

func QueryLogging

func QueryLogging(name, location string) (info *LoggingInfo, ossapiError *ossapi.Error)

QueryLogging Query bucket's Logging info @param name: name of bucket @param location: location of bucket @return info : Logging info of bucket @return ossapiError : nil on success

type LoggingStatus

type LoggingStatus struct {
	XMLName        xml.Name `xml:"BucketLoggingStatus"`
	LoggingEnabled LoggingInfo
}

LoggingStatus is logging status struct

type OpenLoggingInfo

type OpenLoggingInfo struct {
	XMLName        xml.Name    `xml:"BucketLoggingStatus"`
	LoggingEnabled LoggingInfo `xml:"LoggingEnabled"`
}

OpenLoggingInfo is Open Loggign info

type OwnerInfo

type OwnerInfo struct {
	ID          string
	DisplayName string
}

OwnerInfo is owner info

type RefererConfigurationInfo

type RefererConfigurationInfo struct {
	XMLName           xml.Name        `xml:"RefererConfiguration"`
	AllowEmptyReferer bool            `xml:"AllowEmptyReferer"`
	RefererList       RefererListInfo `xml:"RefererList"`
}

RefererConfigurationInfo is a XML continer

func QueryReferer

func QueryReferer(name, location string) (info *RefererConfigurationInfo, ossapiError *ossapi.Error)

QueryReferer Query Referer info of buckets @param name : name of bucket @param location: location of bucket @return info : referer info of bucket @return ossapiError : nil on success

type RefererListInfo

type RefererListInfo struct {
	Referer []string
}

RefererListInfo is a Referer list

type RuleInfo

type RuleInfo struct {
	ID         string
	Prefix     string
	Status     string
	Expiration ExpirationDaysInfo
}

RuleInfo is Rule info

func QueryLifecycle

func QueryLifecycle(name, location string) (infos []RuleInfo, ossapiError *ossapi.Error)

QueryLifecycle Query bucket's life cycle @param name: name of bucket @param location:location of name @return infos : lifecycle info of buckets @return ossapiError : nil on success

type WebsiteInfo

type WebsiteInfo struct {
	XMLName       xml.Name  `xml:"WebsiteConfiguration"`
	IndexDocument IndexInfo `xml:"IndexDocument"`
	ErrorDocument KeyInfo   `xml:"ErrorDocument"`
}

WebsiteInfo is website info xml wraper

func QueryWebsite

func QueryWebsite(name, location string) (info *WebsiteInfo, ossapiError *ossapi.Error)

QueryWebsite Query bucket's website info @param name: name of bucket @param location : location of bucket @return info : website info of bucket @return ossapiError : nil on success

Jump to

Keyboard shortcuts

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