chore: tweak resource payload

pull/3399/head
Steven 11 months ago
parent 0c251f9ab8
commit b0aad6f694

@ -1850,6 +1850,20 @@ definitions:
expiresAt: expiresAt:
type: string type: string
format: date-time format: date-time
WorkspaceStorageSettingS3Config:
type: object
properties:
accessKeyId:
type: string
accessKeySecret:
type: string
endpoint:
type: string
region:
type: string
bucket:
type: string
title: 'Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiHttpBody: apiHttpBody:
type: object type: object
properties: properties:
@ -2086,22 +2100,8 @@ definitions:
format: int64 format: int64
description: The max upload size in megabytes. description: The max upload size in megabytes.
s3Config: s3Config:
$ref: '#/definitions/apiv1WorkspaceStorageSettingS3Config' $ref: '#/definitions/WorkspaceStorageSettingS3Config'
description: The S3 config. description: The S3 config.
apiv1WorkspaceStorageSettingS3Config:
type: object
properties:
accessKeyId:
type: string
accessKeySecret:
type: string
endpoint:
type: string
region:
type: string
bucket:
type: string
title: 'Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/'
apiv1WorkspaceStorageSettingStorageType: apiv1WorkspaceStorageSettingStorageType:
type: string type: string
enum: enum:

@ -20,7 +20,7 @@ type Client struct {
Bucket *string Bucket *string
} }
func NewClient(ctx context.Context, s3Config *storepb.WorkspaceStorageSetting_S3Config) (*Client, error) { func NewClient(ctx context.Context, s3Config *storepb.StorageS3Config) (*Client, error) {
resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) { resolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) {
return aws.Endpoint{ return aws.Endpoint{
URL: s3Config.Endpoint, URL: s3Config.Endpoint,

@ -145,11 +145,12 @@ type ResourcePayload_S3Object struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
S3Config *StorageS3Config `protobuf:"bytes,1,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
// key is the S3 object key. // key is the S3 object key.
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
// last_presigned_time is the last time the object was presigned. // last_presigned_time is the last time the object was presigned.
// This is used to determine if the presigned URL is still valid. // This is used to determine if the presigned URL is still valid.
LastPresignedTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=last_presigned_time,json=lastPresignedTime,proto3" json:"last_presigned_time,omitempty"` LastPresignedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=last_presigned_time,json=lastPresignedTime,proto3" json:"last_presigned_time,omitempty"`
} }
func (x *ResourcePayload_S3Object) Reset() { func (x *ResourcePayload_S3Object) Reset() {
@ -184,6 +185,13 @@ func (*ResourcePayload_S3Object) Descriptor() ([]byte, []int) {
return file_store_resource_proto_rawDescGZIP(), []int{0, 0} return file_store_resource_proto_rawDescGZIP(), []int{0, 0}
} }
func (x *ResourcePayload_S3Object) GetS3Config() *StorageS3Config {
if x != nil {
return x.S3Config
}
return nil
}
func (x *ResourcePayload_S3Object) GetKey() string { func (x *ResourcePayload_S3Object) GetKey() string {
if x != nil { if x != nil {
return x.Key return x.Key
@ -205,36 +213,41 @@ var file_store_resource_proto_rawDesc = []byte{
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74,
0x6f, 0x72, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcc, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x77, 0x6f, 0x72, 0x6b,
0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x44, 0x0a, 0x09, 0x73, 0x33, 0x5f, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6d, 0x65, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x02, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x44, 0x0a, 0x09, 0x73, 0x33, 0x5f, 0x6f, 0x62,
0x63, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x53, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6d, 0x65, 0x6d,
0x63, 0x74, 0x48, 0x00, 0x52, 0x08, 0x73, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x68, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x0a, 0x08, 0x53, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x53, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x63,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4a, 0x0a, 0x13, 0x74, 0x48, 0x00, 0x52, 0x08, 0x73, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0xa3, 0x01,
0x6c, 0x61, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x0a, 0x08, 0x53, 0x33, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x33,
0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72,
0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x61, 0x67, 0x65, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x33, 0x43,
0x67, 0x6e, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01,
0x6f, 0x61, 0x64, 0x2a, 0x5d, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4a, 0x0a, 0x13, 0x6c, 0x61, 0x73, 0x74, 0x5f,
0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x21, 0x52, 0x45, 0x70, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x00, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x50, 0x72, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x54,
0x53, 0x33, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x69, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x5d,
0x10, 0x03, 0x42, 0x98, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x21, 0x52, 0x45, 0x53, 0x4f, 0x55, 0x52, 0x43,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55,
0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05,
0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x02, 0x12,
0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x10, 0x03, 0x42, 0x98, 0x01,
0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72,
0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x65, 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75,
0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03,
0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72,
0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2,
0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f,
0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -255,16 +268,18 @@ var file_store_resource_proto_goTypes = []interface{}{
(ResourceStorageType)(0), // 0: memos.store.ResourceStorageType (ResourceStorageType)(0), // 0: memos.store.ResourceStorageType
(*ResourcePayload)(nil), // 1: memos.store.ResourcePayload (*ResourcePayload)(nil), // 1: memos.store.ResourcePayload
(*ResourcePayload_S3Object)(nil), // 2: memos.store.ResourcePayload.S3Object (*ResourcePayload_S3Object)(nil), // 2: memos.store.ResourcePayload.S3Object
(*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp (*StorageS3Config)(nil), // 3: memos.store.StorageS3Config
(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
} }
var file_store_resource_proto_depIdxs = []int32{ var file_store_resource_proto_depIdxs = []int32{
2, // 0: memos.store.ResourcePayload.s3_object:type_name -> memos.store.ResourcePayload.S3Object 2, // 0: memos.store.ResourcePayload.s3_object:type_name -> memos.store.ResourcePayload.S3Object
3, // 1: memos.store.ResourcePayload.S3Object.last_presigned_time:type_name -> google.protobuf.Timestamp 3, // 1: memos.store.ResourcePayload.S3Object.s3_config:type_name -> memos.store.StorageS3Config
2, // [2:2] is the sub-list for method output_type 4, // 2: memos.store.ResourcePayload.S3Object.last_presigned_time:type_name -> google.protobuf.Timestamp
2, // [2:2] is the sub-list for method input_type 3, // [3:3] is the sub-list for method output_type
2, // [2:2] is the sub-list for extension type_name 3, // [3:3] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension extendee 3, // [3:3] is the sub-list for extension type_name
0, // [0:2] is the sub-list for field type_name 3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
} }
func init() { file_store_resource_proto_init() } func init() { file_store_resource_proto_init() }
@ -272,6 +287,7 @@ func file_store_resource_proto_init() {
if File_store_resource_proto != nil { if File_store_resource_proto != nil {
return return
} }
file_store_workspace_setting_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_store_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_store_resource_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResourcePayload); i { switch v := v.(*ResourcePayload); i {

@ -483,7 +483,7 @@ type WorkspaceStorageSetting struct {
// The max upload size in megabytes. // The max upload size in megabytes.
UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"` UploadSizeLimitMb int64 `protobuf:"varint,3,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"`
// The S3 config. // The S3 config.
S3Config *WorkspaceStorageSetting_S3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"` S3Config *StorageS3Config `protobuf:"bytes,4,opt,name=s3_config,json=s3Config,proto3" json:"s3_config,omitempty"`
} }
func (x *WorkspaceStorageSetting) Reset() { func (x *WorkspaceStorageSetting) Reset() {
@ -539,28 +539,28 @@ func (x *WorkspaceStorageSetting) GetUploadSizeLimitMb() int64 {
return 0 return 0
} }
func (x *WorkspaceStorageSetting) GetS3Config() *WorkspaceStorageSetting_S3Config { func (x *WorkspaceStorageSetting) GetS3Config() *StorageS3Config {
if x != nil { if x != nil {
return x.S3Config return x.S3Config
} }
return nil return nil
} }
type WorkspaceMemoRelatedSetting struct { // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
type StorageS3Config struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// disallow_public_share disallows set memo as public visible. AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"`
DisallowPublicVisible bool `protobuf:"varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3" json:"disallow_public_visible,omitempty"` AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"`
// display_with_update_time orders and displays memo with update time. Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"` Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
// content_length_limit is the limit of content length. Unit is byte. Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"`
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
} }
func (x *WorkspaceMemoRelatedSetting) Reset() { func (x *StorageS3Config) Reset() {
*x = WorkspaceMemoRelatedSetting{} *x = StorageS3Config{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_store_workspace_setting_proto_msgTypes[5] mi := &file_store_workspace_setting_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -568,13 +568,13 @@ func (x *WorkspaceMemoRelatedSetting) Reset() {
} }
} }
func (x *WorkspaceMemoRelatedSetting) String() string { func (x *StorageS3Config) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*WorkspaceMemoRelatedSetting) ProtoMessage() {} func (*StorageS3Config) ProtoMessage() {}
func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message { func (x *StorageS3Config) ProtoReflect() protoreflect.Message {
mi := &file_store_workspace_setting_proto_msgTypes[5] mi := &file_store_workspace_setting_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -586,47 +586,61 @@ func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead. // Deprecated: Use StorageS3Config.ProtoReflect.Descriptor instead.
func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) { func (*StorageS3Config) Descriptor() ([]byte, []int) {
return file_store_workspace_setting_proto_rawDescGZIP(), []int{5} return file_store_workspace_setting_proto_rawDescGZIP(), []int{5}
} }
func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisible() bool { func (x *StorageS3Config) GetAccessKeyId() string {
if x != nil { if x != nil {
return x.DisallowPublicVisible return x.AccessKeyId
} }
return false return ""
} }
func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool { func (x *StorageS3Config) GetAccessKeySecret() string {
if x != nil { if x != nil {
return x.DisplayWithUpdateTime return x.AccessKeySecret
} }
return false return ""
} }
func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 { func (x *StorageS3Config) GetEndpoint() string {
if x != nil { if x != nil {
return x.ContentLengthLimit return x.Endpoint
} }
return 0 return ""
} }
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ func (x *StorageS3Config) GetRegion() string {
type WorkspaceStorageSetting_S3Config struct { if x != nil {
return x.Region
}
return ""
}
func (x *StorageS3Config) GetBucket() string {
if x != nil {
return x.Bucket
}
return ""
}
type WorkspaceMemoRelatedSetting struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
AccessKeyId string `protobuf:"bytes,1,opt,name=access_key_id,json=accessKeyId,proto3" json:"access_key_id,omitempty"` // disallow_public_share disallows set memo as public visible.
AccessKeySecret string `protobuf:"bytes,2,opt,name=access_key_secret,json=accessKeySecret,proto3" json:"access_key_secret,omitempty"` DisallowPublicVisible bool `protobuf:"varint,1,opt,name=disallow_public_visible,json=disallowPublicVisible,proto3" json:"disallow_public_visible,omitempty"`
Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // display_with_update_time orders and displays memo with update time.
Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` DisplayWithUpdateTime bool `protobuf:"varint,2,opt,name=display_with_update_time,json=displayWithUpdateTime,proto3" json:"display_with_update_time,omitempty"`
Bucket string `protobuf:"bytes,5,opt,name=bucket,proto3" json:"bucket,omitempty"` // content_length_limit is the limit of content length. Unit is byte.
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
} }
func (x *WorkspaceStorageSetting_S3Config) Reset() { func (x *WorkspaceMemoRelatedSetting) Reset() {
*x = WorkspaceStorageSetting_S3Config{} *x = WorkspaceMemoRelatedSetting{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_store_workspace_setting_proto_msgTypes[6] mi := &file_store_workspace_setting_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -634,13 +648,13 @@ func (x *WorkspaceStorageSetting_S3Config) Reset() {
} }
} }
func (x *WorkspaceStorageSetting_S3Config) String() string { func (x *WorkspaceMemoRelatedSetting) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {} func (*WorkspaceMemoRelatedSetting) ProtoMessage() {}
func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message { func (x *WorkspaceMemoRelatedSetting) ProtoReflect() protoreflect.Message {
mi := &file_store_workspace_setting_proto_msgTypes[6] mi := &file_store_workspace_setting_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -652,44 +666,30 @@ func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use WorkspaceStorageSetting_S3Config.ProtoReflect.Descriptor instead. // Deprecated: Use WorkspaceMemoRelatedSetting.ProtoReflect.Descriptor instead.
func (*WorkspaceStorageSetting_S3Config) Descriptor() ([]byte, []int) { func (*WorkspaceMemoRelatedSetting) Descriptor() ([]byte, []int) {
return file_store_workspace_setting_proto_rawDescGZIP(), []int{4, 0} return file_store_workspace_setting_proto_rawDescGZIP(), []int{6}
}
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeyId() string {
if x != nil {
return x.AccessKeyId
}
return ""
}
func (x *WorkspaceStorageSetting_S3Config) GetAccessKeySecret() string {
if x != nil {
return x.AccessKeySecret
}
return ""
} }
func (x *WorkspaceStorageSetting_S3Config) GetEndpoint() string { func (x *WorkspaceMemoRelatedSetting) GetDisallowPublicVisible() bool {
if x != nil { if x != nil {
return x.Endpoint return x.DisallowPublicVisible
} }
return "" return false
} }
func (x *WorkspaceStorageSetting_S3Config) GetRegion() string { func (x *WorkspaceMemoRelatedSetting) GetDisplayWithUpdateTime() bool {
if x != nil { if x != nil {
return x.Region return x.DisplayWithUpdateTime
} }
return "" return false
} }
func (x *WorkspaceStorageSetting_S3Config) GetBucket() string { func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
if x != nil { if x != nil {
return x.Bucket return x.ContentLengthLimit
} }
return "" return 0
} }
var File_store_workspace_setting_proto protoreflect.FileDescriptor var File_store_workspace_setting_proto protoreflect.FileDescriptor
@ -757,7 +757,7 @@ var file_store_workspace_setting_proto_rawDesc = []byte{
0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61,
0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x8f, 0x04, 0x0a, 0x17, 0x0a, 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x22, 0xd5, 0x02, 0x0a, 0x17,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x53, 0x0a, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61,
0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e,
@ -770,57 +770,57 @@ var file_store_workspace_setting_proto_rawDesc = []byte{
0x68, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x75, 0x70, 0x6c, 0x68, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, 0x75, 0x70, 0x6c,
0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x6d,
0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53,
0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x62, 0x12, 0x4a, 0x0a, 0x09, 0x73, 0x33, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x62, 0x12, 0x39, 0x0a, 0x09, 0x73, 0x33,
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e,
0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72,
0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x74, 0x61, 0x67, 0x65, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x33, 0x43,
0x69, 0x6e, 0x67, 0x2e, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x33, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4c, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0xa6, 0x01, 0x0a, 0x08, 0x53, 0x33, 0x43, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f,
0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01,
0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x65, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53,
0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x33, 0x10, 0x03, 0x22, 0xad, 0x01, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53,
0x28, 0x09, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x33, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73,
0x72, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61,
0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74,
0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65,
0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f,
0x4c, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f,
0x0a, 0x18, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62,
0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x4f, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63,
0x43, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x22, 0xc0, 0x01, 0x6b, 0x65, 0x74, 0x22, 0xc0, 0x01, 0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x0a, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74,
0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f,
0x17, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x01,
0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x75,
0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x64,
0x73, 0x69, 0x62, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61,
0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x57, 0x69, 0x74, 0x68, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f,
0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01,
0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x2a, 0x73, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a,
0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x21, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49,
0x50, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12,
0x0a, 0x05, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x45, 0x4e, 0x0b, 0x0a, 0x07, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07,
0x45, 0x52, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x45, 0x4d,
0x45, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x4f, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x54, 0x45, 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f,
0x54, 0x45, 0x44, 0x10, 0x04, 0x42, 0xa0, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42,
0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65,
0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74,
0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f,
0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c,
0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74,
0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06,
0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -845,18 +845,18 @@ var file_store_workspace_setting_proto_goTypes = []interface{}{
(*WorkspaceGeneralSetting)(nil), // 4: memos.store.WorkspaceGeneralSetting (*WorkspaceGeneralSetting)(nil), // 4: memos.store.WorkspaceGeneralSetting
(*WorkspaceCustomProfile)(nil), // 5: memos.store.WorkspaceCustomProfile (*WorkspaceCustomProfile)(nil), // 5: memos.store.WorkspaceCustomProfile
(*WorkspaceStorageSetting)(nil), // 6: memos.store.WorkspaceStorageSetting (*WorkspaceStorageSetting)(nil), // 6: memos.store.WorkspaceStorageSetting
(*WorkspaceMemoRelatedSetting)(nil), // 7: memos.store.WorkspaceMemoRelatedSetting (*StorageS3Config)(nil), // 7: memos.store.StorageS3Config
(*WorkspaceStorageSetting_S3Config)(nil), // 8: memos.store.WorkspaceStorageSetting.S3Config (*WorkspaceMemoRelatedSetting)(nil), // 8: memos.store.WorkspaceMemoRelatedSetting
} }
var file_store_workspace_setting_proto_depIdxs = []int32{ var file_store_workspace_setting_proto_depIdxs = []int32{
0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey 0, // 0: memos.store.WorkspaceSetting.key:type_name -> memos.store.WorkspaceSettingKey
3, // 1: memos.store.WorkspaceSetting.basic_setting:type_name -> memos.store.WorkspaceBasicSetting 3, // 1: memos.store.WorkspaceSetting.basic_setting:type_name -> memos.store.WorkspaceBasicSetting
4, // 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting 4, // 2: memos.store.WorkspaceSetting.general_setting:type_name -> memos.store.WorkspaceGeneralSetting
6, // 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting 6, // 3: memos.store.WorkspaceSetting.storage_setting:type_name -> memos.store.WorkspaceStorageSetting
7, // 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting 8, // 4: memos.store.WorkspaceSetting.memo_related_setting:type_name -> memos.store.WorkspaceMemoRelatedSetting
5, // 5: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile 5, // 5: memos.store.WorkspaceGeneralSetting.custom_profile:type_name -> memos.store.WorkspaceCustomProfile
1, // 6: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType 1, // 6: memos.store.WorkspaceStorageSetting.storage_type:type_name -> memos.store.WorkspaceStorageSetting.StorageType
8, // 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.WorkspaceStorageSetting.S3Config 7, // 7: memos.store.WorkspaceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension type_name
@ -931,7 +931,7 @@ func file_store_workspace_setting_proto_init() {
} }
} }
file_store_workspace_setting_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_store_workspace_setting_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkspaceMemoRelatedSetting); i { switch v := v.(*StorageS3Config); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -943,7 +943,7 @@ func file_store_workspace_setting_proto_init() {
} }
} }
file_store_workspace_setting_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_store_workspace_setting_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkspaceStorageSetting_S3Config); i { switch v := v.(*WorkspaceMemoRelatedSetting); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

@ -3,6 +3,7 @@ syntax = "proto3";
package memos.store; package memos.store;
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "store/workspace_setting.proto";
option go_package = "gen/store"; option go_package = "gen/store";
@ -19,10 +20,11 @@ message ResourcePayload {
} }
message S3Object { message S3Object {
StorageS3Config s3_config = 1;
// key is the S3 object key. // key is the S3 object key.
string key = 1; string key = 2;
// last_presigned_time is the last time the object was presigned. // last_presigned_time is the last time the object was presigned.
// This is used to determine if the presigned URL is still valid. // This is used to determine if the presigned URL is still valid.
google.protobuf.Timestamp last_presigned_time = 2; google.protobuf.Timestamp last_presigned_time = 3;
} }
} }

@ -70,16 +70,17 @@ message WorkspaceStorageSetting {
string filepath_template = 2; string filepath_template = 2;
// The max upload size in megabytes. // The max upload size in megabytes.
int64 upload_size_limit_mb = 3; int64 upload_size_limit_mb = 3;
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ // The S3 config.
message S3Config { StorageS3Config s3_config = 4;
}
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
message StorageS3Config {
string access_key_id = 1; string access_key_id = 1;
string access_key_secret = 2; string access_key_secret = 2;
string endpoint = 3; string endpoint = 3;
string region = 4; string region = 4;
string bucket = 5; string bucket = 5;
}
// The S3 config.
S3Config s3_config = 4;
} }
message WorkspaceMemoRelatedSetting { message WorkspaceMemoRelatedSetting {

@ -93,7 +93,7 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq
ExcludeComments: true, ExcludeComments: true,
} }
if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil { if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter") return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter: %v", err)
} }
var limit, offset int var limit, offset int
@ -151,12 +151,12 @@ func (s *APIV1Service) SearchMemos(ctx context.Context, request *v1pb.SearchMemo
} }
err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter) err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter)
if err != nil { if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter") return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter: %v", err)
} }
memos, err := s.Store.ListMemos(ctx, memoFind) memos, err := s.Store.ListMemos(ctx, memoFind)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to search memos") return nil, status.Errorf(codes.Internal, "failed to search memos: %v", err)
} }
memoMessages := []*v1pb.Memo{} memoMessages := []*v1pb.Memo{}
@ -519,7 +519,7 @@ func (s *APIV1Service) ExportMemos(ctx context.Context, request *v1pb.ExportMemo
ExcludeComments: true, ExcludeComments: true,
} }
if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil { if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil {
return nil, status.Errorf(codes.Internal, "failed to build find memos with filter: %v", err) return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter: %v", err)
} }
memos, err := s.Store.ListMemos(ctx, memoFind) memos, err := s.Store.ListMemos(ctx, memoFind)
@ -610,7 +610,7 @@ func (s *APIV1Service) ListMemoTags(ctx context.Context, request *v1pb.ListMemoT
memoFind.ID = &memoID memoFind.ID = &memoID
} }
if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil { if err := s.buildMemoFindWithFilter(ctx, memoFind, request.Filter); err != nil {
return nil, status.Errorf(codes.Internal, "failed to build find memos with filter: %v", err) return nil, status.Errorf(codes.InvalidArgument, "failed to build find memos with filter: %v", err)
} }
memos, err := s.Store.ListMemos(ctx, memoFind) memos, err := s.Store.ListMemos(ctx, memoFind)

@ -373,6 +373,7 @@ func SaveResourceBlob(ctx context.Context, s *store.Store, create *store.Resourc
create.Payload = &storepb.ResourcePayload{ create.Payload = &storepb.ResourcePayload{
Payload: &storepb.ResourcePayload_S3Object_{ Payload: &storepb.ResourcePayload_S3Object_{
S3Object: &storepb.ResourcePayload_S3Object{ S3Object: &storepb.ResourcePayload_S3Object{
S3Config: s3Config,
Key: key, Key: key,
LastPresignedTime: timestamppb.New(time.Now()), LastPresignedTime: timestamppb.New(time.Now()),
}, },

@ -193,7 +193,7 @@ func convertWorkspaceStorageSettingToStore(setting *v1pb.WorkspaceStorageSetting
UploadSizeLimitMb: setting.UploadSizeLimitMb, UploadSizeLimitMb: setting.UploadSizeLimitMb,
} }
if setting.S3Config != nil { if setting.S3Config != nil {
settingpb.S3Config = &storepb.WorkspaceStorageSetting_S3Config{ settingpb.S3Config = &storepb.StorageS3Config{
AccessKeyId: setting.S3Config.AccessKeyId, AccessKeyId: setting.S3Config.AccessKeyId,
AccessKeySecret: setting.S3Config.AccessKeySecret, AccessKeySecret: setting.S3Config.AccessKeySecret,
Endpoint: setting.S3Config.Endpoint, Endpoint: setting.S3Config.Endpoint,

@ -2,6 +2,7 @@ package s3objectpresigner
import ( import (
"context" "context"
"log/slog"
"time" "time"
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
@ -28,15 +29,6 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
return return
} }
s3Config := workspaceStorageSetting.GetS3Config()
if s3Config == nil {
return
}
s3Client, err := s3.NewClient(ctx, s3Config)
if err != nil {
return
}
s3StorageType := storepb.ResourceStorageType_S3 s3StorageType := storepb.ResourceStorageType_S3
resources, err := p.Store.ListResources(ctx, &store.FindResource{ resources, err := p.Store.ListResources(ctx, &store.FindResource{
GetBlob: false, GetBlob: false,
@ -59,10 +51,27 @@ func (p *S3ObjectPresigner) CheckAndPresign(ctx context.Context) {
continue continue
} }
} }
s3Config := workspaceStorageSetting.GetS3Config()
if s3ObjectPayload.S3Config != nil {
s3Config = s3ObjectPayload.S3Config
}
if s3Config == nil {
slog.Error("S3 config is not found")
continue
}
s3Client, err := s3.NewClient(ctx, s3Config)
if err != nil {
slog.Error("Failed to create S3 client", slog.Any("err", err))
continue
}
presignURL, err := s3Client.PresignGetObject(ctx, s3ObjectPayload.Key) presignURL, err := s3Client.PresignGetObject(ctx, s3ObjectPayload.Key)
if err != nil { if err != nil {
return return
} }
s3ObjectPayload.S3Config = s3Config
s3ObjectPayload.LastPresignedTime = timestamppb.New(time.Now()) s3ObjectPayload.LastPresignedTime = timestamppb.New(time.Now())
if err := p.Store.UpdateResource(ctx, &store.UpdateResource{ if err := p.Store.UpdateResource(ctx, &store.UpdateResource{
Reference: &presignURL, Reference: &presignURL,

@ -129,10 +129,14 @@ func (s *Store) DeleteResource(ctx context.Context, delete *DeleteResource) erro
if err != nil { if err != nil {
return errors.Wrap(err, "failed to get workspace storage setting") return errors.Wrap(err, "failed to get workspace storage setting")
} }
s3Config := workspaceStorageSetting.S3Config s3Config := s3ObjectPayload.S3Config
if s3Config == nil { if s3Config == nil {
return errors.Errorf("No actived external storage found") if workspaceStorageSetting.S3Config == nil {
return errors.Errorf("S3 config is not found")
} }
s3Config = workspaceStorageSetting.S3Config
}
s3Client, err := s3.NewClient(ctx, s3Config) s3Client, err := s3.NewClient(ctx, s3Config)
if err != nil { if err != nil {
return errors.Wrap(err, "Failed to create s3 client") return errors.Wrap(err, "Failed to create s3 client")

Loading…
Cancel
Save