get_objects

package
v7.25.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

列举指定存储空间里的所有对象条目

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonPrefixes

type CommonPrefixes = []string

公共前缀的数组

type ListedObjectEntries

type ListedObjectEntries = Response

本次列举的对象条目信息

type ListedObjectEntry

type ListedObjectEntry struct {
	Key             string            // 对象名称
	PutTime         int64             // 文件上传时间,UNIX 时间戳格式,单位为 100 纳秒
	Hash            string            // 文件的哈希值
	Size            int64             // 对象大小,单位为字节
	MimeType        string            // 对象 MIME 类型
	Type            int64             // 对象存储类型,`0` 表示普通存储,`1` 表示低频存储,`2` 表示归档存储
	EndUser         string            // 资源内容的唯一属主标识
	RestoringStatus int64             // 归档存储文件的解冻状态,`2` 表示解冻完成,`1` 表示解冻中;归档文件冻结时,不返回该字段,仅对 stat 指令才有效
	Status          int64             // 文件的存储状态,即禁用状态和启用状态间的的互相转换,`0` 表示启用,`1`表示禁用
	Md5             string            // 对象 MD5 值,只有通过直传文件和追加文件 API 上传的文件,服务端确保有该字段返回
	Metadata        map[string]string // 对象存储元信息
	Parts           PartSizes         // 每个分片的大小,如没有指定 need_parts 参数则不返回
}

对象条目,包含对象的元信息

func (*ListedObjectEntry) MarshalJSON

func (j *ListedObjectEntry) MarshalJSON() ([]byte, error)

func (*ListedObjectEntry) UnmarshalJSON

func (j *ListedObjectEntry) UnmarshalJSON(data []byte) error

type ListedObjects

type ListedObjects = []ListedObjectEntry

条目的数组,不能用来判断是否还有剩余条目

type PartSizes

type PartSizes = []int64

每个分片的大小

type Request

type Request struct {
	Bucket      string                          // 指定存储空间
	Marker      string                          // 上一次列举返回的位置标记,作为本次列举的起点信息
	Limit       int64                           // 本次列举的条目数,范围为 1-1000
	Prefix      string                          // 指定前缀,只有资源名匹配该前缀的资源会被列出
	Delimiter   string                          // 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)
	NeedParts   bool                            // 如果文件是通过分片上传的,是否返回对应的分片信息
	Credentials credentials.CredentialsProvider // 鉴权参数,用于生成鉴权凭证,如果为空,则使用 HTTPClientOptions 中的 CredentialsProvider
}

调用 API 所用的请求

type Response

type Response struct {
	Marker         string         // 有剩余条目则返回非空字符串,作为下一次列举的参数传入,如果没有剩余条目则返回空字符串
	CommonPrefixes CommonPrefixes // 公共前缀的数组,如没有指定 delimiter 参数则不返回
	Items          ListedObjects  // 条目的数组,不能用来判断是否还有剩余条目
}

获取 API 所用的响应

func (*Response) MarshalJSON

func (j *Response) MarshalJSON() ([]byte, error)

func (*Response) UnmarshalJSON

func (j *Response) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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