v1

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OSS_GetOssStsToken_FullMethodName = "/file.v1.OSS/GetOssStsToken"
	OSS_UploadFile_FullMethodName     = "/file.v1.OSS/UploadFile"
)
View Source
const OperationOSSGetOssStsToken = "/file.v1.OSS/GetOssStsToken"
View Source
const OperationOSSUploadFile = "/file.v1.OSS/UploadFile"

Variables

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "RECORD_NOT_FOUND",
		1: "RECORD_ALREADY_EXISTS",
		2: "BAD_REQUEST",
		3: "SYSTEM_ERROR",
	}
	ErrorReason_value = map[string]int32{
		"RECORD_NOT_FOUND":      0,
		"RECORD_ALREADY_EXISTS": 1,
		"BAD_REQUEST":           2,
		"SYSTEM_ERROR":          3,
	}
)

Enum value maps for ErrorReason.

View Source
var File_oss_v1_error_reason_proto protoreflect.FileDescriptor
View Source
var File_oss_v1_oss_proto protoreflect.FileDescriptor
View Source
var OSS_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "file.v1.OSS",
	HandlerType: (*OSSServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetOssStsToken",
			Handler:    _OSS_GetOssStsToken_Handler,
		},
		{
			MethodName: "UploadFile",
			Handler:    _OSS_UploadFile_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "oss/v1/oss.proto",
}

OSS_ServiceDesc is the grpc.ServiceDesc for OSS service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func ErrorBadRequest

func ErrorBadRequest(format string, args ...interface{}) *errors.Error

func ErrorRecordAlreadyExists

func ErrorRecordAlreadyExists(format string, args ...interface{}) *errors.Error

func ErrorRecordNotFound

func ErrorRecordNotFound(format string, args ...interface{}) *errors.Error

func ErrorSystemError

func ErrorSystemError(format string, args ...interface{}) *errors.Error

func IsBadRequest

func IsBadRequest(err error) bool

func IsRecordAlreadyExists

func IsRecordAlreadyExists(err error) bool

func IsRecordNotFound

func IsRecordNotFound(err error) bool

func IsSystemError

func IsSystemError(err error) bool

func RegisterOSSHTTPServer

func RegisterOSSHTTPServer(s *http.Server, srv OSSHTTPServer)

func RegisterOSSServer

func RegisterOSSServer(s grpc.ServiceRegistrar, srv OSSServer)

Types

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_RECORD_NOT_FOUND      ErrorReason = 0
	ErrorReason_RECORD_ALREADY_EXISTS ErrorReason = 1
	ErrorReason_BAD_REQUEST           ErrorReason = 2
	ErrorReason_SYSTEM_ERROR          ErrorReason = 3
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

func (ErrorReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

type OSSClient

type OSSClient interface {
	// 获取ossToken
	GetOssStsToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*OssStsTokenResponse, error)
	// 文件上传
	UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error)
}

OSSClient is the client API for OSS service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

文件服务

func NewOSSClient

func NewOSSClient(cc grpc.ClientConnInterface) OSSClient

type OSSHTTPClient

type OSSHTTPClient interface {
	GetOssStsToken(ctx context.Context, req *emptypb.Empty, opts ...http.CallOption) (rsp *OssStsTokenResponse, err error)
	UploadFile(ctx context.Context, req *UploadFileRequest, opts ...http.CallOption) (rsp *UploadFileResponse, err error)
}

func NewOSSHTTPClient

func NewOSSHTTPClient(client *http.Client) OSSHTTPClient

type OSSHTTPClientImpl

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

func (*OSSHTTPClientImpl) GetOssStsToken

func (c *OSSHTTPClientImpl) GetOssStsToken(ctx context.Context, in *emptypb.Empty, opts ...http.CallOption) (*OssStsTokenResponse, error)

func (*OSSHTTPClientImpl) UploadFile

type OSSHTTPServer

type OSSHTTPServer interface {
	// GetOssStsToken 获取ossToken
	GetOssStsToken(context.Context, *emptypb.Empty) (*OssStsTokenResponse, error)
	// UploadFile 文件上传
	UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error)
}

type OSSServer

type OSSServer interface {
	// 获取ossToken
	GetOssStsToken(context.Context, *emptypb.Empty) (*OssStsTokenResponse, error)
	// 文件上传
	UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error)
	// contains filtered or unexported methods
}

OSSServer is the server API for OSS service. All implementations must embed UnimplementedOSSServer for forward compatibility.

文件服务

type OssStsTokenResponse

