byteplus-sdk 1.0.38__tar.gz → 1.0.42__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/PKG-INFO +1 -1
- byteplus-sdk-1.0.42/byteplus_sdk/__init__.py +2 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/cdn/service.py +52 -0
- byteplus-sdk-1.0.42/byteplus_sdk/example/cdn/create_rule_engine_template.py +160 -0
- byteplus-sdk-1.0.42/byteplus_sdk/example/cdn/describe_rule_engine_template.py +23 -0
- byteplus-sdk-1.0.42/byteplus_sdk/example/cdn/release_template.py +23 -0
- byteplus-sdk-1.0.42/byteplus_sdk/example/cdn/update_rule_engine_template.py +61 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20230101/live_config.py +11 -1
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20230101/live_trait.py +70 -0
- byteplus-sdk-1.0.42/byteplus_sdk/vod/VodServiceConfig.py +219 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk.egg-info/PKG-INFO +1 -1
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk.egg-info/SOURCES.txt +4 -0
- byteplus-sdk-1.0.38/byteplus_sdk/__init__.py +0 -2
- byteplus-sdk-1.0.38/byteplus_sdk/vod/VodServiceConfig.py +0 -118
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/LICENSE +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/README.md +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/ApiInfo.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/Credentials.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/Policy.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/ServiceInfo.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/ServiceInfoHttps.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/auth/MetaData.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/auth/SignerV4.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/auth/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/Request.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/Service.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/models/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/models/base/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/base/models/base/base_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/cdn/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/const/Const.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/const/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/add_cdn_certificate.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/add_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/add_template_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/create_cipher_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/create_service_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/delete_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/delete_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_accounting_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_access_log.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_config.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_data_detail.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_detail.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_origin_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_region_and_isp.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_service.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cdn_upper_ip.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_cipher_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_content_block_tasks.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_content_quota.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_content_tasks.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_edge_nrt_data_summary.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_edge_statistical_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_edge_top_nrt_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_edge_top_statistical_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_edge_top_status_code.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_ip_info.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_ip_list_info.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_origin_nrt_data_summary.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_origin_top_nrt_data.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_origin_top_status_code.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_service_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_template_domains.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/describe_templates.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/duplicate_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/list_cdn_cert_info.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/list_cdn_domains.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/list_cert_info.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/lock_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/start_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/stop_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/submit_block_task.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/submit_preload_task.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/submit_refresh_task.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/submit_unblock_task.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/update_cdn_config.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/update_cipher_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/update_service_template.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/cdn/update_template_domain.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/live/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/rtc/RtcService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/rtc/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/rtc/example_get_record_task.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/rtc/example_start_record.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/visual/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/example/visual/example_common.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/iam/IamService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/iam/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/LiveService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20200801/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20200801/live_config.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20200801/live_service.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20200801/live_trait.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20230101/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/live/v20230101/live_service.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/sms/SmsService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/sms/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/util/Functions.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/util/Util.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/util/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/visual/VisualService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/visual/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/VodService.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_apps_manage_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_callback_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_cdn_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_common_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_edit_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_measure_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_media_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_play_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_smart_strategy_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_space_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_upload_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/business/vod_workflow_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/request/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/request/request_vod_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/response/__init__.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk/vod/models/response/response_vod_pb2.py +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk.egg-info/dependency_links.txt +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk.egg-info/requires.txt +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/byteplus_sdk.egg-info/top_level.txt +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/setup.cfg +0 -0
- {byteplus-sdk-1.0.38 → byteplus-sdk-1.0.42}/setup.py +0 -0
|
@@ -174,6 +174,18 @@ api_info = {
|
|
|
174
174
|
"CreateServiceTemplate": ApiInfo("POST", "/", {
|
|
175
175
|
"Action": "CreateServiceTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
176
176
|
|
|
177
|
+
"CreateRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
178
|
+
"Action": "CreateRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
179
|
+
|
|
180
|
+
"UpdateRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
181
|
+
"Action": "UpdateRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
182
|
+
|
|
183
|
+
"DescribeRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
184
|
+
"Action": "DescribeRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
185
|
+
|
|
186
|
+
"ReleaseTemplate": ApiInfo("POST", "/", {
|
|
187
|
+
"Action": "ReleaseTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
188
|
+
|
|
177
189
|
"DescribeDistrictData": ApiInfo("POST", "/", {
|
|
178
190
|
"Action": "DescribeDistrictData", "Version": SERVICE_VERSION}, {}, {}),
|
|
179
191
|
|
|
@@ -1049,3 +1061,43 @@ class CDNService(Service):
|
|
|
1049
1061
|
raise Exception("%s: empty response" % action)
|
|
1050
1062
|
res_json = json.loads(res)
|
|
1051
1063
|
return res_json
|
|
1064
|
+
|
|
1065
|
+
def create_rule_engine_template(self, params=None):
|
|
1066
|
+
if params is None:
|
|
1067
|
+
params = {}
|
|
1068
|
+
action = "CreateRuleEngineTemplate"
|
|
1069
|
+
res = self.json(action, [], params)
|
|
1070
|
+
if res == '':
|
|
1071
|
+
raise Exception("%s: empty response" % action)
|
|
1072
|
+
res_json = json.loads(res)
|
|
1073
|
+
return res_json
|
|
1074
|
+
|
|
1075
|
+
def update_rule_engine_template(self, params=None):
|
|
1076
|
+
if params is None:
|
|
1077
|
+
params = {}
|
|
1078
|
+
action = "UpdateRuleEngineTemplate"
|
|
1079
|
+
res = self.json(action, [], params)
|
|
1080
|
+
if res == '':
|
|
1081
|
+
raise Exception("%s: empty response" % action)
|
|
1082
|
+
res_json = json.loads(res)
|
|
1083
|
+
return res_json
|
|
1084
|
+
|
|
1085
|
+
def describe_rule_engine_template(self, params=None):
|
|
1086
|
+
if params is None:
|
|
1087
|
+
params = {}
|
|
1088
|
+
action = "DescribeRuleEngineTemplate"
|
|
1089
|
+
res = self.json(action, [], params)
|
|
1090
|
+
if res == '':
|
|
1091
|
+
raise Exception("%s: empty response" % action)
|
|
1092
|
+
res_json = json.loads(res)
|
|
1093
|
+
return res_json
|
|
1094
|
+
|
|
1095
|
+
def release_template(self, params=None):
|
|
1096
|
+
if params is None:
|
|
1097
|
+
params = {}
|
|
1098
|
+
action = "ReleaseTemplate"
|
|
1099
|
+
res = self.json(action, [], params)
|
|
1100
|
+
if res == '':
|
|
1101
|
+
raise Exception("%s: empty response" % action)
|
|
1102
|
+
res_json = json.loads(res)
|
|
1103
|
+
return res_json
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
from rule_engine.Rule import Condition, Action, Rule
|
|
11
|
+
from rule_engine.Const import Const
|
|
12
|
+
|
|
13
|
+
def example():
|
|
14
|
+
cdn_service = CDNService()
|
|
15
|
+
cdn_service.set_ak(ak)
|
|
16
|
+
cdn_service.set_sk(sk)
|
|
17
|
+
|
|
18
|
+
# Create a rule engine policy that sets the cache time to 0 seconds under any conditions.
|
|
19
|
+
rule = Rule()
|
|
20
|
+
rule.desc = "example"
|
|
21
|
+
rule.if_block.condition = Condition({
|
|
22
|
+
"IsGroup": False,
|
|
23
|
+
"Connective": Const.ConnectiveAnd,
|
|
24
|
+
"Condition": {
|
|
25
|
+
"Object": Const.ConditionAlways,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
rule.if_block.actions.append(Action({
|
|
29
|
+
"Action": Const.ActionCacheTime,
|
|
30
|
+
"Groups": [{
|
|
31
|
+
"Dimension": Const.ActionCacheTime,
|
|
32
|
+
"GroupParameters": [{
|
|
33
|
+
"Parameters": [
|
|
34
|
+
{
|
|
35
|
+
"Name": "ttl",
|
|
36
|
+
"Values": ["0"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"Name": "ttl_unit",
|
|
40
|
+
"Values": ["sec"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"Name": "cache_policy",
|
|
44
|
+
"Values": [Const.CacheDefault]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"Name": "force_cache",
|
|
48
|
+
"Values": ["true"]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}]
|
|
52
|
+
}]
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
56
|
+
"Project": "default",
|
|
57
|
+
"Title": "example",
|
|
58
|
+
"Message": "Under any conditions, set the cache time to 0 seconds",
|
|
59
|
+
"Rule": rule.encode_to_string()
|
|
60
|
+
})
|
|
61
|
+
print(rsp)
|
|
62
|
+
|
|
63
|
+
def example2():
|
|
64
|
+
cdn_service = CDNService()
|
|
65
|
+
cdn_service.set_ak(ak)
|
|
66
|
+
cdn_service.set_sk(sk)
|
|
67
|
+
|
|
68
|
+
# When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.
|
|
69
|
+
rule = Rule()
|
|
70
|
+
rule.desc = "example"
|
|
71
|
+
rule.if_block.condition = Condition({
|
|
72
|
+
"IsGroup": False,
|
|
73
|
+
"Connective": Const.ConnectiveAnd,
|
|
74
|
+
"Condition": {
|
|
75
|
+
"Object": Const.ConditionHTTPReferer,
|
|
76
|
+
"Operator": Const.OperatorEqual,
|
|
77
|
+
"Value": ["example"],
|
|
78
|
+
"IgnoreCase": True
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
rule.if_block.actions.append(Action({
|
|
82
|
+
"Action": Const.ConditionResponseHeader,
|
|
83
|
+
"Groups": [{
|
|
84
|
+
"Dimension": Const.ActionResponseHeader,
|
|
85
|
+
"GroupParameters": [{
|
|
86
|
+
"Parameters": [
|
|
87
|
+
{
|
|
88
|
+
"Name": "action",
|
|
89
|
+
"Values": ["set"]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"Name": "header_name",
|
|
93
|
+
"Values": ["test"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"Name": "header_value",
|
|
97
|
+
"Values": ["abc123"]
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}]
|
|
101
|
+
}]
|
|
102
|
+
}))
|
|
103
|
+
|
|
104
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
105
|
+
"Project": "default",
|
|
106
|
+
"Title": "example2",
|
|
107
|
+
"Message": "When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.",
|
|
108
|
+
"Rule": rule.encode_to_string()
|
|
109
|
+
})
|
|
110
|
+
print(rsp)
|
|
111
|
+
|
|
112
|
+
def example3():
|
|
113
|
+
cdn_service = CDNService()
|
|
114
|
+
cdn_service.set_ak(ak)
|
|
115
|
+
cdn_service.set_sk(sk)
|
|
116
|
+
|
|
117
|
+
# URL matching, equal to http://www.example.com/path1?a=1 When case is ignored, the protocol forces a redirect, with a redirect status code of 301 and a redirect protocol of HTTPS
|
|
118
|
+
rule = Rule()
|
|
119
|
+
rule.desc = "example"
|
|
120
|
+
rule.if_block.condition = Condition({
|
|
121
|
+
"IsGroup": False,
|
|
122
|
+
"Connective": Const.ConnectiveAnd,
|
|
123
|
+
"Condition": {
|
|
124
|
+
"Object": Const.ConditionHTTPUrl,
|
|
125
|
+
"Operator": Const.OperatorEqual,
|
|
126
|
+
"Value": ["http://www.test.com/path1?a=1"],
|
|
127
|
+
"IgnoreCase": True
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
rule.if_block.actions.append(Action({
|
|
131
|
+
"Action": Const.ActionRedirectProtocol,
|
|
132
|
+
"Groups": [{
|
|
133
|
+
"Dimension": Const.ActionRedirectProtocol,
|
|
134
|
+
"GroupParameters": [{
|
|
135
|
+
"Parameters": [
|
|
136
|
+
{
|
|
137
|
+
"Name": "status_code",
|
|
138
|
+
"Values": ["301"]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"Name": "protocol",
|
|
142
|
+
"Values": ["https"]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}]
|
|
146
|
+
}]
|
|
147
|
+
}))
|
|
148
|
+
|
|
149
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
150
|
+
"Project": "default",
|
|
151
|
+
"Title": "example3",
|
|
152
|
+
"Message": "",
|
|
153
|
+
"Rule": rule.encode_to_string()
|
|
154
|
+
})
|
|
155
|
+
print(rsp)
|
|
156
|
+
|
|
157
|
+
if __name__ == '__main__':
|
|
158
|
+
example1()
|
|
159
|
+
example2()
|
|
160
|
+
example3()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def example():
|
|
12
|
+
cdn_service = CDNService()
|
|
13
|
+
cdn_service.set_ak(ak)
|
|
14
|
+
cdn_service.set_sk(sk)
|
|
15
|
+
|
|
16
|
+
rsp = cdn_service.describe_rule_engine_template({
|
|
17
|
+
"TemplateId": "tpl-example",
|
|
18
|
+
})
|
|
19
|
+
print(rsp)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
example()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def example():
|
|
12
|
+
cdn_service = CDNService()
|
|
13
|
+
cdn_service.set_ak(ak)
|
|
14
|
+
cdn_service.set_sk(sk)
|
|
15
|
+
|
|
16
|
+
rsp = cdn_service.release_template({
|
|
17
|
+
"TemplateId": "tpl-example",
|
|
18
|
+
})
|
|
19
|
+
print(rsp)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
example()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
from rule_engine.Rule import Condition, Action, Rule
|
|
11
|
+
from rule_engine.Const import Const
|
|
12
|
+
|
|
13
|
+
def example():
|
|
14
|
+
cdn_service = CDNService()
|
|
15
|
+
cdn_service.set_ak(ak)
|
|
16
|
+
cdn_service.set_sk(sk)
|
|
17
|
+
|
|
18
|
+
rule = Rule()
|
|
19
|
+
rule.desc = "example"
|
|
20
|
+
rule.if_block.condition = Condition({
|
|
21
|
+
"IsGroup": False,
|
|
22
|
+
"Connective": Const.ConnectiveAnd,
|
|
23
|
+
"Condition": {
|
|
24
|
+
"Object": Const.ConditionAlways,
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
rule.if_block.actions.append(Action({
|
|
28
|
+
"Action": Const.ActionCacheTime,
|
|
29
|
+
"Groups": [{
|
|
30
|
+
"Dimension": Const.ActionCacheTime,
|
|
31
|
+
"GroupParameters": [{
|
|
32
|
+
"Parameters": [
|
|
33
|
+
{
|
|
34
|
+
"Name": "ttl",
|
|
35
|
+
"Values": ["0"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"Name": "ttl_unit",
|
|
39
|
+
"Values": ["sec"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"Name": "cache_policy",
|
|
43
|
+
"Values": [Const.CacheDefault]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Name": "force_cache",
|
|
47
|
+
"Values": ["true"]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}]
|
|
51
|
+
}]
|
|
52
|
+
}))
|
|
53
|
+
rsp = cdn_service.update_rule_engine_template({
|
|
54
|
+
"TemplateId": "tpl-example",
|
|
55
|
+
"TemplateVersion": "draft",
|
|
56
|
+
"Rule": rule.encode_to_string()
|
|
57
|
+
})
|
|
58
|
+
print(rsp)
|
|
59
|
+
|
|
60
|
+
if __name__ == '__main__':
|
|
61
|
+
example()
|
|
@@ -82,6 +82,7 @@ api_info = {
|
|
|
82
82
|
"ResumeStream": ApiInfo("POST", "/", {"Action": "ResumeStream", "Version": "2023-01-01"}, {}, {}),
|
|
83
83
|
"GeneratePlayURL": ApiInfo("POST", "/", {"Action": "GeneratePlayURL", "Version": "2023-01-01"}, {}, {}),
|
|
84
84
|
"GeneratePushURL": ApiInfo("POST", "/", {"Action": "GeneratePushURL", "Version": "2023-01-01"}, {}, {}),
|
|
85
|
+
"DescribeLiveTopPlayData": ApiInfo("POST", "/", {"Action": "DescribeLiveTopPlayData", "Version": "2023-01-01"}, {}, {}),
|
|
85
86
|
"DescribeLiveRegionData": ApiInfo("POST", "/", {"Action": "DescribeLiveRegionData", "Version": "2023-01-01"}, {}, {}),
|
|
86
87
|
"DescribeLiveSourceStreamMetrics": ApiInfo("POST", "/", {"Action": "DescribeLiveSourceStreamMetrics", "Version": "2023-01-01"}, {}, {}),
|
|
87
88
|
"DescribeLivePushStreamMetrics": ApiInfo("POST", "/", {"Action": "DescribeLivePushStreamMetrics", "Version": "2023-01-01"}, {}, {}),
|
|
@@ -94,6 +95,7 @@ api_info = {
|
|
|
94
95
|
"DescribeLiveSourceTrafficData": ApiInfo("POST", "/", {"Action": "DescribeLiveSourceTrafficData", "Version": "2023-01-01"}, {}, {}),
|
|
95
96
|
"DescribeLiveMetricBandwidthData": ApiInfo("POST", "/", {"Action": "DescribeLiveMetricBandwidthData", "Version": "2023-01-01"}, {}, {}),
|
|
96
97
|
"DescribeLiveMetricTrafficData": ApiInfo("POST", "/", {"Action": "DescribeLiveMetricTrafficData", "Version": "2023-01-01"}, {}, {}),
|
|
98
|
+
"DescribeLiveEdgeStatData": ApiInfo("POST", "/", {"Action": "DescribeLiveEdgeStatData", "Version": "2023-01-01"}, {}, {}),
|
|
97
99
|
"DescribeLiveISPData": ApiInfo("POST", "/", {"Action": "DescribeLiveISPData", "Version": "2023-01-01"}, {}, {}),
|
|
98
100
|
"DescribeLiveP95PeakBandwidthData": ApiInfo("POST", "/", {"Action": "DescribeLiveP95PeakBandwidthData", "Version": "2023-01-01"}, {}, {}),
|
|
99
101
|
"DescribeLiveASRDurationData": ApiInfo("POST", "/", {"Action": "DescribeLiveASRDurationData", "Version": "2023-01-01"}, {}, {}),
|
|
@@ -128,6 +130,8 @@ api_info = {
|
|
|
128
130
|
"BindEncryptDRM": ApiInfo("POST", "/", {"Action": "BindEncryptDRM", "Version": "2023-01-01"}, {}, {}),
|
|
129
131
|
"UnBindEncryptDRM": ApiInfo("POST", "/", {"Action": "UnBindEncryptDRM", "Version": "2023-01-01"}, {}, {}),
|
|
130
132
|
"ListBindEncryptDRM": ApiInfo("POST", "/", {"Action": "ListBindEncryptDRM", "Version": "2023-01-01"}, {}, {}),
|
|
133
|
+
"CreateTranscodePresetBatch": ApiInfo("POST", "/", {"Action": "CreateTranscodePresetBatch", "Version": "2023-01-01"}, {}, {}),
|
|
134
|
+
"DeleteTranscodePresetBatch": ApiInfo("POST", "/", {"Action": "DeleteTranscodePresetBatch", "Version": "2023-01-01"}, {}, {}),
|
|
131
135
|
"DeleteIPAccessRule": ApiInfo("POST", "/", {"Action": "DeleteIPAccessRule", "Version": "2023-01-01"}, {}, {}),
|
|
132
136
|
"DeleteRegionAccessRule": ApiInfo("POST", "/", {"Action": "DeleteRegionAccessRule", "Version": "2023-01-01"}, {}, {}),
|
|
133
137
|
"UpdateIPAccessRule": ApiInfo("POST", "/", {"Action": "UpdateIPAccessRule", "Version": "2023-01-01"}, {}, {}),
|
|
@@ -157,5 +161,11 @@ api_info = {
|
|
|
157
161
|
"DeleteSubtitleTranscodePreset": ApiInfo("POST", "/", {"Action": "DeleteSubtitleTranscodePreset", "Version": "2023-01-01"}, {}, {}),
|
|
158
162
|
"UpdateSubtitleTranscodePreset": ApiInfo("POST", "/", {"Action": "UpdateSubtitleTranscodePreset", "Version": "2023-01-01"}, {}, {}),
|
|
159
163
|
"ListVhostSubtitleTranscodePreset": ApiInfo("POST", "/", {"Action": "ListVhostSubtitleTranscodePreset", "Version": "2023-01-01"}, {}, {}),
|
|
160
|
-
"CreateSubtitleTranscodePreset": ApiInfo("POST", "/", {"Action": "CreateSubtitleTranscodePreset", "Version": "2023-01-01"}, {}, {})
|
|
164
|
+
"CreateSubtitleTranscodePreset": ApiInfo("POST", "/", {"Action": "CreateSubtitleTranscodePreset", "Version": "2023-01-01"}, {}, {}),
|
|
165
|
+
"CreateLivePadPreset": ApiInfo("POST", "/", {"Action": "CreateLivePadPreset", "Version": "2023-01-01"}, {}, {}),
|
|
166
|
+
"DeleteLivePadPreset": ApiInfo("POST", "/", {"Action": "DeleteLivePadPreset", "Version": "2023-01-01"}, {}, {}),
|
|
167
|
+
"StopLivePadStream": ApiInfo("POST", "/", {"Action": "StopLivePadStream", "Version": "2023-01-01"}, {}, {}),
|
|
168
|
+
"UpdateLivePadPreset": ApiInfo("POST", "/", {"Action": "UpdateLivePadPreset", "Version": "2023-01-01"}, {}, {}),
|
|
169
|
+
"DescribeLivePadStreamList": ApiInfo("POST", "/", {"Action": "DescribeLivePadStreamList", "Version": "2023-01-01"}, {}, {}),
|
|
170
|
+
"DescribeLivePadPresetDetail": ApiInfo("POST", "/", {"Action": "DescribeLivePadPresetDetail", "Version": "2023-01-01"}, {}, {})
|
|
161
171
|
}
|
|
@@ -530,6 +530,13 @@ class LiveTrait(Service):
|
|
|
530
530
|
res_json = json.loads(res)
|
|
531
531
|
return res_json
|
|
532
532
|
|
|
533
|
+
def describe_live_top_play_data(self, body):
|
|
534
|
+
res = self.api_post('DescribeLiveTopPlayData', [], body)
|
|
535
|
+
if res == '':
|
|
536
|
+
raise Exception("empty response")
|
|
537
|
+
res_json = json.loads(res)
|
|
538
|
+
return res_json
|
|
539
|
+
|
|
533
540
|
def describe_live_region_data(self, body):
|
|
534
541
|
res = self.api_post('DescribeLiveRegionData', [], body)
|
|
535
542
|
if res == '':
|
|
@@ -614,6 +621,13 @@ class LiveTrait(Service):
|
|
|
614
621
|
res_json = json.loads(res)
|
|
615
622
|
return res_json
|
|
616
623
|
|
|
624
|
+
def describe_live_edge_stat_data(self, body):
|
|
625
|
+
res = self.api_post('DescribeLiveEdgeStatData', [], body)
|
|
626
|
+
if res == '':
|
|
627
|
+
raise Exception("empty response")
|
|
628
|
+
res_json = json.loads(res)
|
|
629
|
+
return res_json
|
|
630
|
+
|
|
617
631
|
def describe_live_isp_data(self, body):
|
|
618
632
|
res = self.api_post('DescribeLiveISPData', [], body)
|
|
619
633
|
if res == '':
|
|
@@ -852,6 +866,20 @@ class LiveTrait(Service):
|
|
|
852
866
|
res_json = json.loads(res)
|
|
853
867
|
return res_json
|
|
854
868
|
|
|
869
|
+
def create_transcode_preset_batch(self, body):
|
|
870
|
+
res = self.api_post('CreateTranscodePresetBatch', [], body)
|
|
871
|
+
if res == '':
|
|
872
|
+
raise Exception("empty response")
|
|
873
|
+
res_json = json.loads(res)
|
|
874
|
+
return res_json
|
|
875
|
+
|
|
876
|
+
def delete_transcode_preset_batch(self, body):
|
|
877
|
+
res = self.api_post('DeleteTranscodePresetBatch', [], body)
|
|
878
|
+
if res == '':
|
|
879
|
+
raise Exception("empty response")
|
|
880
|
+
res_json = json.loads(res)
|
|
881
|
+
return res_json
|
|
882
|
+
|
|
855
883
|
def delete_ip_access_rule(self, body):
|
|
856
884
|
res = self.api_post('DeleteIPAccessRule', [], body)
|
|
857
885
|
if res == '':
|
|
@@ -1060,4 +1088,46 @@ class LiveTrait(Service):
|
|
|
1060
1088
|
if res == '':
|
|
1061
1089
|
raise Exception("empty response")
|
|
1062
1090
|
res_json = json.loads(res)
|
|
1091
|
+
return res_json
|
|
1092
|
+
|
|
1093
|
+
def create_live_pad_preset(self, body):
|
|
1094
|
+
res = self.api_post('CreateLivePadPreset', [], body)
|
|
1095
|
+
if res == '':
|
|
1096
|
+
raise Exception("empty response")
|
|
1097
|
+
res_json = json.loads(res)
|
|
1098
|
+
return res_json
|
|
1099
|
+
|
|
1100
|
+
def delete_live_pad_preset(self, body):
|
|
1101
|
+
res = self.api_post('DeleteLivePadPreset', [], body)
|
|
1102
|
+
if res == '':
|
|
1103
|
+
raise Exception("empty response")
|
|
1104
|
+
res_json = json.loads(res)
|
|
1105
|
+
return res_json
|
|
1106
|
+
|
|
1107
|
+
def stop_live_pad_stream(self, body):
|
|
1108
|
+
res = self.api_post('StopLivePadStream', [], body)
|
|
1109
|
+
if res == '':
|
|
1110
|
+
raise Exception("empty response")
|
|
1111
|
+
res_json = json.loads(res)
|
|
1112
|
+
return res_json
|
|
1113
|
+
|
|
1114
|
+
def update_live_pad_preset(self, body):
|
|
1115
|
+
res = self.api_post('UpdateLivePadPreset', [], body)
|
|
1116
|
+
if res == '':
|
|
1117
|
+
raise Exception("empty response")
|
|
1118
|
+
res_json = json.loads(res)
|
|
1119
|
+
return res_json
|
|
1120
|
+
|
|
1121
|
+
def describe_live_pad_stream_list(self, body):
|
|
1122
|
+
res = self.api_post('DescribeLivePadStreamList', [], body)
|
|
1123
|
+
if res == '':
|
|
1124
|
+
raise Exception("empty response")
|
|
1125
|
+
res_json = json.loads(res)
|
|
1126
|
+
return res_json
|
|
1127
|
+
|
|
1128
|
+
def describe_live_pad_preset_detail(self, body):
|
|
1129
|
+
res = self.api_post('DescribeLivePadPresetDetail', [], body)
|
|
1130
|
+
if res == '':
|
|
1131
|
+
raise Exception("empty response")
|
|
1132
|
+
res_json = json.loads(res)
|
|
1063
1133
|
return res_json
|