diff --git a/api/appvendor.proto b/api/appvendor.proto index c72efbf76..56b3b4d8c 100644 --- a/api/appvendor.proto +++ b/api/appvendor.proto @@ -50,8 +50,9 @@ message VendorVerifyInfo { google.protobuf.StringValue bank_account_number = 10; google.protobuf.StringValue status = 11; google.protobuf.StringValue reject_message = 12; - google.protobuf.Timestamp submit_time = 13; - google.protobuf.Timestamp status_time = 14; + google.protobuf.StringValue approver = 13; + google.protobuf.Timestamp submit_time = 14; + google.protobuf.Timestamp status_time = 15; } message SubmitVendorVerifyInfoRequest { @@ -90,6 +91,20 @@ message RejectVendorVerifyInfoResponse { google.protobuf.StringValue user_id = 1; } +message VendorStatistics { + google.protobuf.StringValue user_id = 1; + google.protobuf.StringValue company_name = 2; + google.protobuf.Int32Value active_app_count = 3; + google.protobuf.Int32Value cluster_count_month = 4; + google.protobuf.Int32Value cluster_count_total = 5; +} + + +message DescribeVendorStatisticsResponse { + uint32 total_count = 1; + repeated VendorStatistics vendor_verify_statistics_set = 2; +} + service AppVendorManager { rpc SubmitVendorVerifyInfo (SubmitVendorVerifyInfoRequest) returns (SubmitVendorVerifyInfoResponse) { @@ -110,6 +125,16 @@ service AppVendorManager { get: "/v1/vendor_verify_infos" }; } + + rpc DescribeAppVendorStatistics (DescribeVendorVerifyInfosRequest) returns (DescribeVendorStatisticsResponse) { + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + summary: "DescribeAppVendorStatistics" + }; + option (google.api.http) = { + get: "/v1/DescribeAppVendorStatistics" + }; + } + rpc GetVendorVerifyInfo (GetVendorVerifyInfoRequest) returns (VendorVerifyInfo) { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { summary: "GetVendorVerifyInfo" @@ -120,6 +145,8 @@ service AppVendorManager { } + + rpc PassVendorVerifyInfo (PassVendorVerifyInfoRequest) returns (PassVendorVerifyInfoResponse) { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { summary: "PassVendorVerifyInfo" @@ -140,5 +167,4 @@ service AppVendorManager { }; } - } \ No newline at end of file diff --git a/cmd/opctl/all_cmd.go b/cmd/opctl/all_cmd.go index db8d64bcb..38948441b 100644 --- a/cmd/opctl/all_cmd.go +++ b/cmd/opctl/all_cmd.go @@ -67,6 +67,7 @@ var AllCmd = []Cmd{ NewSuspendAppVersionCmd(), NewUploadAppAttachmentCmd(), NewValidatePackageCmd(), + NewDescribeAppVendorStatisticsCmd(), NewDescribeVendorVerifyInfosCmd(), NewGetVendorVerifyInfoCmd(), NewPassVendorVerifyInfoCmd(), @@ -1714,6 +1715,52 @@ func (c *ValidatePackageCmd) Run(out Out) error { return nil } +type DescribeAppVendorStatisticsCmd struct { + *app_vendor_manager.DescribeAppVendorStatisticsParams +} + +func NewDescribeAppVendorStatisticsCmd() Cmd { + return &DescribeAppVendorStatisticsCmd{ + app_vendor_manager.NewDescribeAppVendorStatisticsParams(), + } +} + +func (*DescribeAppVendorStatisticsCmd) GetActionName() string { + return "DescribeAppVendorStatistics" +} + +func (c *DescribeAppVendorStatisticsCmd) ParseFlag(f Flag) { + f.StringSliceVarP(&c.DisplayColumns, "display_columns", "", []string{}, "") + c.Limit = new(int64) + f.Int64VarP(c.Limit, "limit", "", 20, "default is 20, max value is 200.") + c.Offset = new(int64) + f.Int64VarP(c.Offset, "offset", "", 0, "default is 0.") + c.Reverse = new(bool) + f.BoolVarP(c.Reverse, "reverse", "", false, "") + c.SearchWord = new(string) + f.StringVarP(c.SearchWord, "search_word", "", "", "") + c.SortKey = new(string) + f.StringVarP(c.SortKey, "sort_key", "", "", "") + f.StringSliceVarP(&c.Status, "status", "", []string{}, "") + f.StringSliceVarP(&c.UserID, "user_id", "", []string{}, "") +} + +func (c *DescribeAppVendorStatisticsCmd) Run(out Out) error { + params := c.DescribeAppVendorStatisticsParams + + out.WriteRequest(params) + + client := getClient() + res, err := client.AppVendorManager.DescribeAppVendorStatistics(params, nil) + if err != nil { + return err + } + + out.WriteResponse(res.Payload) + + return nil +} + type DescribeVendorVerifyInfosCmd struct { *app_vendor_manager.DescribeVendorVerifyInfosParams } diff --git a/cmd/opctl/config.yaml b/cmd/opctl/config.yaml index 5ecaea301..99ed09bb9 100644 --- a/cmd/opctl/config.yaml +++ b/cmd/opctl/config.yaml @@ -549,6 +549,29 @@ version_type: help: 'optional: vmbased/helm' type: string +- action: DescribeAppVendorStatistics + request: DescribeAppVendorStatisticsRequest + description: DescribeAppVendorStatistics + service: AppVendorManager + query: + display_columns: + type: '[]string' + limit: + help: default is 20, max value is 200. + type: int64 + offset: + help: default is 0. + type: int64 + reverse: + type: boolean + search_word: + type: string + sort_key: + type: string + status: + type: '[]string' + user_id: + type: '[]string' - action: DescribeVendorVerifyInfos request: DescribeVendorVerifyInfosRequest description: DescribeVendorVerifyInfos diff --git a/pkg/apigateway/spec/api.swagger.json b/pkg/apigateway/spec/api.swagger.json index 69689b687..f3a63bfcb 100644 --- a/pkg/apigateway/spec/api.swagger.json +++ b/pkg/apigateway/spec/api.swagger.json @@ -1320,6 +1320,90 @@ ] } }, + "/v1/DescribeAppVendorStatistics": { + "get": { + "summary": "DescribeAppVendorStatistics", + "operationId": "DescribeAppVendorStatistics", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/openpitrixDescribeVendorStatisticsResponse" + } + } + }, + "parameters": [ + { + "name": "search_word", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sort_key", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "reverse", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "limit", + "description": "default is 20, max value is 200.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "offset", + "description": "default is 0.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "user_id", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "status", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "display_columns", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + } + ], + "tags": [ + "AppVendorManager" + ] + } + }, "/v1/vendor_verify_infos": { "get": { "summary": "DescribeVendorVerifyInfos", @@ -5925,6 +6009,21 @@ } } }, + "openpitrixDescribeVendorStatisticsResponse": { + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64" + }, + "vendor_verify_statistics_set": { + "type": "array", + "items": { + "$ref": "#/definitions/openpitrixVendorStatistics" + } + } + } + }, "openpitrixDescribeVendorVerifyInfosResponse": { "type": "object", "properties": { @@ -6018,6 +6117,29 @@ } } }, + "openpitrixVendorStatistics": { + "type": "object", + "properties": { + "user_id": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "active_app_count": { + "type": "integer", + "format": "int32" + }, + "cluster_count_month": { + "type": "integer", + "format": "int32" + }, + "cluster_count_total": { + "type": "integer", + "format": "int32" + } + } + }, "openpitrixVendorVerifyInfo": { "type": "object", "properties": { @@ -6057,6 +6179,9 @@ "reject_message": { "type": "string" }, + "approver": { + "type": "string" + }, "submit_time": { "type": "string", "format": "date-time" diff --git a/pkg/apigateway/spec/static.go b/pkg/apigateway/spec/static.go index a2edfcb51..30195c33c 100644 --- a/pkg/apigateway/spec/static.go +++ b/pkg/apigateway/spec/static.go @@ -1329,6 +1329,90 @@ var Files = map[string]string{ ] } }, + "/v1/DescribeAppVendorStatistics": { + "get": { + "summary": "DescribeAppVendorStatistics", + "operationId": "DescribeAppVendorStatistics", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/openpitrixDescribeVendorStatisticsResponse" + } + } + }, + "parameters": [ + { + "name": "search_word", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sort_key", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "reverse", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "limit", + "description": "default is 20, max value is 200.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "offset", + "description": "default is 0.", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "user_id", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "status", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "display_columns", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + } + ], + "tags": [ + "AppVendorManager" + ] + } + }, "/v1/vendor_verify_infos": { "get": { "summary": "DescribeVendorVerifyInfos", @@ -5934,6 +6018,21 @@ var Files = map[string]string{ } } }, + "openpitrixDescribeVendorStatisticsResponse": { + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64" + }, + "vendor_verify_statistics_set": { + "type": "array", + "items": { + "$ref": "#/definitions/openpitrixVendorStatistics" + } + } + } + }, "openpitrixDescribeVendorVerifyInfosResponse": { "type": "object", "properties": { @@ -6027,6 +6126,29 @@ var Files = map[string]string{ } } }, + "openpitrixVendorStatistics": { + "type": "object", + "properties": { + "user_id": { + "type": "string" + }, + "company_name": { + "type": "string" + }, + "active_app_count": { + "type": "integer", + "format": "int32" + }, + "cluster_count_month": { + "type": "integer", + "format": "int32" + }, + "cluster_count_total": { + "type": "integer", + "format": "int32" + } + } + }, "openpitrixVendorVerifyInfo": { "type": "object", "properties": { @@ -6066,6 +6188,9 @@ var Files = map[string]string{ "reject_message": { "type": "string" }, + "approver": { + "type": "string" + }, "submit_time": { "type": "string", "format": "date-time" diff --git a/pkg/client/app/client.go b/pkg/client/app/client.go index d3ca8a81f..7e6f05ca2 100644 --- a/pkg/client/app/client.go +++ b/pkg/client/app/client.go @@ -5,15 +5,42 @@ package app import ( + "context" + "openpitrix.io/openpitrix/pkg/constants" + "openpitrix.io/openpitrix/pkg/logger" "openpitrix.io/openpitrix/pkg/manager" "openpitrix.io/openpitrix/pkg/pb" ) -func NewAppManagerClient() (pb.AppManagerClient, error) { +type Client struct { + pb.AppManagerClient +} + +func NewAppManagerClient() (*Client, error) { conn, err := manager.NewClient(constants.AppManagerHost, constants.AppManagerPort) if err != nil { return nil, err } - return pb.NewAppManagerClient(conn), err + return &Client{ + AppManagerClient: pb.NewAppManagerClient(conn), + }, nil +} + +func (c *Client) DescribeActiveAppsWithOwner(ctx context.Context, userId string, limit uint32, offset uint32) ([]*pb.App, int32, error) { + var appUserIds []string + appUserIds = append(appUserIds, userId) + request := &pb.DescribeAppsRequest{ + Owner: appUserIds, + Limit: limit, + Offset: offset, + } + + response, err := c.DescribeActiveApps(ctx, request) + + if err != nil { + logger.Error(ctx, "Describe ActiveApps with Owners [%s] failed: %+v", userId, err) + return nil, 0, err + } + return response.AppSet, int32(response.TotalCount), nil } diff --git a/pkg/client/cluster/client.go b/pkg/client/cluster/client.go index e10e01271..fedeaa495 100644 --- a/pkg/client/cluster/client.go +++ b/pkg/client/cluster/client.go @@ -134,3 +134,35 @@ func (c *Client) DescribeClustersWithFrontgateId(ctx context.Context, frontgateI } return response.ClusterSet, nil } + +func (c *Client) DescribeClustersWithAppId(ctx context.Context, appId string, isMonthData bool, limit uint32, offset uint32) ([]*pb.Cluster, int32, error) { + var appIds []string + appIds = append(appIds, appId) + var displayCols []string + displayCols = append(displayCols, "") + + var req pb.DescribeAppClustersRequest + if isMonthData { + req = pb.DescribeAppClustersRequest{ + AppId: appIds, + CreatedDate: pbutil.ToProtoUInt32(30), + Limit: limit, + Offset: offset, + DisplayColumns: displayCols, + } + } else { + req = pb.DescribeAppClustersRequest{ + AppId: appIds, + Limit: limit, + Offset: offset, + DisplayColumns: displayCols, + } + + } + response, err := c.DescribeAppClusters(ctx, &req) + if err != nil { + logger.Error(ctx, "DescribeAppClusters with appId [%s] failed: %+v", appId, err) + return nil, 0, err + } + return response.ClusterSet, int32(response.TotalCount), nil +} diff --git a/pkg/constants/column.go b/pkg/constants/column.go index 1651b3b4b..b8cc27472 100644 --- a/pkg/constants/column.go +++ b/pkg/constants/column.go @@ -105,6 +105,7 @@ const ( ColumnBankAccountNumber = "bank_account_number" ColumnRejectMessage = "reject_message" ColumnSubmitTime = "submit_time" + ColumnApprover = "approver" ) var PushEventTables = map[string][]string{ @@ -187,6 +188,9 @@ var IndexedColumns = map[string][]string{ TableAppVersionReview: { ColumnReviewId, ColumnVersionId, ColumnAppId, ColumnStatus, ColumnReviewer, }, + TableVendorVerifyInfo: { + ColumnUserId, ColumnStatus, + }, } var SearchWordColumnTable = []string{ @@ -201,6 +205,7 @@ var SearchWordColumnTable = []string{ TableClusterNode, TableUser, TableCategory, + TableVendorVerifyInfo, } // columns that can be search through sql 'like' operator @@ -238,4 +243,7 @@ var SearchColumns = map[string][]string{ TableCategory: { ColumnCategoryId, ColumnLocale, ColumnOwner, ColumnName, }, + TableVendorVerifyInfo: { + ColumnUserId, ColumnCompanyName, ColumnCompanyWebsite, ColumnAuthorizerName, ColumnAuthorizerEmail, + }, } diff --git a/pkg/db/schema/appvendor/V0_1__init.sql b/pkg/db/schema/appvendor/V0_1__init.sql index 86a4aa3a3..987f8c131 100644 --- a/pkg/db/schema/appvendor/V0_1__init.sql +++ b/pkg/db/schema/appvendor/V0_1__init.sql @@ -1,4 +1,3 @@ - CREATE TABLE vendor_verify_info ( @@ -8,7 +7,7 @@ CREATE TABLE vendor_verify_info company_profile text, authorizer_name varchar(50) NOT NULL, authorizer_email varchar(100) NOT NULL, - authorizer_phone varchar(50) NOT NULL, + authorizer_phone varchar(50) NOT NULL, bank_name varchar(200) NOT NULL, bank_account_name varchar(50) NOT NULL, bank_account_number varchar(100) NOT NULL, @@ -25,7 +24,7 @@ CREATE TABLE vendor_verify_info CREATE INDEX vendor_name_idx ON vendor_verify_info (company_name); - + CREATE INDEX vendor_company_website_idx ON vendor_verify_info (company_website); @@ -44,3 +43,5 @@ CREATE INDEX vendor_status_time_idx + + diff --git a/pkg/db/schema/appvendor/V0_2__addfields.sql b/pkg/db/schema/appvendor/V0_2__addfields.sql new file mode 100644 index 000000000..ef8cf27b2 --- /dev/null +++ b/pkg/db/schema/appvendor/V0_2__addfields.sql @@ -0,0 +1,8 @@ + +alter table vendor_verify_info add approver varchar(50); +alter table vendor_verify_info add owner varchar(50); +alter table vendor_verify_info add owner_path varchar(100); + +CREATE INDEX vendor_authorizer_email_idx + ON vendor_verify_info (authorizer_email); + diff --git a/pkg/models/vendor_verify_info.go b/pkg/models/vendor_verify_info.go index 3acf9708c..a5c426e7b 100644 --- a/pkg/models/vendor_verify_info.go +++ b/pkg/models/vendor_verify_info.go @@ -26,6 +26,9 @@ type VendorVerifyInfo struct { BankAccountNumber string Status string RejectMessage string + Approver string + Owner string + OwnerPath string SubmitTime *time.Time StatusTime time.Time } @@ -73,9 +76,38 @@ func (vendor *VendorVerifyInfo) ParseVendor2Pb(ctx context.Context, inVendor *Ve pbVendor.BankAccountNumber = pbutil.ToProtoString(inVendor.BankAccountNumber) pbVendor.Status = pbutil.ToProtoString(inVendor.Status) pbVendor.RejectMessage = pbutil.ToProtoString(inVendor.RejectMessage) + pbVendor.Approver = pbutil.ToProtoString(inVendor.Approver) if inVendor.SubmitTime != nil { pbVendor.SubmitTime = pbutil.ToProtoTimestamp(*inVendor.SubmitTime) } pbVendor.StatusTime = pbutil.ToProtoTimestamp(inVendor.StatusTime) return &pbVendor } + +type VendorStatistics struct { + UserId string + CompanyName string + ActiveAppCount int32 + ClusterCountMonth int32 + ClusterCountTotal int32 +} + +func (vendor *VendorStatistics) ParseVendorStatistics2Pb(ctx context.Context, inVendor *VendorStatistics) *pb.VendorStatistics { + pbVendor := pb.VendorStatistics{} + pbVendor.UserId = pbutil.ToProtoString(inVendor.UserId) + pbVendor.CompanyName = pbutil.ToProtoString(inVendor.CompanyName) + pbVendor.ActiveAppCount = pbutil.ToProtoInt32(inVendor.ActiveAppCount) + pbVendor.ClusterCountMonth = pbutil.ToProtoInt32(inVendor.ClusterCountMonth) + pbVendor.ClusterCountTotal = pbutil.ToProtoInt32(inVendor.ClusterCountTotal) + return &pbVendor +} + +func (vendor *VendorStatistics) ParseVendorStatisticsSet2PbSet(ctx context.Context, inVendors []*VendorStatistics) []*pb.VendorStatistics { + var pbVendorStatisticses []*pb.VendorStatistics + for _, inVendor := range inVendors { + var pbVendor *pb.VendorStatistics + pbVendor = vendor.ParseVendorStatistics2Pb(ctx, inVendor) + pbVendorStatisticses = append(pbVendorStatisticses, pbVendor) + } + return pbVendorStatisticses +} diff --git a/pkg/pb/appvendor.pb.go b/pkg/pb/appvendor.pb.go index 47d868e1f..671180264 100644 --- a/pkg/pb/appvendor.pb.go +++ b/pkg/pb/appvendor.pb.go @@ -223,8 +223,9 @@ type VendorVerifyInfo struct { BankAccountNumber *wrappers.StringValue `protobuf:"bytes,10,opt,name=bank_account_number,json=bankAccountNumber,proto3" json:"bank_account_number,omitempty"` Status *wrappers.StringValue `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` RejectMessage *wrappers.StringValue `protobuf:"bytes,12,opt,name=reject_message,json=rejectMessage,proto3" json:"reject_message,omitempty"` - SubmitTime *timestamp.Timestamp `protobuf:"bytes,13,opt,name=submit_time,json=submitTime,proto3" json:"submit_time,omitempty"` - StatusTime *timestamp.Timestamp `protobuf:"bytes,14,opt,name=status_time,json=statusTime,proto3" json:"status_time,omitempty"` + Approver *wrappers.StringValue `protobuf:"bytes,13,opt,name=approver,proto3" json:"approver,omitempty"` + SubmitTime *timestamp.Timestamp `protobuf:"bytes,14,opt,name=submit_time,json=submitTime,proto3" json:"submit_time,omitempty"` + StatusTime *timestamp.Timestamp `protobuf:"bytes,15,opt,name=status_time,json=statusTime,proto3" json:"status_time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -339,6 +340,13 @@ func (m *VendorVerifyInfo) GetRejectMessage() *wrappers.StringValue { return nil } +func (m *VendorVerifyInfo) GetApprover() *wrappers.StringValue { + if m != nil { + return m.Approver + } + return nil +} + func (m *VendorVerifyInfo) GetSubmitTime() *timestamp.Timestamp { if m != nil { return m.SubmitTime @@ -667,6 +675,124 @@ func (m *RejectVendorVerifyInfoResponse) GetUserId() *wrappers.StringValue { return nil } +type VendorStatistics struct { + UserId *wrappers.StringValue `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + CompanyName *wrappers.StringValue `protobuf:"bytes,2,opt,name=company_name,json=companyName,proto3" json:"company_name,omitempty"` + ActiveAppCount *wrappers.Int32Value `protobuf:"bytes,3,opt,name=active_app_count,json=activeAppCount,proto3" json:"active_app_count,omitempty"` + ClusterCountMonth *wrappers.Int32Value `protobuf:"bytes,4,opt,name=cluster_count_month,json=clusterCountMonth,proto3" json:"cluster_count_month,omitempty"` + ClusterCountTotal *wrappers.Int32Value `protobuf:"bytes,5,opt,name=cluster_count_total,json=clusterCountTotal,proto3" json:"cluster_count_total,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VendorStatistics) Reset() { *m = VendorStatistics{} } +func (m *VendorStatistics) String() string { return proto.CompactTextString(m) } +func (*VendorStatistics) ProtoMessage() {} +func (*VendorStatistics) Descriptor() ([]byte, []int) { + return fileDescriptor_61b540d6e928e276, []int{10} +} + +func (m *VendorStatistics) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VendorStatistics.Unmarshal(m, b) +} +func (m *VendorStatistics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VendorStatistics.Marshal(b, m, deterministic) +} +func (m *VendorStatistics) XXX_Merge(src proto.Message) { + xxx_messageInfo_VendorStatistics.Merge(m, src) +} +func (m *VendorStatistics) XXX_Size() int { + return xxx_messageInfo_VendorStatistics.Size(m) +} +func (m *VendorStatistics) XXX_DiscardUnknown() { + xxx_messageInfo_VendorStatistics.DiscardUnknown(m) +} + +var xxx_messageInfo_VendorStatistics proto.InternalMessageInfo + +func (m *VendorStatistics) GetUserId() *wrappers.StringValue { + if m != nil { + return m.UserId + } + return nil +} + +func (m *VendorStatistics) GetCompanyName() *wrappers.StringValue { + if m != nil { + return m.CompanyName + } + return nil +} + +func (m *VendorStatistics) GetActiveAppCount() *wrappers.Int32Value { + if m != nil { + return m.ActiveAppCount + } + return nil +} + +func (m *VendorStatistics) GetClusterCountMonth() *wrappers.Int32Value { + if m != nil { + return m.ClusterCountMonth + } + return nil +} + +func (m *VendorStatistics) GetClusterCountTotal() *wrappers.Int32Value { + if m != nil { + return m.ClusterCountTotal + } + return nil +} + +type DescribeVendorStatisticsResponse struct { + TotalCount uint32 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + VendorVerifyStatisticsSet []*VendorStatistics `protobuf:"bytes,2,rep,name=vendor_verify_statistics_set,json=vendorVerifyStatisticsSet,proto3" json:"vendor_verify_statistics_set,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescribeVendorStatisticsResponse) Reset() { *m = DescribeVendorStatisticsResponse{} } +func (m *DescribeVendorStatisticsResponse) String() string { return proto.CompactTextString(m) } +func (*DescribeVendorStatisticsResponse) ProtoMessage() {} +func (*DescribeVendorStatisticsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_61b540d6e928e276, []int{11} +} + +func (m *DescribeVendorStatisticsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescribeVendorStatisticsResponse.Unmarshal(m, b) +} +func (m *DescribeVendorStatisticsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescribeVendorStatisticsResponse.Marshal(b, m, deterministic) +} +func (m *DescribeVendorStatisticsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescribeVendorStatisticsResponse.Merge(m, src) +} +func (m *DescribeVendorStatisticsResponse) XXX_Size() int { + return xxx_messageInfo_DescribeVendorStatisticsResponse.Size(m) +} +func (m *DescribeVendorStatisticsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DescribeVendorStatisticsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DescribeVendorStatisticsResponse proto.InternalMessageInfo + +func (m *DescribeVendorStatisticsResponse) GetTotalCount() uint32 { + if m != nil { + return m.TotalCount + } + return 0 +} + +func (m *DescribeVendorStatisticsResponse) GetVendorVerifyStatisticsSet() []*VendorStatistics { + if m != nil { + return m.VendorVerifyStatisticsSet + } + return nil +} + func init() { proto.RegisterType((*DescribeVendorVerifyInfosRequest)(nil), "openpitrix.DescribeVendorVerifyInfosRequest") proto.RegisterType((*DescribeVendorVerifyInfosResponse)(nil), "openpitrix.DescribeVendorVerifyInfosResponse") @@ -678,74 +804,87 @@ func init() { proto.RegisterType((*PassVendorVerifyInfoResponse)(nil), "openpitrix.PassVendorVerifyInfoResponse") proto.RegisterType((*RejectVendorVerifyInfoRequest)(nil), "openpitrix.RejectVendorVerifyInfoRequest") proto.RegisterType((*RejectVendorVerifyInfoResponse)(nil), "openpitrix.RejectVendorVerifyInfoResponse") + proto.RegisterType((*VendorStatistics)(nil), "openpitrix.VendorStatistics") + proto.RegisterType((*DescribeVendorStatisticsResponse)(nil), "openpitrix.DescribeVendorStatisticsResponse") } func init() { proto.RegisterFile("appvendor.proto", fileDescriptor_61b540d6e928e276) } var fileDescriptor_61b540d6e928e276 = []byte{ - // 988 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xd7, 0x3a, 0x4d, 0x9c, 0x3c, 0xe7, 0x5f, 0x27, 0xc5, 0xd9, 0xba, 0x69, 0xeb, 0x6e, 0x25, - 0x6a, 0xa2, 0xc6, 0x16, 0x21, 0x80, 0x08, 0x8a, 0x90, 0x1b, 0xaa, 0x12, 0x41, 0x51, 0xea, 0xd0, - 0x44, 0xe2, 0xb2,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3, 0x46, 0xb9, 0xef, 0x67, 0xf9, 0x40, - 0x09, 0x2f, 0x68, 0x1f, 0xd2, 0x4e, 0x88, 0x35, 0x30, 0x84, 0x23, 0x26, 0x9a, 0xe4, 0x43, 0x98, - 0x95, 0x4c, 0x28, 0xf7, 0x19, 0xf6, 0xec, 0x4c, 0x0a, 0x6e, 0x36, 0x42, 0x7f, 0x8e, 0x3d, 0xb2, - 0x05, 0x59, 0x81, 0x5d, 0x14, 0x12, 0xed, 0x29, 0xcd, 0x2b, 0x8c, 0xf0, 0x1e, 0x30, 0xd6, 0x89, - 0x59, 0x31, 0x94, 0x5c, 0x83, 0xe9, 0x8e, 0xe7, 0x7b, 0xca, 0xbe, 0x52, 0xb4, 0x4a, 0x0b, 0x35, - 0x73, 0x20, 0x79, 0x98, 0x61, 0xad, 0x96, 0x44, 0x65, 0x4f, 0x6b, 0x73, 0x7c, 0x22, 0xab, 0x90, - 0x0d, 0x25, 0x0a, 0xd7, 0x6b, 0xda, 0xb9, 0xe2, 0x54, 0x69, 0xae, 0x36, 0x13, 0x1d, 0xf7, 0x9a, - 0x11, 0x41, 0x2a, 0xaa, 0x42, 0x69, 0xcf, 0x1b, 0xbb, 0x39, 0x91, 0x7b, 0xb0, 0xd4, 0xf4, 0x24, - 0xef, 0xd0, 0x9e, 0xdb, 0x60, 0x9d, 0xd0, 0x0f, 0xa4, 0xbd, 0xa0, 0x01, 0x8b, 0xb1, 0x79, 0xd7, - 0x58, 0x9d, 0x9f, 0x2d, 0xb8, 0x33, 0x21, 0xb5, 0x92, 0xb3, 0x40, 0x22, 0xb9, 0x0d, 0x39, 0xc5, - 0x14, 0xed, 0xb8, 0x0d, 0x16, 0x06, 0x4a, 0xe7, 0x76, 0xa1, 0x06, 0xda, 0xb4, 0x1b, 0x59, 0xc8, - 0x13, 0xc8, 0x9b, 0x52, 0x72, 0xbb, 0x9a, 0xee, 0x7a, 0x41, 0x8b, 0xb9, 0x51, 0x20, 0x99, 0xe2, - 0x94, 0x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xc1, 0x95, 0xaf, 0x33, 0xbc, 0x5e, 0x9f, 0xd1, 0x8d, 0xfd, 0xde, 0xff, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x58, 0x2f, 0x18, 0x73, 0xe9, 0x0e, 0x00, 0x00, + // 1155 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4d, 0x4f, 0x1b, 0x47, + 0x18, 0xd6, 0x3a, 0xe1, 0xeb, 0x35, 0x9f, 0x43, 0x0a, 0x8b, 0x81, 0x00, 0x1b, 0xa9, 0xa1, 0x28, + 0x60, 0x95, 0xd0, 0x2f, 0x2a, 0x54, 0x39, 0x34, 0xa2, 0x28, 0xa5, 0x22, 0x76, 0x02, 0x52, 0xa5, + 0x6a, 0x35, 0x5e, 0x8f, 0xcd, 0x36, 0xde, 0x9d, 0xe9, 0xcc, 0xac, 0x29, 0xad, 0x72, 0xe9, 0x4f, + 0xa0, 0x87, 0xde, 0x7a, 0xe8, 0x5f, 0xe8, 0xa1, 0x52, 0xd5, 0x53, 0x0f, 0xfd, 0x03, 0xbd, 0xf4, + 0x07, 0xf4, 0xd6, 0x63, 0x0f, 0xbd, 0x56, 0x3b, 0xb3, 0x86, 0xc5, 0xf6, 0x2e, 0xeb, 0xe4, 0x90, + 0x4b, 0x4e, 0x68, 0x5f, 0xde, 0xe7, 0x79, 0x3f, 0xfc, 0x7e, 0x0d, 0x4c, 0x60, 0xc6, 0x5a, 0xc4, + 0xaf, 0x51, 0xbe, 0xc1, 0x38, 0x95, 0x14, 0x01, 0x65, 0xc4, 0x67, 0xae, 0xe4, 0xee, 0xd7, 0x85, + 0xdb, 0x0d, 0x4a, 0x1b, 0x4d, 0x52, 0x54, 0xff, 0xa9, 0x06, 0xf5, 0xe2, 0x29, 0xc7, 0x8c, 0x11, + 0x2e, 0xb4, 0x6e, 0x61, 0xa9, 0xf3, 0xff, 0xd2, 0xf5, 0x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, + 0x6f, 0xac, 0x8e, 0x94, 0x07, 0xc3, 0xcf, 0xfd, 0x5a, 0x08, 0x10, 0x12, 0xcb, 0x40, 0x98, 0xa3, + 0x5a, 0xae, 0xbf, 0xd0, 0x5d, 0x98, 0xa8, 0xb9, 0x82, 0x35, 0xf1, 0x99, 0xed, 0xd0, 0x66, 0xe0, + 0xf9, 0xc2, 0x1c, 0x53, 0x0a, 0xe3, 0x91, 0x78, 0x57, 0x4b, 0xad, 0x1f, 0x0c, 0x58, 0x49, 0x49, + 0xad, 0x60, 0xd4, 0x17, 0x04, 0x2d, 0x41, 0x5e, 0x52, 0x89, 0x9b, 0xb6, 0x43, 0x03, 0x5f, 0xaa, + 0xdc, 0x8e, 0x95, 0x41, 0x89, 0x76, 0x43, 0x09, 0x7a, 0x0c, 0x33, 0xba, 0x94, 0xec, 0x96, 0x82, + 0xdb, 0xae, 0x5f, 0xa7, 0x76, 0x18, 0x48, 0x6e, 0xf9, 0x86, 0xca, 0xe5, 0x65, 0x6d, 0x6d, 0x74, + 0xda, 0x29, 0x4f, 0xb7, 0x3a, 0x24, 0x15, 0x22, 0xad, 0x0a, 0x14, 0xf6, 0x88, 0xec, 0xd2, 0x8d, + 0x7e, 0xed, 0x77, 0x2e, 0x33, 0x92, 0xe5, 0x97, 0x8e, 0xf2, 0x65, 0xfd, 0x3b, 0x04, 0x93, 0x9d, + 0x94, 0x2f, 0xc8, 0x85, 0x3e, 0x82, 0x51, 0x87, 0x7a, 0x0c, 0xfb, 0x67, 0xb6, 0x8f, 0x3d, 0x92, + 0xa9, 0x6a, 0xf2, 0x11, 0xe2, 0x33, 0xec, 0x11, 0xf4, 0x10, 0x26, 0xda, 0x04, 0xa7, 0xa4, 0x2a, + 0x5c, 0xd9, 0xae, 0xa0, 0x74, 0x8e, 0xf1, 0x08, 0x74, 0xac, 0x31, 0x71, 0x1a, 0xc6, 0x69, 0xdd, + 0x6d, 0x12, 0x55, 0x54, 0x59, 0x69, 0x0e, 0x35, 0x26,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x46, 0x59, 0x7d, 0x7c, + 0x5e, 0x9a, 0x41, 0x3d, 0xad, 0x29, 0x7f, 0x37, 0xad, 0xf5, 0x6b, 0xfd, 0x2d, 0x86, 0xf3, 0x8e, + 0xfa, 0xdb, 0x0c, 0x0b, 0x11, 0x96, 0xf7, 0x1f, 0x06, 0xcc, 0xf4, 0xde, 0x0e, 0x57, 0x7b, 0x33, + 0x75, 0x81, 0x5d, 0xed, 0xcd, 0xf4, 0x65, 0x63, 0x3d, 0x55, 0xbd, 0xd9, 0x5b, 0x49, 0x85, 0xb1, + 0x65, 0x15, 0x33, 0x87, 0xa1, 0x37, 0xdd, 0xb6, 0xb1, 0xf6, 0xe0, 0xe6, 0xe7, 0x39, 0x56, 0xad, + 0x0e, 0xaa, 0x61, 0x7a, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x9d, 0xc0, 0xe7, 0xfb, + 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -762,6 +901,7 @@ const _ = grpc.SupportPackageIsVersion4 type AppVendorManagerClient interface { SubmitVendorVerifyInfo(ctx context.Context, in *SubmitVendorVerifyInfoRequest, opts ...grpc.CallOption) (*SubmitVendorVerifyInfoResponse, error) DescribeVendorVerifyInfos(ctx context.Context, in *DescribeVendorVerifyInfosRequest, opts ...grpc.CallOption) (*DescribeVendorVerifyInfosResponse, error) + DescribeAppVendorStatistics(ctx context.Context, in *DescribeVendorVerifyInfosRequest, opts ...grpc.CallOption) (*DescribeVendorStatisticsResponse, error) GetVendorVerifyInfo(ctx context.Context, in *GetVendorVerifyInfoRequest, opts ...grpc.CallOption) (*VendorVerifyInfo, error) PassVendorVerifyInfo(ctx context.Context, in *PassVendorVerifyInfoRequest, opts ...grpc.CallOption) (*PassVendorVerifyInfoResponse, error) RejectVendorVerifyInfo(ctx context.Context, in *RejectVendorVerifyInfoRequest, opts ...grpc.CallOption) (*RejectVendorVerifyInfoResponse, error) @@ -793,6 +933,15 @@ func (c *appVendorManagerClient) DescribeVendorVerifyInfos(ctx context.Context, return out, nil } +func (c *appVendorManagerClient) DescribeAppVendorStatistics(ctx context.Context, in *DescribeVendorVerifyInfosRequest, opts ...grpc.CallOption) (*DescribeVendorStatisticsResponse, error) { + out := new(DescribeVendorStatisticsResponse) + err := c.cc.Invoke(ctx, "/openpitrix.AppVendorManager/DescribeAppVendorStatistics", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *appVendorManagerClient) GetVendorVerifyInfo(ctx context.Context, in *GetVendorVerifyInfoRequest, opts ...grpc.CallOption) (*VendorVerifyInfo, error) { out := new(VendorVerifyInfo) err := c.cc.Invoke(ctx, "/openpitrix.AppVendorManager/GetVendorVerifyInfo", in, out, opts...) @@ -824,6 +973,7 @@ func (c *appVendorManagerClient) RejectVendorVerifyInfo(ctx context.Context, in type AppVendorManagerServer interface { SubmitVendorVerifyInfo(context.Context, *SubmitVendorVerifyInfoRequest) (*SubmitVendorVerifyInfoResponse, error) DescribeVendorVerifyInfos(context.Context, *DescribeVendorVerifyInfosRequest) (*DescribeVendorVerifyInfosResponse, error) + DescribeAppVendorStatistics(context.Context, *DescribeVendorVerifyInfosRequest) (*DescribeVendorStatisticsResponse, error) GetVendorVerifyInfo(context.Context, *GetVendorVerifyInfoRequest) (*VendorVerifyInfo, error) PassVendorVerifyInfo(context.Context, *PassVendorVerifyInfoRequest) (*PassVendorVerifyInfoResponse, error) RejectVendorVerifyInfo(context.Context, *RejectVendorVerifyInfoRequest) (*RejectVendorVerifyInfoResponse, error) @@ -869,6 +1019,24 @@ func _AppVendorManager_DescribeVendorVerifyInfos_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _AppVendorManager_DescribeAppVendorStatistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DescribeVendorVerifyInfosRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AppVendorManagerServer).DescribeAppVendorStatistics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/openpitrix.AppVendorManager/DescribeAppVendorStatistics", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AppVendorManagerServer).DescribeAppVendorStatistics(ctx, req.(*DescribeVendorVerifyInfosRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _AppVendorManager_GetVendorVerifyInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetVendorVerifyInfoRequest) if err := dec(in); err != nil { @@ -935,6 +1103,10 @@ var _AppVendorManager_serviceDesc = grpc.ServiceDesc{ MethodName: "DescribeVendorVerifyInfos", Handler: _AppVendorManager_DescribeVendorVerifyInfos_Handler, }, + { + MethodName: "DescribeAppVendorStatistics", + Handler: _AppVendorManager_DescribeAppVendorStatistics_Handler, + }, { MethodName: "GetVendorVerifyInfo", Handler: _AppVendorManager_GetVendorVerifyInfo_Handler, diff --git a/pkg/pb/appvendor.pb.gw.go b/pkg/pb/appvendor.pb.gw.go index d6c179a8c..e8066269e 100644 --- a/pkg/pb/appvendor.pb.gw.go +++ b/pkg/pb/appvendor.pb.gw.go @@ -76,6 +76,23 @@ func request_AppVendorManager_DescribeVendorVerifyInfos_0(ctx context.Context, m } +var ( + filter_AppVendorManager_DescribeAppVendorStatistics_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_AppVendorManager_DescribeAppVendorStatistics_0(ctx context.Context, marshaler runtime.Marshaler, client AppVendorManagerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DescribeVendorVerifyInfosRequest + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_AppVendorManager_DescribeAppVendorStatistics_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DescribeAppVendorStatistics(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + var ( filter_AppVendorManager_GetVendorVerifyInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -215,6 +232,35 @@ func RegisterAppVendorManagerHandlerClient(ctx context.Context, mux *runtime.Ser }) + mux.Handle("GET", pattern_AppVendorManager_DescribeAppVendorStatistics_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_AppVendorManager_DescribeAppVendorStatistics_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_AppVendorManager_DescribeAppVendorStatistics_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_AppVendorManager_GetVendorVerifyInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -310,6 +356,8 @@ var ( pattern_AppVendorManager_DescribeVendorVerifyInfos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "vendor_verify_infos"}, "")) + pattern_AppVendorManager_DescribeAppVendorStatistics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "DescribeAppVendorStatistics"}, "")) + pattern_AppVendorManager_GetVendorVerifyInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "vendor_verify_infos", "user_id=*"}, "")) pattern_AppVendorManager_PassVendorVerifyInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "vendor_verify_infos", "user_id=*", "action"}, "pass")) @@ -322,6 +370,8 @@ var ( forward_AppVendorManager_DescribeVendorVerifyInfos_0 = runtime.ForwardResponseMessage + forward_AppVendorManager_DescribeAppVendorStatistics_0 = runtime.ForwardResponseMessage + forward_AppVendorManager_GetVendorVerifyInfo_0 = runtime.ForwardResponseMessage forward_AppVendorManager_PassVendorVerifyInfo_0 = runtime.ForwardResponseMessage diff --git a/pkg/service/appvendor/handler.go b/pkg/service/appvendor/handler.go index 42c1b8e3b..327cc3074 100644 --- a/pkg/service/appvendor/handler.go +++ b/pkg/service/appvendor/handler.go @@ -6,9 +6,13 @@ package appvendor import ( "context" + "math" "time" + appClient "openpitrix.io/openpitrix/pkg/client/app" + clusterClient "openpitrix.io/openpitrix/pkg/client/cluster" "openpitrix.io/openpitrix/pkg/constants" + "openpitrix.io/openpitrix/pkg/db" "openpitrix.io/openpitrix/pkg/gerr" "openpitrix.io/openpitrix/pkg/logger" "openpitrix.io/openpitrix/pkg/manager" @@ -18,7 +22,7 @@ import ( ) func (s *Server) DescribeVendorVerifyInfos(ctx context.Context, req *pb.DescribeVendorVerifyInfosRequest) (*pb.DescribeVendorVerifyInfosResponse, error) { - vendors, count, err := DescribeVendorVerifyInfos(ctx, req) + vendors, vendorCount, err := DescribeVendorVerifyInfos(ctx, req) if err != nil { logger.Error(ctx, "Failed to describe vendorVerifyInfos, error: %+v", err) return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) @@ -29,7 +33,7 @@ func (s *Server) DescribeVendorVerifyInfos(ctx context.Context, req *pb.Describe res := &pb.DescribeVendorVerifyInfosResponse{ VendorVerifyInfoSet: vendorPbSet, - TotalCount: count, + TotalCount: vendorCount, } return res, nil } @@ -107,7 +111,8 @@ func (s *Server) SubmitVendorVerifyInfo(ctx context.Context, req *pb.SubmitVendo func (s *Server) PassVendorVerifyInfo(ctx context.Context, req *pb.PassVendorVerifyInfoRequest) (*pb.PassVendorVerifyInfoResponse, error) { userID := req.GetUserId() - userID, err := PassVendorVerifyInfo(ctx, userID) + approver := "testapprover" + userID, err := PassVendorVerifyInfo(ctx, userID, approver) if err != nil { logger.Error(ctx, "Failed to pass vendorVerifyInfo [%s], %+v", userID, err) return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorUpdateResourceFailed) @@ -120,8 +125,9 @@ func (s *Server) PassVendorVerifyInfo(ctx context.Context, req *pb.PassVendorVer func (s *Server) RejectVendorVerifyInfo(ctx context.Context, req *pb.RejectVendorVerifyInfoRequest) (*pb.RejectVendorVerifyInfoResponse, error) { userID := req.GetUserId() + approver := "testapprover" rejectmsg := req.GetRejectMessage().GetValue() - userID, err := RejectVendorVerifyInfo(ctx, userID, rejectmsg) + userID, err := RejectVendorVerifyInfo(ctx, userID, rejectmsg, approver) if err != nil { logger.Error(ctx, "Failed to reject vendorVerifyInfo [%s], %+v", userID, err) return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorUpdateResourceFailed) @@ -132,6 +138,102 @@ func (s *Server) RejectVendorVerifyInfo(ctx context.Context, req *pb.RejectVendo return res, err } +//todo:need to call the new api DescribeAppClusters. +func (s *Server) DescribeAppVendorStatistics(ctx context.Context, req *pb.DescribeVendorVerifyInfosRequest) (*pb.DescribeVendorStatisticsResponse, error) { + appClient, err := appClient.NewAppManagerClient() + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + + clusterClient, err := clusterClient.NewClient() + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + + var vendorStatisticses []*models.VendorStatistics + vendors, vendorCount, err := DescribeVendorVerifyInfos(ctx, req) + if err != nil { + logger.Error(ctx, "Failed to describe vendorVerifyInfos, error: %+v", err) + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + + /*============================================================================================================*/ + //To get ClusterCountTotal + var clusterCntAll4AllPages int32 + var clusterCntMonth4AllPages int32 + for _, vendor := range vendors { + //step1:Get real appCnt for each vendor + var vendorStatistics models.VendorStatistics + pbApps, appCnt, err := appClient.DescribeActiveAppsWithOwner(ctx, vendor.UserId, db.DefaultSelectLimit, 0) + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + + //step2:if the real appCnt is smaller than db.DefaultSelectLimit,there is only one page apps,and the rows of this one page is length of pbApps. + //Just accumulate the clusterCnt4SingleApp for each app. + if appCnt <= int32(db.DefaultSelectLimit) { + for _, pbApp := range pbApps { + _, clusterCntAll4SingleApp, err := clusterClient.DescribeClustersWithAppId(ctx, pbApp.AppId.GetValue(), false, db.DefaultSelectLimit, 0) + _, clusterCntMonth4SingleApp, err := clusterClient.DescribeClustersWithAppId(ctx, pbApp.AppId.GetValue(), true, db.DefaultSelectLimit, 0) + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + clusterCntAll4AllPages = clusterCntAll4AllPages + clusterCntAll4SingleApp + clusterCntMonth4AllPages = clusterCntMonth4AllPages + clusterCntMonth4SingleApp + } + + } else { + //step3:if the real appCnt is bigger than db.DefaultSelectLimit(200),there are more than 1 page Apps. + //Should accumulate the clusterCnt4SingleApp for each apps ,then accumulate the number for each page. + pages := int(math.Ceil(float64(appCnt / db.DefaultSelectLimit))) + for i := 0; i < pages; i++ { + offset := db.DefaultSelectLimit * i + pbApps, _, err := appClient.DescribeActiveAppsWithOwner(ctx, vendor.UserId, db.DefaultSelectLimit, uint32(offset)) + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + + var clusterCntAll4OnePage int32 + var clusterCntMonth4OnePage int32 + for _, pbApp := range pbApps { + _, clusterCntAll4SingleApp, err := clusterClient.DescribeClustersWithAppId(ctx, pbApp.AppId.GetValue(), false, db.DefaultSelectLimit, uint32(offset)) + _, clusterCntMonth4SingleApp, err := clusterClient.DescribeClustersWithAppId(ctx, pbApp.AppId.GetValue(), true, db.DefaultSelectLimit, uint32(offset)) + if err != nil { + return nil, gerr.NewWithDetail(ctx, gerr.Internal, err, gerr.ErrorDescribeResourcesFailed) + } + clusterCntAll4OnePage = clusterCntAll4OnePage + clusterCntAll4SingleApp + clusterCntMonth4OnePage = clusterCntMonth4OnePage + clusterCntMonth4SingleApp + } + clusterCntAll4AllPages = clusterCntAll4AllPages + clusterCntAll4OnePage + clusterCntMonth4AllPages = clusterCntMonth4AllPages + clusterCntMonth4OnePage + } + + } + + /*============================================================================================================*/ + vendorStatistics.UserId = vendor.UserId + + vendorStatistics.CompanyName = vendor.CompanyName + vendorStatistics.ActiveAppCount = int32(appCnt) + vendorStatistics.ClusterCountTotal = clusterCntAll4AllPages + vendorStatistics.ClusterCountMonth = clusterCntMonth4AllPages + + vendorStatisticses = append(vendorStatisticses, &vendorStatistics) + + } + + var vendorStatistics models.VendorStatistics //need use a vendorStatistics object to call function + vendorStatisticsPbSet := vendorStatistics.ParseVendorStatisticsSet2PbSet(ctx, vendorStatisticses) + + res := &pb.DescribeVendorStatisticsResponse{ + VendorVerifyStatisticsSet: vendorStatisticsPbSet, + TotalCount: vendorCount, + } + return res, nil +} + +/*======================================================================================================================*/ + func (s *Server) checkVendorVerifyInfoIfExit(ctx context.Context, userID string) (bool, error) { info, err := GetVendorVerifyInfo(ctx, userID) if info == nil && err != nil { diff --git a/pkg/service/appvendor/resource_control.go b/pkg/service/appvendor/resource_control.go index 49be72cd0..cdf0ef450 100644 --- a/pkg/service/appvendor/resource_control.go +++ b/pkg/service/appvendor/resource_control.go @@ -66,10 +66,11 @@ func GetVendorVerifyInfo(ctx context.Context, userID string) (*models.VendorVeri return vendor, err } -func PassVendorVerifyInfo(ctx context.Context, userID string) (string, error) { +func PassVendorVerifyInfo(ctx context.Context, userID string, approver string) (string, error) { _, err := pi.Global().DB(ctx). Update(constants.TableVendorVerifyInfo). Set(constants.ColumnStatus, constants.StatusPassed). + Set(constants.ColumnApprover, approver). Set(constants.ColumnStatusTime, time.Now()). Where(db.Eq(constants.ColumnUserId, userID)). Exec() @@ -80,12 +81,13 @@ func PassVendorVerifyInfo(ctx context.Context, userID string) (string, error) { return userID, err } -func RejectVendorVerifyInfo(ctx context.Context, userID string, rejectmsg string) (string, error) { +func RejectVendorVerifyInfo(ctx context.Context, userID string, rejectmsg string, approver string) (string, error) { _, err := pi.Global().DB(ctx). Update(constants.TableVendorVerifyInfo). Set(constants.ColumnStatus, "rejected"). Set(constants.ColumnStatusTime, time.Now()). Set(constants.ColumnRejectMessage, rejectmsg). + Set(constants.ColumnApprover, approver). Where(db.Eq(constants.ColumnUserId, userID)). Exec() if err != nil { diff --git a/pkg/service/appvendor/server_test.go b/pkg/service/appvendor/server_test.go index 023e1c321..21cb8508c 100644 --- a/pkg/service/appvendor/server_test.go +++ b/pkg/service/appvendor/server_test.go @@ -63,9 +63,9 @@ func TestDescribeVendorVerifyInfos(t *testing.T) { var statuses []string statuses = append(statuses, "new") - statuses = append(statuses, "submitted") - statuses = append(statuses, "passed") - statuses = append(statuses, "rejected") + //statuses = append(statuses, "submitted") + //statuses = append(statuses, "passed") + //statuses = append(statuses, "rejected") var req = &vendor.DescribeVendorVerifyInfosRequest{ SearchWord: pbutil.ToProtoString("AuthorizerName"), diff --git a/test/appvendor/appvendor_test.go b/test/appvendor/appvendor_test.go index daff1ae01..76f34a706 100644 --- a/test/appvendor/appvendor_test.go +++ b/test/appvendor/appvendor_test.go @@ -24,6 +24,8 @@ func TestAppVendor(t *testing.T) { testUserID := "appvendor_test_userID" // SubmitVendorVerifyInfo + /*===============================================================================================*/ + logger.Info(nil, "%s", "/*=================================================*/") logger.Info(nil, "%s", "Test1 SubmitVendorVerifyInfo**************************") submitParams := app_vendor_manager.NewSubmitVendorVerifyInfoParams() submitParams.SetBody( @@ -53,9 +55,10 @@ func TestAppVendor(t *testing.T) { } // DescribeVendorVerifyInfos + /*===============================================================================================*/ + logger.Info(nil, "%s", "/*=================================================*/") logger.Info(nil, "%s", "Test2 DescribeVendorVerifyInfos**************************") describeParams := app_vendor_manager.NewDescribeVendorVerifyInfosParams() - logger.Info(nil, "test describeParams=[%+v]", describeParams) describeParams.WithUserID([]string{testUserID}) describeResp, err := client.AppVendorManager.DescribeVendorVerifyInfos(describeParams, nil) @@ -69,6 +72,8 @@ func TestAppVendor(t *testing.T) { } // GetVendorVerifyInfo + /*===============================================================================================*/ + logger.Info(nil, "%s", "/*=================================================*/") logger.Info(nil, "%s", "Test3 GetVendorVerifyInfo**************************") getParams := app_vendor_manager.NewGetVendorVerifyInfoParams() getParams.SetUserID(&testUserID) @@ -81,6 +86,8 @@ func TestAppVendor(t *testing.T) { } // PassVendorVerifyInfo + /*===============================================================================================*/ + logger.Info(nil, "%s", "/*=================================================*/") logger.Info(nil, "%s", "Test4 GetVendorVerifyInfo**************************") passParams := app_vendor_manager.NewPassVendorVerifyInfoParams() passParams.SetBody( @@ -102,6 +109,8 @@ func TestAppVendor(t *testing.T) { } // RejectVendorVerifyInfo + /*===============================================================================================*/ + logger.Info(nil, "%s", "/*=================================================*/") logger.Info(nil, "%s", "Test5 GetVendorVerifyInfo**************************") rejectParams := app_vendor_manager.NewRejectVendorVerifyInfoParams() @@ -123,6 +132,24 @@ func TestAppVendor(t *testing.T) { t.Fatalf("failed to RejectVendorVerifyInfo:UserID= [%s]", testUserID) } + // DescribeAppVendorStatistics + /*===============================================================================================*/ + + logger.Info(nil, "%s", "/*=================================================*/") + logger.Info(nil, "%s", "Test6 DescribeAppVendorStatistics**************************") + describeStaParams := app_vendor_manager.NewDescribeAppVendorStatisticsParams() + logger.Info(nil, "test describeParams=[%+v]", describeParams) + describeParams.WithUserID([]string{testUserID}) + + describeStaResp, err := client.AppVendorManager.DescribeAppVendorStatistics(describeStaParams, nil) + require.NoError(t, err) + vendorStatisticsVendors := describeStaResp.Payload.VendorVerifyStatisticsSet + if len(vendorStatisticsVendors) == 0 { + t.Fatalf("failed to DescribeAppVendorStatistics with params [%+v]", describeStaParams) + } else { + t.Logf("success to DescribeAppVendorStatistics:vendorStatisticsVendors cnt= [%d]", len(vendorStatisticsVendors)) + } + t.Log("test AppVendor finish, all test is ok") } diff --git a/test/client/app_vendor_manager/app_vendor_manager_client.go b/test/client/app_vendor_manager/app_vendor_manager_client.go index 2ec169c45..e7a2ae93f 100644 --- a/test/client/app_vendor_manager/app_vendor_manager_client.go +++ b/test/client/app_vendor_manager/app_vendor_manager_client.go @@ -24,6 +24,35 @@ type Client struct { formats strfmt.Registry } +/* +DescribeAppVendorStatistics describes app vendor statistics +*/ +func (a *Client) DescribeAppVendorStatistics(params *DescribeAppVendorStatisticsParams, authInfo runtime.ClientAuthInfoWriter) (*DescribeAppVendorStatisticsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDescribeAppVendorStatisticsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DescribeAppVendorStatistics", + Method: "GET", + PathPattern: "/v1/DescribeAppVendorStatistics", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DescribeAppVendorStatisticsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DescribeAppVendorStatisticsOK), nil + +} + /* DescribeVendorVerifyInfos describes vendor verify infos */ diff --git a/test/client/app_vendor_manager/describe_app_vendor_statistics_parameters.go b/test/client/app_vendor_manager/describe_app_vendor_statistics_parameters.go new file mode 100644 index 000000000..c14e4fb41 --- /dev/null +++ b/test/client/app_vendor_manager/describe_app_vendor_statistics_parameters.go @@ -0,0 +1,331 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package app_vendor_manager + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + "time" + + "golang.org/x/net/context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDescribeAppVendorStatisticsParams creates a new DescribeAppVendorStatisticsParams object +// with the default values initialized. +func NewDescribeAppVendorStatisticsParams() *DescribeAppVendorStatisticsParams { + var () + return &DescribeAppVendorStatisticsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDescribeAppVendorStatisticsParamsWithTimeout creates a new DescribeAppVendorStatisticsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDescribeAppVendorStatisticsParamsWithTimeout(timeout time.Duration) *DescribeAppVendorStatisticsParams { + var () + return &DescribeAppVendorStatisticsParams{ + + timeout: timeout, + } +} + +// NewDescribeAppVendorStatisticsParamsWithContext creates a new DescribeAppVendorStatisticsParams object +// with the default values initialized, and the ability to set a context for a request +func NewDescribeAppVendorStatisticsParamsWithContext(ctx context.Context) *DescribeAppVendorStatisticsParams { + var () + return &DescribeAppVendorStatisticsParams{ + + Context: ctx, + } +} + +// NewDescribeAppVendorStatisticsParamsWithHTTPClient creates a new DescribeAppVendorStatisticsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDescribeAppVendorStatisticsParamsWithHTTPClient(client *http.Client) *DescribeAppVendorStatisticsParams { + var () + return &DescribeAppVendorStatisticsParams{ + HTTPClient: client, + } +} + +/*DescribeAppVendorStatisticsParams contains all the parameters to send to the API endpoint +for the describe app vendor statistics operation typically these are written to a http.Request +*/ +type DescribeAppVendorStatisticsParams struct { + + /*DisplayColumns*/ + DisplayColumns []string + /*Limit + default is 20, max value is 200. + + */ + Limit *int64 + /*Offset + default is 0. + + */ + Offset *int64 + /*Reverse*/ + Reverse *bool + /*SearchWord*/ + SearchWord *string + /*SortKey*/ + SortKey *string + /*Status*/ + Status []string + /*UserID*/ + UserID []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithTimeout(timeout time.Duration) *DescribeAppVendorStatisticsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithContext(ctx context.Context) *DescribeAppVendorStatisticsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithHTTPClient(client *http.Client) *DescribeAppVendorStatisticsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDisplayColumns adds the displayColumns to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithDisplayColumns(displayColumns []string) *DescribeAppVendorStatisticsParams { + o.SetDisplayColumns(displayColumns) + return o +} + +// SetDisplayColumns adds the displayColumns to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetDisplayColumns(displayColumns []string) { + o.DisplayColumns = displayColumns +} + +// WithLimit adds the limit to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithLimit(limit *int64) *DescribeAppVendorStatisticsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithOffset(offset *int64) *DescribeAppVendorStatisticsParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithReverse adds the reverse to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithReverse(reverse *bool) *DescribeAppVendorStatisticsParams { + o.SetReverse(reverse) + return o +} + +// SetReverse adds the reverse to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetReverse(reverse *bool) { + o.Reverse = reverse +} + +// WithSearchWord adds the searchWord to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithSearchWord(searchWord *string) *DescribeAppVendorStatisticsParams { + o.SetSearchWord(searchWord) + return o +} + +// SetSearchWord adds the searchWord to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetSearchWord(searchWord *string) { + o.SearchWord = searchWord +} + +// WithSortKey adds the sortKey to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithSortKey(sortKey *string) *DescribeAppVendorStatisticsParams { + o.SetSortKey(sortKey) + return o +} + +// SetSortKey adds the sortKey to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetSortKey(sortKey *string) { + o.SortKey = sortKey +} + +// WithStatus adds the status to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithStatus(status []string) *DescribeAppVendorStatisticsParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetStatus(status []string) { + o.Status = status +} + +// WithUserID adds the userID to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) WithUserID(userID []string) *DescribeAppVendorStatisticsParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the describe app vendor statistics params +func (o *DescribeAppVendorStatisticsParams) SetUserID(userID []string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *DescribeAppVendorStatisticsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + valuesDisplayColumns := o.DisplayColumns + + joinedDisplayColumns := swag.JoinByFormat(valuesDisplayColumns, "multi") + // query array param display_columns + if err := r.SetQueryParam("display_columns", joinedDisplayColumns...); err != nil { + return err + } + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + + } + + if o.Reverse != nil { + + // query param reverse + var qrReverse bool + if o.Reverse != nil { + qrReverse = *o.Reverse + } + qReverse := swag.FormatBool(qrReverse) + if qReverse != "" { + if err := r.SetQueryParam("reverse", qReverse); err != nil { + return err + } + } + + } + + if o.SearchWord != nil { + + // query param search_word + var qrSearchWord string + if o.SearchWord != nil { + qrSearchWord = *o.SearchWord + } + qSearchWord := qrSearchWord + if qSearchWord != "" { + if err := r.SetQueryParam("search_word", qSearchWord); err != nil { + return err + } + } + + } + + if o.SortKey != nil { + + // query param sort_key + var qrSortKey string + if o.SortKey != nil { + qrSortKey = *o.SortKey + } + qSortKey := qrSortKey + if qSortKey != "" { + if err := r.SetQueryParam("sort_key", qSortKey); err != nil { + return err + } + } + + } + + valuesStatus := o.Status + + joinedStatus := swag.JoinByFormat(valuesStatus, "multi") + // query array param status + if err := r.SetQueryParam("status", joinedStatus...); err != nil { + return err + } + + valuesUserID := o.UserID + + joinedUserID := swag.JoinByFormat(valuesUserID, "multi") + // query array param user_id + if err := r.SetQueryParam("user_id", joinedUserID...); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/test/client/app_vendor_manager/describe_app_vendor_statistics_responses.go b/test/client/app_vendor_manager/describe_app_vendor_statistics_responses.go new file mode 100644 index 000000000..5aea41fc0 --- /dev/null +++ b/test/client/app_vendor_manager/describe_app_vendor_statistics_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package app_vendor_manager + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + "openpitrix.io/openpitrix/test/models" +) + +// DescribeAppVendorStatisticsReader is a Reader for the DescribeAppVendorStatistics structure. +type DescribeAppVendorStatisticsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DescribeAppVendorStatisticsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewDescribeAppVendorStatisticsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDescribeAppVendorStatisticsOK creates a DescribeAppVendorStatisticsOK with default headers values +func NewDescribeAppVendorStatisticsOK() *DescribeAppVendorStatisticsOK { + return &DescribeAppVendorStatisticsOK{} +} + +/*DescribeAppVendorStatisticsOK handles this case with default header values. + +A successful response. +*/ +type DescribeAppVendorStatisticsOK struct { + Payload *models.OpenpitrixDescribeVendorStatisticsResponse +} + +func (o *DescribeAppVendorStatisticsOK) Error() string { + return fmt.Sprintf("[GET /v1/DescribeAppVendorStatistics][%d] describeAppVendorStatisticsOK %+v", 200, o.Payload) +} + +func (o *DescribeAppVendorStatisticsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OpenpitrixDescribeVendorStatisticsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/test/models/openpitrix_describe_vendor_statistics_response.go b/test/models/openpitrix_describe_vendor_statistics_response.go new file mode 100644 index 000000000..7983afd66 --- /dev/null +++ b/test/models/openpitrix_describe_vendor_statistics_response.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// OpenpitrixDescribeVendorStatisticsResponse openpitrix describe vendor statistics response +// swagger:model openpitrixDescribeVendorStatisticsResponse +type OpenpitrixDescribeVendorStatisticsResponse struct { + + // total count + TotalCount int64 `json:"total_count,omitempty"` + + // vendor verify statistics set + VendorVerifyStatisticsSet OpenpitrixDescribeVendorStatisticsResponseVendorVerifyStatisticsSet `json:"vendor_verify_statistics_set"` +} + +// Validate validates this openpitrix describe vendor statistics response +func (m *OpenpitrixDescribeVendorStatisticsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// MarshalBinary interface implementation +func (m *OpenpitrixDescribeVendorStatisticsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenpitrixDescribeVendorStatisticsResponse) UnmarshalBinary(b []byte) error { + var res OpenpitrixDescribeVendorStatisticsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/models/openpitrix_describe_vendor_statistics_response_vendor_verify_statistics_set.go b/test/models/openpitrix_describe_vendor_statistics_response_vendor_verify_statistics_set.go new file mode 100644 index 000000000..2dff12aad --- /dev/null +++ b/test/models/openpitrix_describe_vendor_statistics_response_vendor_verify_statistics_set.go @@ -0,0 +1,47 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// OpenpitrixDescribeVendorStatisticsResponseVendorVerifyStatisticsSet openpitrix describe vendor statistics response vendor verify statistics set +// swagger:model openpitrixDescribeVendorStatisticsResponseVendorVerifyStatisticsSet +type OpenpitrixDescribeVendorStatisticsResponseVendorVerifyStatisticsSet []*OpenpitrixVendorStatistics + +// Validate validates this openpitrix describe vendor statistics response vendor verify statistics set +func (m OpenpitrixDescribeVendorStatisticsResponseVendorVerifyStatisticsSet) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/test/models/openpitrix_vendor_statistics.go b/test/models/openpitrix_vendor_statistics.go new file mode 100644 index 000000000..771d9b32f --- /dev/null +++ b/test/models/openpitrix_vendor_statistics.go @@ -0,0 +1,61 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// OpenpitrixVendorStatistics openpitrix vendor statistics +// swagger:model openpitrixVendorStatistics +type OpenpitrixVendorStatistics struct { + + // active app count + ActiveAppCount int32 `json:"active_app_count,omitempty"` + + // cluster count month + ClusterCountMonth int32 `json:"cluster_count_month,omitempty"` + + // cluster count total + ClusterCountTotal int32 `json:"cluster_count_total,omitempty"` + + // company name + CompanyName string `json:"company_name,omitempty"` + + // user id + UserID string `json:"user_id,omitempty"` +} + +// Validate validates this openpitrix vendor statistics +func (m *OpenpitrixVendorStatistics) Validate(formats strfmt.Registry) error { + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// MarshalBinary interface implementation +func (m *OpenpitrixVendorStatistics) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenpitrixVendorStatistics) UnmarshalBinary(b []byte) error { + var res OpenpitrixVendorStatistics + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/models/openpitrix_vendor_verify_info.go b/test/models/openpitrix_vendor_verify_info.go index 8e4c13fdd..3cd4648b6 100644 --- a/test/models/openpitrix_vendor_verify_info.go +++ b/test/models/openpitrix_vendor_verify_info.go @@ -16,6 +16,9 @@ import ( // swagger:model openpitrixVendorVerifyInfo type OpenpitrixVendorVerifyInfo struct { + // approver + Approver string `json:"approver,omitempty"` + // authorizer email AuthorizerEmail string `json:"authorizer_email,omitempty"`