Merge pull request #869 from Vafilor/feat/add.bucket

feat: Add bucket to config response
This commit is contained in:
Rush Tehrani
2021-02-03 12:02:43 -08:00
committed by GitHub
7 changed files with 412 additions and 56 deletions

View File

@@ -215,6 +215,36 @@
]
}
},
"/apis/v1beta1/{namespace}/config": {
"get": {
"operationId": "GetNamespaceConfig",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GetNamespaceConfigResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/google.rpc.Status"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"ConfigService"
]
}
},
"/apis/v1beta1/{namespace}/cron_workflow": {
"post": {
"operationId": "CreateCronWorkflow",
@@ -3228,6 +3258,14 @@
}
}
},
"GetNamespaceConfigResponse": {
"type": "object",
"properties": {
"bucket": {
"type": "string"
}
}
},
"GetWorkflowExecutionMetricsResponse": {
"type": "object",
"properties": {

View File

@@ -27,6 +27,100 @@ const (
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type GetNamespaceConfigRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
}
func (x *GetNamespaceConfigRequest) Reset() {
*x = GetNamespaceConfigRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_config_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNamespaceConfigRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNamespaceConfigRequest) ProtoMessage() {}
func (x *GetNamespaceConfigRequest) ProtoReflect() protoreflect.Message {
mi := &file_config_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 GetNamespaceConfigRequest.ProtoReflect.Descriptor instead.
func (*GetNamespaceConfigRequest) Descriptor() ([]byte, []int) {
return file_config_proto_rawDescGZIP(), []int{0}
}
func (x *GetNamespaceConfigRequest) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
type GetNamespaceConfigResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
}
func (x *GetNamespaceConfigResponse) Reset() {
*x = GetNamespaceConfigResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_config_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetNamespaceConfigResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetNamespaceConfigResponse) ProtoMessage() {}
func (x *GetNamespaceConfigResponse) ProtoReflect() protoreflect.Message {
mi := &file_config_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 GetNamespaceConfigResponse.ProtoReflect.Descriptor instead.
func (*GetNamespaceConfigResponse) Descriptor() ([]byte, []int) {
return file_config_proto_rawDescGZIP(), []int{1}
}
func (x *GetNamespaceConfigResponse) GetBucket() string {
if x != nil {
return x.Bucket
}
return ""
}
type GetConfigResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -41,7 +135,7 @@ type GetConfigResponse struct {
func (x *GetConfigResponse) Reset() {
*x = GetConfigResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_config_proto_msgTypes[0]
mi := &file_config_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -54,7 +148,7 @@ func (x *GetConfigResponse) String() string {
func (*GetConfigResponse) ProtoMessage() {}
func (x *GetConfigResponse) ProtoReflect() protoreflect.Message {
mi := &file_config_proto_msgTypes[0]
mi := &file_config_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -67,7 +161,7 @@ func (x *GetConfigResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetConfigResponse.ProtoReflect.Descriptor instead.
func (*GetConfigResponse) Descriptor() ([]byte, []int) {
return file_config_proto_rawDescGZIP(), []int{0}
return file_config_proto_rawDescGZIP(), []int{2}
}
func (x *GetConfigResponse) GetApiUrl() string {
@@ -110,7 +204,7 @@ type NodePoolOption struct {
func (x *NodePoolOption) Reset() {
*x = NodePoolOption{}
if protoimpl.UnsafeEnabled {
mi := &file_config_proto_msgTypes[1]
mi := &file_config_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -123,7 +217,7 @@ func (x *NodePoolOption) String() string {
func (*NodePoolOption) ProtoMessage() {}
func (x *NodePoolOption) ProtoReflect() protoreflect.Message {
mi := &file_config_proto_msgTypes[1]
mi := &file_config_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -136,7 +230,7 @@ func (x *NodePoolOption) ProtoReflect() protoreflect.Message {
// Deprecated: Use NodePoolOption.ProtoReflect.Descriptor instead.
func (*NodePoolOption) Descriptor() ([]byte, []int) {
return file_config_proto_rawDescGZIP(), []int{1}
return file_config_proto_rawDescGZIP(), []int{3}
}
func (x *NodePoolOption) GetName() string {
@@ -165,7 +259,7 @@ type NodePool struct {
func (x *NodePool) Reset() {
*x = NodePool{}
if protoimpl.UnsafeEnabled {
mi := &file_config_proto_msgTypes[2]
mi := &file_config_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -178,7 +272,7 @@ func (x *NodePool) String() string {
func (*NodePool) ProtoMessage() {}
func (x *NodePool) ProtoReflect() protoreflect.Message {
mi := &file_config_proto_msgTypes[2]
mi := &file_config_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -191,7 +285,7 @@ func (x *NodePool) ProtoReflect() protoreflect.Message {
// Deprecated: Use NodePool.ProtoReflect.Descriptor instead.
func (*NodePool) Descriptor() ([]byte, []int) {
return file_config_proto_rawDescGZIP(), []int{2}
return file_config_proto_rawDescGZIP(), []int{4}
}
func (x *NodePool) GetLabel() string {
@@ -215,34 +309,49 @@ var file_config_proto_rawDesc = []byte{
0x61, 0x70, 0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82,
0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06,
0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f,
0x6d, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x12, 0x29, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65,
0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x50,
0x6f, 0x6f, 0x6c, 0x22, 0x3a, 0x0a, 0x0e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x4f,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0x4f, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65,
0x6c, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f,
0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x32, 0x6a, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x59, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x24, 0x5a, 0x22,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x65, 0x70, 0x61,
0x6e, 0x65, 0x6c, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67,
0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39,
0x0a, 0x19, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x34, 0x0a, 0x1a, 0x47, 0x65, 0x74,
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x22,
0x82, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x12, 0x16, 0x0a,
0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64,
0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x12, 0x29, 0x0a, 0x08, 0x6e, 0x6f, 0x64,
0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65,
0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x3a, 0x0a, 0x0e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c,
0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x22, 0x4f, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x14, 0x0a, 0x05,
0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62,
0x65, 0x6c, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x50, 0x6f,
0x6f, 0x6c, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x32, 0xeb, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47,
0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x7f,
0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f,
0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,
0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e,
0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70,
0x69, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -257,20 +366,24 @@ func file_config_proto_rawDescGZIP() []byte {
return file_config_proto_rawDescData
}
var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_config_proto_goTypes = []interface{}{
(*GetConfigResponse)(nil), // 0: api.GetConfigResponse
(*NodePoolOption)(nil), // 1: api.NodePoolOption
(*NodePool)(nil), // 2: api.NodePool
(*emptypb.Empty)(nil), // 3: google.protobuf.Empty
(*GetNamespaceConfigRequest)(nil), // 0: api.GetNamespaceConfigRequest
(*GetNamespaceConfigResponse)(nil), // 1: api.GetNamespaceConfigResponse
(*GetConfigResponse)(nil), // 2: api.GetConfigResponse
(*NodePoolOption)(nil), // 3: api.NodePoolOption
(*NodePool)(nil), // 4: api.NodePool
(*emptypb.Empty)(nil), // 5: google.protobuf.Empty
}
var file_config_proto_depIdxs = []int32{
2, // 0: api.GetConfigResponse.nodePool:type_name -> api.NodePool
1, // 1: api.NodePool.options:type_name -> api.NodePoolOption
3, // 2: api.ConfigService.GetConfig:input_type -> google.protobuf.Empty
0, // 3: api.ConfigService.GetConfig:output_type -> api.GetConfigResponse
3, // [3:4] is the sub-list for method output_type
2, // [2:3] is the sub-list for method input_type
4, // 0: api.GetConfigResponse.nodePool:type_name -> api.NodePool
3, // 1: api.NodePool.options:type_name -> api.NodePoolOption
5, // 2: api.ConfigService.GetConfig:input_type -> google.protobuf.Empty
0, // 3: api.ConfigService.GetNamespaceConfig:input_type -> api.GetNamespaceConfigRequest
2, // 4: api.ConfigService.GetConfig:output_type -> api.GetConfigResponse
1, // 5: api.ConfigService.GetNamespaceConfig:output_type -> api.GetNamespaceConfigResponse
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
@@ -283,7 +396,7 @@ func file_config_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetConfigResponse); i {
switch v := v.(*GetNamespaceConfigRequest); i {
case 0:
return &v.state
case 1:
@@ -295,7 +408,7 @@ func file_config_proto_init() {
}
}
file_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodePoolOption); i {
switch v := v.(*GetNamespaceConfigResponse); i {
case 0:
return &v.state
case 1:
@@ -307,6 +420,30 @@ func file_config_proto_init() {
}
}
file_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetConfigResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodePoolOption); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodePool); i {
case 0:
return &v.state
@@ -325,7 +462,7 @@ func file_config_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_config_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -50,6 +50,58 @@ func local_request_ConfigService_GetConfig_0(ctx context.Context, marshaler runt
}
func request_ConfigService_GetNamespaceConfig_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetNamespaceConfigRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
msg, err := client.GetNamespaceConfig(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ConfigService_GetNamespaceConfig_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetNamespaceConfigRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
msg, err := server.GetNamespaceConfig(ctx, &protoReq)
return msg, metadata, err
}
// RegisterConfigServiceHandlerServer registers the http handlers for service ConfigService to "mux".
// UnaryRPC :call ConfigServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -79,6 +131,29 @@ func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeM
})
mux.Handle("GET", pattern_ConfigService_GetNamespaceConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/api.ConfigService/GetNamespaceConfig")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ConfigService_GetNamespaceConfig_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_ConfigService_GetNamespaceConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -140,13 +215,37 @@ func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeM
})
mux.Handle("GET", pattern_ConfigService_GetNamespaceConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/api.ConfigService/GetNamespaceConfig")
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ConfigService_GetNamespaceConfig_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_ConfigService_GetNamespaceConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_ConfigService_GetConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "v1beta1", "config"}, ""))
pattern_ConfigService_GetNamespaceConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "config"}, ""))
)
var (
forward_ConfigService_GetConfig_0 = runtime.ForwardResponseMessage
forward_ConfigService_GetNamespaceConfig_0 = runtime.ForwardResponseMessage
)

View File

@@ -19,6 +19,7 @@ const _ = grpc.SupportPackageIsVersion7
// 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.
type ConfigServiceClient interface {
GetConfig(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetConfigResponse, error)
GetNamespaceConfig(ctx context.Context, in *GetNamespaceConfigRequest, opts ...grpc.CallOption) (*GetNamespaceConfigResponse, error)
}
type configServiceClient struct {
@@ -38,11 +39,21 @@ func (c *configServiceClient) GetConfig(ctx context.Context, in *emptypb.Empty,
return out, nil
}
func (c *configServiceClient) GetNamespaceConfig(ctx context.Context, in *GetNamespaceConfigRequest, opts ...grpc.CallOption) (*GetNamespaceConfigResponse, error) {
out := new(GetNamespaceConfigResponse)
err := c.cc.Invoke(ctx, "/api.ConfigService/GetNamespaceConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ConfigServiceServer is the server API for ConfigService service.
// All implementations must embed UnimplementedConfigServiceServer
// for forward compatibility
type ConfigServiceServer interface {
GetConfig(context.Context, *emptypb.Empty) (*GetConfigResponse, error)
GetNamespaceConfig(context.Context, *GetNamespaceConfigRequest) (*GetNamespaceConfigResponse, error)
mustEmbedUnimplementedConfigServiceServer()
}
@@ -53,6 +64,9 @@ type UnimplementedConfigServiceServer struct {
func (UnimplementedConfigServiceServer) GetConfig(context.Context, *emptypb.Empty) (*GetConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetConfig not implemented")
}
func (UnimplementedConfigServiceServer) GetNamespaceConfig(context.Context, *GetNamespaceConfigRequest) (*GetNamespaceConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetNamespaceConfig not implemented")
}
func (UnimplementedConfigServiceServer) mustEmbedUnimplementedConfigServiceServer() {}
// UnsafeConfigServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -84,6 +98,24 @@ func _ConfigService_GetConfig_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _ConfigService_GetNamespaceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetNamespaceConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ConfigServiceServer).GetNamespaceConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.ConfigService/GetNamespaceConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ConfigServiceServer).GetNamespaceConfig(ctx, req.(*GetNamespaceConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
var _ConfigService_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.ConfigService",
HandlerType: (*ConfigServiceServer)(nil),
@@ -92,6 +124,10 @@ var _ConfigService_serviceDesc = grpc.ServiceDesc{
MethodName: "GetConfig",
Handler: _ConfigService_GetConfig_Handler,
},
{
MethodName: "GetNamespaceConfig",
Handler: _ConfigService_GetNamespaceConfig_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "config.proto",

View File

@@ -12,6 +12,20 @@ service ConfigService {
get: "/apis/v1beta1/config"
};
}
rpc GetNamespaceConfig (GetNamespaceConfigRequest) returns (GetNamespaceConfigResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/config"
};
}
}
message GetNamespaceConfigRequest {
string namespace = 1;
}
message GetNamespaceConfigResponse {
string bucket = 1;
}
message GetConfigResponse {

View File

@@ -86,11 +86,6 @@ message WorkspaceComponent {
string url = 2;
}
message WorkspaceComponent {
string name = 1;
string url = 2;
}
message Workspace {
string uid = 1;
string name = 2;

View File

@@ -2,8 +2,10 @@ package server
import (
"context"
"fmt"
"github.com/golang/protobuf/ptypes/empty"
api "github.com/onepanelio/core/api/gen"
v1 "github.com/onepanelio/core/pkg"
"github.com/onepanelio/core/server/auth"
)
@@ -17,6 +19,23 @@ func NewConfigServer() *ConfigServer {
return &ConfigServer{}
}
func getArtifactRepositoryBucket(client *v1.Client, namespace string) (string, error) {
if namespace == "" {
return "", nil
}
namespaceConfig, err := client.GetNamespaceConfig(namespace)
if err != nil {
return "", err
}
if namespaceConfig.ArtifactRepository.S3 != nil {
return namespaceConfig.ArtifactRepository.S3.Bucket, nil
}
return "", fmt.Errorf("unknown artifact repository")
}
// GetConfig returns the system configuration options
func (c *ConfigServer) GetConfig(ctx context.Context, req *empty.Empty) (*api.GetConfigResponse, error) {
client := getClient(ctx)
@@ -54,3 +73,21 @@ func (c *ConfigServer) GetConfig(ctx context.Context, req *empty.Empty) (*api.Ge
NodePool: nodePool,
}, err
}
// GetNamespaceConfig returns the namespace configuration
func (c *ConfigServer) GetNamespaceConfig(ctx context.Context, req *api.GetNamespaceConfigRequest) (*api.GetNamespaceConfigResponse, error) {
client := getClient(ctx)
allowed, err := auth.IsAuthorized(client, "", "get", "", "namespaces", "")
if err != nil || !allowed {
return nil, err
}
bucket, err := getArtifactRepositoryBucket(client, req.Namespace)
if err != nil {
return nil, err
}
return &api.GetNamespaceConfigResponse{
Bucket: bucket,
}, err
}