object

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatchCheckModeFileHash = 0
	MatchCheckModeFileSize = 1
)

Variables

This section is empty.

Functions

func ChangeLifecycle added in v2.11.0

func ChangeLifecycle(info *ChangeLifecycleApiInfo) (*batch.OperationResult, *data.CodeError)

func ChangeMimeType

func ChangeMimeType(info *ChangeMimeApiInfo) (*batch.OperationResult, *data.CodeError)

func Copy

func Delete

func Exist

func Exist(info ExistApiInfo) (exists bool, err *data.CodeError)

func Move

func Pfop added in v2.16.0

func Pfop(info PfopApiInfo) (string, *data.CodeError)

func SaveAs

func SaveAs(info SaveAsApiInfo) (string, *data.CodeError)

Types

type AsyncFetchApiInfo

type AsyncFetchApiInfo struct {
	Url              string `json:"url"`
	Host             string `json:"host,omitempty"`
	Bucket           string `json:"bucket"`
	Key              string `json:"key,omitempty"`
	Md5              string `json:"md5,omitempty"`
	Etag             string `json:"etag,omitempty"`
	CallbackURL      string `json:"callbackurl,omitempty"`
	CallbackBody     string `json:"callbackbody,omitempty"`
	CallbackBodyType string `json:"callbackbodytype,omitempty"`
	FileType         int    `json:"file_type,omitempty"`
	IgnoreSameKey    bool   `json:"ignore_same_key"` // false: 如果空间中已经存在同名文件则放弃本次抓取(仅对比 Key,不校验文件内容), true: 有同名会抓取
}

type AsyncFetchApiResult

type AsyncFetchApiResult struct {
	Id   string `json:"id"`   // 异步任务Id
	Wait int    `json:"wait"` // 当前任务前面的排队任务数量, 0表示当前任务正在进行, -1表示任务已经至少被处理过一次(可能会进入重试逻辑)
}

func AsyncFetch

func AsyncFetch(info AsyncFetchApiInfo) (result *AsyncFetchApiResult, err *data.CodeError)

func CheckAsyncFetchStatus

func CheckAsyncFetchStatus(toBucket, id string) (ret *AsyncFetchApiResult, err *data.CodeError)

func (*AsyncFetchApiResult) IsValid added in v2.8.0

func (result *AsyncFetchApiResult) IsValid() bool

func (*AsyncFetchApiResult) String

func (result *AsyncFetchApiResult) String() string

type ChangeLifecycleApiInfo added in v2.11.0

type ChangeLifecycleApiInfo struct {
	Bucket                 string `json:"bucket"`
	Key                    string `json:"key"`
	ToIAAfterDays          int    `json:"to_ia_after_days"`           // 转换到 低频存储类型,设置为 -1 表示取消
	ToArchiveIRAfterDays   int    `json:"to_archive_ir_after_days"`   // 转换到 归档直读存储类型, 设置为 -1 表示取消
	ToArchiveAfterDays     int    `json:"to_archive_after_days"`      // 转换到 归档存储类型, 设置为 -1 表示取消
	ToDeepArchiveAfterDays int    `json:"to_deep_archive_after_days"` // 转换到 深度归档存储类型, 设置为 -1 表示取消
	DeleteAfterDays        int    `json:"delete_after_days"`          // 过期删除,删除后不可恢复,设置为 -1 表示取消
}

ChangeLifecycleApiInfo 相关链接:https://developer.qiniu.com/kodo/8062/modify-object-life-cycle

func (*ChangeLifecycleApiInfo) GetBucket added in v2.11.0

func (l *ChangeLifecycleApiInfo) GetBucket() string

func (*ChangeLifecycleApiInfo) ToOperation added in v2.11.0

func (l *ChangeLifecycleApiInfo) ToOperation() (string, *data.CodeError)

func (*ChangeLifecycleApiInfo) WorkId added in v2.11.0

func (l *ChangeLifecycleApiInfo) WorkId() string

type ChangeMimeApiInfo

type ChangeMimeApiInfo struct {
	Bucket string `json:"bucket"`
	Key    string `json:"key"`
	Mime   string `json:"mime"`
}

func (*ChangeMimeApiInfo) GetBucket added in v2.10.0

