From ee1ced6d47ac0ea30884af737d3cc11a56f97eda Mon Sep 17 00:00:00 2001 From: Nima Kaviani Date: Tue, 29 Sep 2020 14:30:06 -0700 Subject: [PATCH] feat(storage): add redis and sql to storage options --- api/client/storage/sql.pb.go | 361 +++++++++++++++++++++++++++++++++++ api/proto/storage/sql.proto | 38 ++++ docs/docs.md | 72 +++++++ 3 files changed, 471 insertions(+) create mode 100644 api/client/storage/sql.pb.go create mode 100644 api/proto/storage/sql.proto diff --git a/api/client/storage/sql.pb.go b/api/client/storage/sql.pb.go new file mode 100644 index 00000000..5126cac2 --- /dev/null +++ b/api/client/storage/sql.pb.go @@ -0,0 +1,361 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.13.0 +// source: storage/sql.proto + +package storage + +import ( + proto "github.com/golang/protobuf/proto" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type SQL struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether this persistent store is enabled. + Enabled *wrappers.BoolValue `protobuf:"bytes,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // Default database connection pool. + ConnectionPools *SQL_ConnectionPools `protobuf:"bytes,2,opt,name=connectionPools,proto3" json:"connectionPools,omitempty"` +} + +func (x *SQL) Reset() { + *x = SQL{} + if protoimpl.UnsafeEnabled { + mi := &file_storage_sql_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SQL) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SQL) ProtoMessage() {} + +func (x *SQL) ProtoReflect() protoreflect.Message { + mi := &file_storage_sql_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SQL.ProtoReflect.Descriptor instead. +func (*SQL) Descriptor() ([]byte, []int) { + return file_storage_sql_proto_rawDescGZIP(), []int{0} +} + +func (x *SQL) GetEnabled() *wrappers.BoolValue { + if x != nil { + return x.Enabled + } + return nil +} + +func (x *SQL) GetConnectionPools() *SQL_ConnectionPools { + if x != nil { + return x.ConnectionPools + } + return nil +} + +// The default connection pool +type SQL_ConnectionPools struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Default *SQL_ConnectionPool `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"` +} + +func (x *SQL_ConnectionPools) Reset() { + *x = SQL_ConnectionPools{} + if protoimpl.UnsafeEnabled { + mi := &file_storage_sql_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SQL_ConnectionPools) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SQL_ConnectionPools) ProtoMessage() {} + +func (x *SQL_ConnectionPools) ProtoReflect() protoreflect.Message { + mi := &file_storage_sql_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SQL_ConnectionPools.ProtoReflect.Descriptor instead. +func (*SQL_ConnectionPools) Descriptor() ([]byte, []int) { + return file_storage_sql_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SQL_ConnectionPools) GetDefault() *SQL_ConnectionPool { + if x != nil { + return x.Default + } + return nil +} + +// ConnectionPool confifugration for the SQL server +type SQL_ConnectionPool struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Database username + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // Database password + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + // Database connection string. This needs to include server port + // and database name as well + JdbcUrl string `protobuf:"bytes,3,opt,name=jdbcUrl,proto3" json:"jdbcUrl,omitempty"` + // Database connection timeout in milliseconds + ConnectionTimeout int32 `protobuf:"varint,4,opt,name=connectionTimeout,proto3" json:"connectionTimeout,omitempty"` + // maxLifetime controls the maximum lifetime of a connection in + // the pool in milliseconds. + MaxLifetime int32 `protobuf:"varint,5,opt,name=maxLifetime,proto3" json:"maxLifetime,omitempty"` + // Maximum number of connections stored in the connection pool + MaxPoolSize int32 `protobuf:"varint,6,opt,name=maxPoolSize,proto3" json:"maxPoolSize,omitempty"` +} + +func (x *SQL_ConnectionPool) Reset() { + *x = SQL_ConnectionPool{} + if protoimpl.UnsafeEnabled { + mi := &file_storage_sql_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SQL_ConnectionPool) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SQL_ConnectionPool) ProtoMessage() {} + +func (x *SQL_ConnectionPool) ProtoReflect() protoreflect.Message { + mi := &file_storage_sql_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SQL_ConnectionPool.ProtoReflect.Descriptor instead. +func (*SQL_ConnectionPool) Descriptor() ([]byte, []int) { + return file_storage_sql_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *SQL_ConnectionPool) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *SQL_ConnectionPool) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *SQL_ConnectionPool) GetJdbcUrl() string { + if x != nil { + return x.JdbcUrl + } + return "" +} + +func (x *SQL_ConnectionPool) GetConnectionTimeout() int32 { + if x != nil { + return x.ConnectionTimeout + } + return 0 +} + +func (x *SQL_ConnectionPool) GetMaxLifetime() int32 { + if x != nil { + return x.MaxLifetime + } + return 0 +} + +func (x *SQL_ConnectionPool) GetMaxPoolSize() int32 { + if x != nil { + return x.MaxPoolSize + } + return 0 +} + +var File_storage_sql_proto protoreflect.FileDescriptor + +var file_storage_sql_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2f, 0x73, 0x71, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xa8, 0x03, 0x0a, 0x03, 0x53, 0x51, 0x4c, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, + 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x12, 0x4c, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, + 0x6f, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x51, 0x4c, 0x2e, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x73, 0x52, 0x0f, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x73, 0x1a, 0x4e, + 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, + 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x2e, 0x53, 0x51, 0x4c, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x1a, 0xcc, + 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, + 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6a, 0x64, 0x62, 0x63, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6a, 0x64, 0x62, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x2c, 0x0a, 0x11, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x61, 0x78, + 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, + 0x6d, 0x61, 0x78, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6d, + 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x2f, 0x5a, + 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x70, 0x69, 0x6e, + 0x6e, 0x61, 0x6b, 0x65, 0x72, 0x2f, 0x6b, 0x6c, 0x65, 0x61, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_storage_sql_proto_rawDescOnce sync.Once + file_storage_sql_proto_rawDescData = file_storage_sql_proto_rawDesc +) + +func file_storage_sql_proto_rawDescGZIP() []byte { + file_storage_sql_proto_rawDescOnce.Do(func() { + file_storage_sql_proto_rawDescData = protoimpl.X.CompressGZIP(file_storage_sql_proto_rawDescData) + }) + return file_storage_sql_proto_rawDescData +} + +var file_storage_sql_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_storage_sql_proto_goTypes = []interface{}{ + (*SQL)(nil), // 0: proto.storage.SQL + (*SQL_ConnectionPools)(nil), // 1: proto.storage.SQL.ConnectionPools + (*SQL_ConnectionPool)(nil), // 2: proto.storage.SQL.ConnectionPool + (*wrappers.BoolValue)(nil), // 3: google.protobuf.BoolValue +} +var file_storage_sql_proto_depIdxs = []int32{ + 3, // 0: proto.storage.SQL.enabled:type_name -> google.protobuf.BoolValue + 1, // 1: proto.storage.SQL.connectionPools:type_name -> proto.storage.SQL.ConnectionPools + 2, // 2: proto.storage.SQL.ConnectionPools.default:type_name -> proto.storage.SQL.ConnectionPool + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension 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_storage_sql_proto_init() } +func file_storage_sql_proto_init() { + if File_storage_sql_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_storage_sql_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SQL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_storage_sql_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SQL_ConnectionPools); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_storage_sql_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SQL_ConnectionPool); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_storage_sql_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_storage_sql_proto_goTypes, + DependencyIndexes: file_storage_sql_proto_depIdxs, + MessageInfos: file_storage_sql_proto_msgTypes, + }.Build() + File_storage_sql_proto = out.File + file_storage_sql_proto_rawDesc = nil + file_storage_sql_proto_goTypes = nil + file_storage_sql_proto_depIdxs = nil +} diff --git a/api/proto/storage/sql.proto b/api/proto/storage/sql.proto new file mode 100644 index 00000000..db25dbbf --- /dev/null +++ b/api/proto/storage/sql.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; +package proto.storage; + +option go_package = "github.com/spinnaker/kleat/api/client/storage"; + +import "google/protobuf/wrappers.proto"; + +message SQL { + // Whether this persistent store is enabled. + google.protobuf.BoolValue enabled = 1; + + // Default database connection pool. + ConnectionPools connectionPools = 2; + + // The default connection pool + message ConnectionPools { + ConnectionPool default = 1; + } + + // ConnectionPool confifugration for the SQL server + message ConnectionPool { + // Database username + string user = 1; + // Database password + string password = 2; + // Database connection string. This needs to include server port + // and database name as well + string jdbcUrl = 3; + // Database connection timeout in milliseconds + int32 connectionTimeout = 4; + // maxLifetime controls the maximum lifetime of a connection in + // the pool in milliseconds. + int32 maxLifetime = 5; + // Maximum number of connections stored in the connection pool + int32 maxPoolSize = 6; + } +} + diff --git a/docs/docs.md b/docs/docs.md index c1fbabb3..c323bfdf 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -424,6 +424,11 @@ - [S3ServerSideEncryption](#proto.storage.S3ServerSideEncryption) +- [storage/sql.proto](#storage/sql.proto) + - [SQL](#proto.storage.SQL) + - [SQL.ConnectionPool](#proto.storage.SQL.ConnectionPool) + - [SQL.ConnectionPools](#proto.storage.SQL.ConnectionPools) + - [Scalar Value Types](#scalar-value-types) @@ -6188,6 +6193,73 @@ the 'x-amz-server-side-encryption' header. + +

Top

+ +## storage/sql.proto + + + + + +### SQL + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| enabled | [google.protobuf.BoolValue](#google.protobuf.BoolValue) | | Whether this persistent store is enabled. | +| connectionPools | [SQL.ConnectionPools](#proto.storage.SQL.ConnectionPools) | | Default database connection pool. | + + + + + + + + +### SQL.ConnectionPool +ConnectionPool confifugration for the SQL server + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user | [string](#string) | | Database username | +| password | [string](#string) | | Database password | +| jdbcUrl | [string](#string) | | Database connection string. This needs to include server port and database name as well | +| connectionTimeout | [int32](#int32) | | Database connection timeout in milliseconds | +| maxLifetime | [int32](#int32) | | maxLifetime controls the maximum lifetime of a connection in the pool in milliseconds. | +| maxPoolSize | [int32](#int32) | | Maximum number of connections stored in the connection pool | + + + + + + + + +### SQL.ConnectionPools +The default connection pool + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| default | [SQL.ConnectionPool](#proto.storage.SQL.ConnectionPool) | | | + + + + + + + + + + + + + + + ## Scalar Value Types | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |