Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add license agent openapi proxy #6147

Merged
merged 8 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .erda/migrations/license-agent/20230927-license-base.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE erda_licenses
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use singular format for table name: erda_license

(
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '许可证ID',
`entity_type` ENUM('PLATFORM', 'ORG') NOT NULL COMMENT '实体类型',
`entity_id` BIGINT NOT NULL DEFAULT 0 COMMENT '实体ID',
`enc_license` TEXT COMMENT '加密许可证信息',
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY entity_entity_id (entity_type, entity_id)
) COMMENT '许可证信息表';
10 changes: 10 additions & 0 deletions apistructs/license_agent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package apistructs

type RegisterLicenseRequest struct {
Scope int64 `json:"scope"`
License string `json:"license"`
}

type RegisterLicenseResponse struct {
Id int64 `json:"id"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package license_agent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please identify the license for the project.


import (
"net/http"

"github.com/erda-project/erda/internal/core/openapi/legacy/api/apis"
)

var AGENT_LICENSE_FEATURE_GET = apis.ApiSpec{
Path: "/api/licenses/features",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange path

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

BackendPath: "/api/licenses/features",
Host: "license-agent.marathon.l4lb.thisdcos.directory:8080",
Scheme: "http",
Method: http.MethodGet,
IsOpenAPI: true,
CheckLogin: true,
CheckToken: true,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package license_agent

import (
"net/http"

"github.com/erda-project/erda/internal/core/openapi/legacy/api/apis"
)

var AGENT_LICENSE_GET = apis.ApiSpec{
Path: "/api/licenses",
BackendPath: "/api/licenses",
Host: "license-agent.marathon.l4lb.thisdcos.directory:8080",
Scheme: "http",
Method: http.MethodGet,
IsOpenAPI: true,
CheckLogin: true,
CheckToken: true,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package license_agent

import (
"net/http"

"github.com/erda-project/erda/apistructs"
"github.com/erda-project/erda/internal/core/openapi/legacy/api/apis"
)

var AGENT_REGISTER_LICENSE_POST = apis.ApiSpec{
Path: "/api/licenses/actions/register",
BackendPath: "/api/licenses/actions/register",
Host: "license-agent.marathon.l4lb.thisdcos.directory:8080",
Scheme: "http",
Method: http.MethodPost,
IsOpenAPI: true,
CheckLogin: true,
CheckToken: true,
RequestType: apistructs.RegisterLicenseRequest{},
ResponseType: apistructs.RegisterLicenseResponse{},
}
Loading