func (c *ChangeMimeApiInfo) GetBucket() string

func (*ChangeMimeApiInfo) ToOperation

func (c *ChangeMimeApiInfo) ToOperation() (string, *data.CodeError)

func (*ChangeMimeApiInfo) WorkId

func (c *ChangeMimeApiInfo) WorkId() string

type ChangeStatusApiInfo

type ChangeStatusApiInfo struct {
	Bucket string
	Key    string
	Status int
}

ChangeStatusApiInfo 修改 status

func (*ChangeStatusApiInfo) GetBucket added in v2.10.0

func (c *ChangeStatusApiInfo) GetBucket() string

func (*ChangeStatusApiInfo) ToOperation

func (c *ChangeStatusApiInfo) ToOperation() (string, *data.CodeError)

func (*ChangeStatusApiInfo) WorkId

func (c *ChangeStatusApiInfo) WorkId() string

type ChangeTypeApiInfo

type ChangeTypeApiInfo struct {
	Bucket string `json:"bucket"`
	Key    string `json:"key"`
	Type   int    `json:"type"`
}

func (*ChangeTypeApiInfo) GetBucket added in v2.10.0

func (c *ChangeTypeApiInfo) GetBucket() string

func (*ChangeTypeApiInfo) ToOperation

func (c *ChangeTypeApiInfo) ToOperation() (string, *data.CodeError)

func (*ChangeTypeApiInfo) WorkId

func (c *ChangeTypeApiInfo) WorkId() string

type CopyApiInfo

type CopyApiInfo struct {
	SourceBucket string `json:"source_bucket"`
	SourceKey    string `json:"source_key"`
	DestBucket   string `json:"dest_bucket"`
	DestKey      string `json:"dest_key"`
	Force        bool   `json:"force"`
}

func (*CopyApiInfo) GetBucket added in v2.10.0

func (m *CopyApiInfo) GetBucket() string

func (*CopyApiInfo) ToOperation

func (m *CopyApiInfo) ToOperation() (string, *data.CodeError)

func (*CopyApiInfo) WorkId

func (m *CopyApiInfo) WorkId() string

type DeleteApiInfo

type DeleteApiInfo struct {
	Bucket          string                   `json:"bucket"`
	Key             string                   `json:"key"`
	DeleteAfterDays int                      `json:"delete_after_days"`
	IsDeleteAfter   bool                     `json:"-"`
	Condition       batch.OperationCondition `json:"condition"`
}

func (*DeleteApiInfo) GetBucket added in v2.10.0

func (d *DeleteApiInfo) GetBucket() string

func (*DeleteApiInfo) ToOperation

func (d *DeleteApiInfo) ToOperation() (string, *data.CodeError)

func (*DeleteApiInfo) WorkId

func (d *DeleteApiInfo) WorkId() string

type ExistApiInfo

type ExistApiInfo struct {
	Bucket string `json:"bucket"`
	Key    string `json:"key"`
}

type FetchApiInfo

type FetchApiInfo struct {
	Bucket  string `json:"bucket"`
	Key     string `json:"key"`
	FromUrl string `json:"from_url"`
}

func (*FetchApiInfo) WorkId

func (i *FetchApiInfo) WorkId() string

type FetchResult

type FetchResult storage.FetchRet

func Fetch

func Fetch(info FetchApiInfo) (*FetchResult, *data.CodeError)

func (*FetchResult) IsValid added in v2.8.0

func (a *FetchResult) IsValid() bool

type MatchApiInfo added in v2.8.0

type MatchApiInfo struct {
	Bucket         string `json:"bucket"`     // 文件所在七牛云的空间名,【必选】
	Key            string `json:"key"`        // 文件所在七牛云的 Key, 【必选】
	LocalFile      string `json:"local_file"` // 本地文件路径;【必选】
	CheckMode      int    `json:"-"`          // 检测模式, 0: 检测 hash,其他检测 size 【可选】
	ServerFileHash string `json:"file_hash"`  // 服务端文件 Etag,可以是 etagV1, 也可以是 etagV2;【可选】没有会从服务获取
	ServerFileSize int64  `json:"file_size"`  // 服务端文件大小;【可选】没有会从服务获取
}

func (*MatchApiInfo) CheckModeHash added in v2.9.0

