-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
320 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,13 @@ | |
@Date : 2024-06-27 | ||
""" | ||
|
||
|
||
class SSLDeployTypeEnum(object): | ||
""" | ||
ssl证书部署方式 | ||
""" | ||
SSH = 0 | ||
|
||
WEB_HOOK = 1 | ||
|
||
OSS = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : migrate_1642_to_1643.py | ||
@Date : 2024-07-24 | ||
cmd: | ||
$ python domain_admin/migrate/migrate_1642_to_1643.py | ||
""" | ||
from __future__ import print_function, unicode_literals, absolute_import, division | ||
|
||
from domain_admin.migrate import migrate_common | ||
from domain_admin.model.base_model import db | ||
from domain_admin.model.issue_certificate_model import IssueCertificateModel, DeployStatusEnum | ||
|
||
|
||
def execute_migrate(): | ||
""" | ||
版本升级 1.6.42 => 1.6.43 | ||
:return: | ||
""" | ||
migrator = migrate_common.get_migrator(db) | ||
|
||
migrate_rows = [ | ||
# deploy_params_raw | ||
migrator.add_column( | ||
table=IssueCertificateModel._meta.table_name, | ||
column_name=IssueCertificateModel.deploy_params_raw.name, | ||
field=IssueCertificateModel.deploy_params_raw | ||
) | ||
] | ||
|
||
migrate_common.try_execute_migrate(migrate_rows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : aliyun_api.py | ||
@Date : 2024-07-24 | ||
""" | ||
|
||
from alibabacloud_cas20200407 import models as cas_20200407_models | ||
from alibabacloud_cas20200407.client import Client as cas20200407Client | ||
from alibabacloud_tea_openapi import models as open_api_models | ||
from alibabacloud_tea_util import models as util_models | ||
|
||
|
||
def upload_user_certificate( | ||
access_key_id, access_key_secret, | ||
cert_name, cert, key | ||
): | ||
""" | ||
上传证书 | ||
@return: Client | ||
@throws Exception | ||
""" | ||
# 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。 | ||
# 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378659.html。 | ||
config = open_api_models.Config( | ||
# 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。, | ||
access_key_id=access_key_id, | ||
# 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。, | ||
access_key_secret=access_key_secret | ||
) | ||
# Endpoint 请参考 https://api.aliyun.com/product/cas | ||
config.endpoint = 'cas.aliyuncs.com' | ||
|
||
client = cas20200407Client(config) | ||
upload_user_certificate_request = cas_20200407_models.UploadUserCertificateRequest( | ||
name=cert_name, | ||
cert=cert, | ||
key=key, | ||
) | ||
|
||
runtime = util_models.RuntimeOptions() | ||
|
||
client.upload_user_certificate_with_options(upload_user_certificate_request, runtime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@File : aliyun_cdn_api.py | ||
@Date : 2024-07-24 | ||
""" | ||
|
||
from alibabacloud_cdn20180510 import models as cdn_20180510_models | ||
from alibabacloud_cdn20180510.client import Client as Cdn20180510Client | ||
from alibabacloud_tea_openapi import models as open_api_models | ||
from alibabacloud_tea_util import models as util_models | ||
|
||
|
||
def set_cdn_domain_ssl_certificate(access_key_id, access_key_secret, domain_name): | ||
# 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。 | ||
# 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378659.html。 | ||
config = open_api_models.Config( | ||
# 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。, | ||
access_key_id=access_key_id, | ||
# 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。, | ||
access_key_secret=access_key_secret, | ||
) | ||
# Endpoint 请参考 https://api.aliyun.com/product/Cdn | ||
config.endpoint = f'cdn.aliyuncs.com' | ||
client = Cdn20180510Client(config) | ||
|
||
set_cdn_domain_sslcertificate_request = cdn_20180510_models.SetCdnDomainSSLCertificateRequest( | ||
cert_type='cas', | ||
domain_name=domain_name, | ||
sslprotocol='on' | ||
) | ||
runtime = util_models.RuntimeOptions() | ||
|
||
# 复制代码运行请自行打印 API 的返回值 | ||
client.set_cdn_domain_sslcertificate_with_options(set_cdn_domain_sslcertificate_request, runtime) |
Oops, something went wrong.