filetransfer

package
v0.0.0-...-1ceb281 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BloackSzie = 8 * 1024 * 1024

上传分辨大小 8M

Variables

This section is empty.

Functions

func JsonGet

func JsonGet(ctx context.Context, uri string, header map[string]string, rsp interface{}) (err error)

JsonGet http json get 请求

func JsonPut

func JsonPut(ctx context.Context, uri string, header map[string]string, req, rsp interface{}) (err error)

JsonPut http put 请求

Types

type Client

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

Client ...

func NewFiletransferClientProxy

func NewFiletransferClientProxy(opt client.Option) *Client

NewFiletransferClientProxy ...

func (Client) CompleteMultipartUpload

func (c Client) CompleteMultipartUpload(ctx context.Context, bucket, key, uploadID string) (err error)

CompleteMultipartUpload ...

func (Client) CreateDeleteFileTask

func (c Client) CreateDeleteFileTask(ctx context.Context,
	keys []string, isAsync bool) (failedKeys, failedReadon []string, err error)

CreateDeleteFileTask 删除媒体

func (Client) CreateMultipartUpload

func (c Client) CreateMultipartUpload(ctx context.Context, bucket, key string) (uploadId string, err error)

CreateMultipartUpload 创建分片上传任务

func (Client) DescribeUploadKey

func (c Client) DescribeUploadKey(ctx context.Context, filename string, fileSize uint64) (key string, err error)

DescribeUploadKey 获取上传文件 key

func (Client) ListParts

func (c Client) ListParts(ctx context.Context,
	key, bucket, uploadID string) (response *ListPartsResponse, err error)

ListParts 获取上传分片列表

func (Client) PutObject

func (c Client) PutObject(ctx context.Context, key string, filebuf []byte) (
	r *PutObjectResponse, err error)

PutObject 直接上传

func (Client) UploadBuf

func (c Client) UploadBuf(ctx context.Context, buf []byte, fileName string) (
	key string, err error)

UploadBuf 上传内存文件

func (Client) UploadFile

func (c Client) UploadFile(ctx context.Context, localPath, fileName string) (
	key, uploadId, bucket string, err error)

UploadFile 上传文件

func (Client) UploadPart

func (c Client) UploadPart(ctx context.Context, bucket, key, uploadID string,
	partNumber int, filebuf []byte) (etag string, err error)

UploadPart 上传分片

type CommonResponse

type CommonResponse struct {
	RequestId string `json:"RequestId"`
	Error     *Error `json:"Error"`
}

CommonResponse ...

type CompleteMultipartUploadResponse

type CompleteMultipartUploadResponse struct {
	Response struct {
		CommonResponse
		CompleteMultipartUploadResult struct {
			Location string `json:"Location"`
			Bucket   string `json:"Bucket"`
			Key      string `json:"Key"`
			ETag     string `json:"ETag"`
		} `json:"CompleteMultipartUploadResult"`
	} `json:"Response"`
}

CompleteMultipartUploadResponse ...

type CreateDeleteFileTaskRequest

type CreateDeleteFileTaskRequest struct {
	FileKeys []string `json:"FileKeys"`
	Async    bool     `json:"Async"`
}

CreateDeleteFileTaskRequest ...

func NewCreateDeleteFileTaskRequest

func NewCreateDeleteFileTaskRequest(keys []string, isAsync bool) *CreateDeleteFileTaskRequest

NewCreateDeleteFileTaskRequest ...

type CreateDeleteFileTaskResponse

type CreateDeleteFileTaskResponse struct {
	Response struct {
		CommonResponse
		DeleteFileTask struct {
			TaskId         string `json:"TaskId"`
			Async          bool   `json:"Async"`
			CreateTime     string `json:"CreateTime"`
			FinishTime     string `json:"FinishTime"`
			Total          int    `json:"Total"`
			ProcessedCount int    `json:"ProcessedCount"`
			Status         string `json:"Status"`
			FailedFileKeys []struct {
				Key        string `json:"Key"`
				Reason     string `json:"Reason"`
				FailedTime string `json:"FailedTime"`
			} `json:"FailedFileKeys"`
		} `json:"DeleteFileTask"`
	} `json:"Response"`
}

CreateDeleteFileTaskResponse ...

type CreateMultipartUploadResponse

type CreateMultipartUploadResponse struct {
	Response struct {
		CommonResponse
		InitiateMultipartUploadResult struct {
			UploadId   string `json:"UploadId"`
			Bucket     string `json:"Bucket"`
			Key        string `json:"Key"`
			CreateTime string `json:"CreateTime"`
			UpdateTime string `json:"UpdateTime"`
			ExpireTime string `json:"ExpireTime"`
		} `json:"InitiateMultipartUploadResult"`
	} `json:"Response"`
}

CreateMultipartUploadResponse ...

type DescribeUploadKeyResponse

type DescribeUploadKeyResponse struct {
	Response struct {
		CommonResponse
		Key string `json:"Key"`
	} `json:"Response"`
}

DescribeUploadKeyResponse ...

type Error

type Error struct {
	Code    string `json:"Code"`
	Message string `json:"Message"`
}

Error ...

type ListPartsResponse

type ListPartsResponse struct {
	Response struct {
		CommonResponse
		ListPartsResult struct {
			Bucket               string `json:"Bucket"`
			Key                  string `json:"Key"`
			UploadId             string `json:"UploadId"`
			PartNumberMarker     int32  `json:"PartNumberMarker"`
			NextPartNumberMarker int32  `json:"NextPartNumberMarker"`
			MaxParts             int32  `json:"MaxParts"`
			IsTruncated          bool   `json:"IsTruncated"`
			Part                 []struct {
				PartNumber   int32  `json:"PartNumber"`
				Size         int32  `json:"Size"`
				ETag         string `json:"ETag"`
				LastModified string `json:"LastModified"`
			} `json:"Part"`
		} `json:"ListPartsResult"`
	} `json:"Response"`
}

ListPartsResponse ...

type PutObjectResponse

type PutObjectResponse struct {
	Response struct {
		CommonResponse
		Key  string `json:"Key"`
		ETag string `json:"ETag"`
	} `json:"Response"`
}

PutObjectResponse ...

type UploadPartResponse

type UploadPartResponse struct {
	Response struct {
		CommonResponse
		ETag string `json:"ETag"`
	} `json:"Response"`
}

UploadPartResponse ...

Jump to

Keyboard shortcuts

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