func (m *MatchApiInfo) CheckModeHash() bool

func (*MatchApiInfo) WorkId added in v2.8.0

func (m *MatchApiInfo) WorkId() string

type MatchResult added in v2.8.0

type MatchResult struct {
	Exist bool
	Match bool
}

func Match added in v2.8.0

func Match(info MatchApiInfo) (match *MatchResult, err *data.CodeError)

func (*MatchResult) IsValid added in v2.8.0

func (m *MatchResult) IsValid() bool

type MoveApiInfo

type MoveApiInfo struct {
	SourceBucket string `json:"source_bucket"`
	SourceKey    string `json:"source_key"`
	DestBucket   string `json:"dest_bucket"`
	DestKey      string `json:"dest_key"`
	Force        bool   `json:"force"`
}

func (*MoveApiInfo) GetBucket added in v2.10.0

func (m *MoveApiInfo) GetBucket() string

func (*MoveApiInfo) ToOperation

func (m *MoveApiInfo) ToOperation() (string, *data.CodeError)

func (*MoveApiInfo) WorkId

func (m *MoveApiInfo) WorkId() string

type PfopApiInfo added in v2.16.0

type PfopApiInfo struct {
	Bucket             string
	Key                string
	Fops               string
	Pipeline           string
	NotifyURL          string
	Force              bool
	Type               int64
	WorkflowTemplateID string
}

type PreFopStatusApiInfo added in v2.10.0

type PreFopStatusApiInfo struct {
	Id     string
	Bucket string // 用于查询 region,私有云必须,公有云可选
}

type RestoreArchiveApiInfo

type RestoreArchiveApiInfo struct {
	Bucket          string `json:"bucket"`
	Key             string `json:"key"`
	FreezeAfterDays int    `json:"freeze_after_days"`
}

func (*RestoreArchiveApiInfo) GetBucket added in v2.10.0

func (r *RestoreArchiveApiInfo) GetBucket() string

func (*RestoreArchiveApiInfo) ToOperation

func (r *RestoreArchiveApiInfo) ToOperation() (string, *data.CodeError)

func (*RestoreArchiveApiInfo) WorkId

func (r *RestoreArchiveApiInfo) WorkId() string

type SaveAsApiInfo

type SaveAsApiInfo struct {
	PublicUrl  string `json:"public_url"`
	SaveBucket string `json:"save_bucket"`
	SaveKey    string `json:"save_key"`
}

type StatusApiInfo

type StatusApiInfo struct {
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	NeedPart bool   `json:"need_part"`
}

func (StatusApiInfo) GetBucket added in v2.10.0

func (s StatusApiInfo) GetBucket() string

func (StatusApiInfo) ToOperation

func (s StatusApiInfo) ToOperation() (string, *data.CodeError)

func (StatusApiInfo) WorkId

func (s StatusApiInfo) WorkId() string

type StatusResult

type StatusResult struct {
	batch.OperationResult

	// 归档存储文件的解冻状态,uint32 类型,2表示解冻完成,1表示解冻中;归档文件冻结时,不返回该字段。
	RestoreStatus int `json:"restoreStatus"`
	// 文件状态,uint32 类型。1 表示禁用;只有禁用状态的文件才会返回该字段。
	Status int `json:"status"`
	// 文件 md5 值
	MD5 string `json:"md5"`
	// 文件过期删除日期,int64 类型,Unix 时间戳格式
	Expiration int64 `json:"expiration"`
	// 文件生命周期中转为低频存储的日期,int64 类型,Unix 时间戳格式
	TransitionToIA int64 `json:"transitionToIA"`
	// 文件生命周期中转为归档存储的日期,int64 类型,Unix 时间戳格式
	TransitionToARCHIVE int64 `json:"transitionToARCHIVE"`
	// 文件生命周期中转为归档存储的日期,int64 类型,Unix 时间戳格式
	TransitionToArchiveIR int64 `json:"transitionToArchiveIR"`
	// 文件生命周期中转为深度归档存储的日期,int64 类型,Unix 时间戳格式
	TransitionToDeepArchive int64 `json:"transitionToDeepArchive"`
}

func Status

func Status(info StatusApiInfo) (res StatusResult, err *data.CodeError)

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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