type OssStsTokenResponse struct {

	// access_key
	AccessKey string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"`
	// access_secret
	AccessSecret string `protobuf:"bytes,2,opt,name=access_secret,json=accessSecret,proto3" json:"access_secret,omitempty"`
	// 过期时间
	Expiration string `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"`
	// 安全令牌
	SecurityToken string `protobuf:"bytes,4,opt,name=security_token,json=securityToken,proto3" json:"security_token,omitempty"`
	// 终端
	EndPoint string `protobuf:"bytes,5,opt,name=end_point,json=endPoint,proto3" json:"end_point,omitempty"`
	// 存储桶
	BucketName string `protobuf:"bytes,6,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"`
	// 区域
	Region string `protobuf:"bytes,7,opt,name=region,proto3" json:"region,omitempty"`
	// url
	Url string `protobuf:"bytes,8,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

响应 - OSS前端直传信息

func (*OssStsTokenResponse) Descriptor deprecated

func (*OssStsTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use OssStsTokenResponse.ProtoReflect.Descriptor instead.

func (*OssStsTokenResponse) GetAccessKey

func (x *OssStsTokenResponse) GetAccessKey() string

func (*OssStsTokenResponse) GetAccessSecret

func (x *OssStsTokenResponse) GetAccessSecret() string

func (*OssStsTokenResponse) GetBucketName

func (x *OssStsTokenResponse) GetBucketName() string

func (*OssStsTokenResponse) GetEndPoint

func (x *OssStsTokenResponse) GetEndPoint() string

func (*OssStsTokenResponse) GetExpiration

func (x *OssStsTokenResponse) GetExpiration() string

func (*OssStsTokenResponse) GetRegion

func (x *OssStsTokenResponse) GetRegion() string

func (*OssStsTokenResponse) GetSecurityToken

func (x *OssStsTokenResponse) GetSecurityToken() string

func (*OssStsTokenResponse) GetUrl

func (x *OssStsTokenResponse) GetUrl() string

func (*OssStsTokenResponse) ProtoMessage

func (*OssStsTokenResponse) ProtoMessage()

func (*OssStsTokenResponse) ProtoReflect

func (x *OssStsTokenResponse) ProtoReflect() protoreflect.Message

func (*OssStsTokenResponse) Reset

func (x *OssStsTokenResponse) Reset()

func (*OssStsTokenResponse) String

func (x *OssStsTokenResponse) String() string

type UnimplementedOSSServer

type UnimplementedOSSServer struct{}

UnimplementedOSSServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedOSSServer) GetOssStsToken

func (UnimplementedOSSServer) UploadFile

type UnsafeOSSServer

type UnsafeOSSServer interface {
	// contains filtered or unexported methods
}

UnsafeOSSServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OSSServer will result in compilation errors.

type UploadFileRequest

type UploadFileRequest struct {
	FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
	FileType string `protobuf:"bytes,2,opt,name=file_type,json=fileType,proto3" json:"file_type,omitempty"`
	Content  []byte `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

请求 - 文件上传

func (*UploadFileRequest) Descriptor deprecated

func (*UploadFileRequest) Descriptor() ([]byte, []int)

Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead.

func (*UploadFileRequest) GetContent

func (x *UploadFileRequest) GetContent() []byte

func (*UploadFileRequest) GetFileName

func (x *UploadFileRequest) GetFileName() string

func (*UploadFileRequest) GetFileType

func (x *UploadFileRequest) GetFileType() string

func (*UploadFileRequest) ProtoMessage

func (*UploadFileRequest) ProtoMessage()

func (*UploadFileRequest) ProtoReflect

func (x *UploadFileRequest) ProtoReflect() protoreflect.Message

func (*UploadFileRequest) Reset

func (x *UploadFileRequest) Reset()

func (*UploadFileRequest) String

func (x *UploadFileRequest) String() string

type UploadFileResponse

type UploadFileResponse struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

响应 - 文件上传url

func (*UploadFileResponse) Descriptor deprecated

func (*UploadFileResponse) Descriptor() ([]byte, []int)

Deprecated: Use UploadFileResponse.ProtoReflect.Descriptor instead.

func (*UploadFileResponse) GetUrl

func (x *UploadFileResponse) GetUrl() string

func (*UploadFileResponse) ProtoMessage

func (*UploadFileResponse) ProtoMessage()

func (*UploadFileResponse) ProtoReflect

func (x *UploadFileResponse) ProtoReflect() protoreflect.Message

func (*UploadFileResponse) Reset

func (x *UploadFileResponse) Reset()

func (*UploadFileResponse) String

func (x *UploadFileResponse) String() string

Jump to

Keyboard shortcuts

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