Best Python code snippet using localstack_python
bk_node.py
Source:bk_node.py
1# -*- coding: utf-8 -*-2"""3TencentBlueKing is pleased to support the open source community by making è鲸æºäº-èç¹ç®¡ç(BlueKing-BK-NODEMAN) available.4Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.5Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.6You may obtain a copy of the License at https://opensource.org/licenses/MIT7Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on8an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the9specific language governing permissions and limitations under the License.10"""11from django.utils.translation import ugettext_lazy as _12from ..base import DataAPI13from ..domains import BK_NODE_APIGATEWAY_ROOT14from .utils import add_esb_info_before_request15class _BKNodeApi(object):16 MODULE = _("èç¹ç®¡ç")17 def __init__(self):18 self.upload = DataAPI(19 method="POST",20 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/upload/",21 module=self.MODULE,22 description="ä¸ä¼ æ件",23 before_request=add_esb_info_before_request,24 )25 self.create_subscription = DataAPI(26 method="POST",27 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/create/",28 module=self.MODULE,29 description="å建订é
é
ç½®",30 before_request=add_esb_info_before_request,31 )32 self.get_subscription_task_status = DataAPI(33 method="POST",34 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/task_result/",35 module=self.MODULE,36 description="æ¥ç订é
ä»»å¡è¿è¡ç¶æ",37 before_request=add_esb_info_before_request,38 )39 self.collect_subscription_task_detail = DataAPI(40 method="POST",41 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/collect_task_result_detail/",42 module=self.MODULE,43 description="éé订é
ä»»å¡ä¸å®ä¾ç详ç»ç¶æ",44 before_request=add_esb_info_before_request,45 )46 self.get_subscription_task_detail = DataAPI(47 method="POST",48 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/task_result_detail/",49 module=self.MODULE,50 description="æ¥è¯¢è®¢é
ä»»å¡ä¸å®ä¾ç详ç»ç¶æ",51 before_request=add_esb_info_before_request,52 )53 self.check_subscription_task_ready = DataAPI(54 method="POST",55 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/check_task_ready/",56 module=self.MODULE,57 description="æ¥è¯¢ä»»å¡æ¯å¦å·²åå¤å®æ",58 before_request=add_esb_info_before_request,59 )60 self.run_subscription_task = DataAPI(61 method="POST",62 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/run/",63 module=self.MODULE,64 description="æ§è¡è®¢é
ä¸åä»»å¡",65 before_request=add_esb_info_before_request,66 )67 self.subscription_delete = DataAPI(68 method="POST",69 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/delete/",70 module=self.MODULE,71 description="å é¤è®¢é
",72 before_request=add_esb_info_before_request,73 )74 self.subscription_update = DataAPI(75 method="POST",76 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/update/",77 module=self.MODULE,78 description="æ´æ°è®¢é
",79 before_request=add_esb_info_before_request,80 )81 self.subscription_info = DataAPI(82 method="POST",83 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/info/",84 module=self.MODULE,85 description="订é
详ç»",86 before_request=add_esb_info_before_request,87 )88 self.subscription_search_policy = DataAPI(89 method="POST",90 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/search_deploy_policy/",91 module=self.MODULE,92 description="æ¥è¯¢çç¥å表",93 before_request=add_esb_info_before_request,94 )95 self.subscription_fetch_policy_topo = DataAPI(96 method="POST",97 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/fetch_policy_topo/",98 module=self.MODULE,99 description="æ件çç¥ææ",100 before_request=add_esb_info_before_request,101 )102 self.retry_subscription_task = DataAPI(103 method="POST",104 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/retry/",105 module=self.MODULE,106 description="éè¯ä»»å¡",107 before_request=add_esb_info_before_request,108 )109 self.revoke_subscription_task = DataAPI(110 method="POST",111 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/revoke/",112 module=self.MODULE,113 description="ç»æ¢æ£å¨æ§è¡ç订é
ä»»å¡",114 before_request=add_esb_info_before_request,115 )116 self.fetch_commands = DataAPI(117 method="POST",118 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/fetch_commands/",119 module=self.MODULE,120 description="è·åå®è£
å½ä»¤",121 before_request=add_esb_info_before_request,122 )123 self.retry_node = DataAPI(124 method="POST",125 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/retry_node/",126 module=self.MODULE,127 description="ååç²åº¦éè¯ä»»å¡",128 before_request=add_esb_info_before_request,129 )130 # æ件å
æ¥å£131 self.create_register_task = DataAPI(132 method="POST",133 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/create_register_task/",134 module=self.MODULE,135 description="å建注åä»»å¡",136 before_request=add_esb_info_before_request,137 )138 self.query_register_task = DataAPI(139 method="GET",140 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/query_register_task/",141 module=self.MODULE,142 description="æ¥è¯¢æ件注åä»»å¡",143 before_request=add_esb_info_before_request,144 )145 self.release = DataAPI(146 method="POST",147 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/release/",148 module=self.MODULE,149 description="åå¸ï¼ä¸çº¿ï¼æ件å
",150 before_request=add_esb_info_before_request,151 )152 self.package_status_operation = DataAPI(153 method="POST",154 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/package_status_operation/",155 module=self.MODULE,156 description="æ件å
ç¶æç±»æä½",157 before_request=add_esb_info_before_request,158 )159 self.create_export_task = DataAPI(160 method="POST",161 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/create_export_task/",162 module=self.MODULE,163 description="触åæ件æå
导åº",164 before_request=add_esb_info_before_request,165 )166 self.query_export_task = DataAPI(167 method="GET",168 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/query_export_task/",169 module=self.MODULE,170 description="è·åä¸ä¸ªå¯¼åºä»»å¡ç»æ",171 before_request=add_esb_info_before_request,172 )173 self.parse = DataAPI(174 method="POST",175 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/parse/",176 module=self.MODULE,177 description="解ææ件å
",178 before_request=add_esb_info_before_request,179 )180 self.plugin_list = DataAPI(181 method="GET",182 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/",183 module=self.MODULE,184 description="æ件å表",185 before_request=add_esb_info_before_request,186 )187 self.plugin_retrieve = DataAPI(188 method="GET",189 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/{plugin_id}/",190 module=self.MODULE,191 description="æ件详ç»",192 before_request=add_esb_info_before_request,193 )194 self.plugin_status_operation = DataAPI(195 method="POST",196 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/plugin_status_operation/",197 module=self.MODULE,198 description="æ件ç¶æç±»æä½",199 before_request=add_esb_info_before_request,200 )201 self.plugin_history = DataAPI(202 method="GET",203 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/{plugin_id}/history/",204 module=self.MODULE,205 description="æ件å
åå²",206 before_request=add_esb_info_before_request,207 )208 self.query_host_policy = DataAPI(209 method="GET",210 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/query_host_policy/",211 module=self.MODULE,212 description="主æºçç¥å表",213 before_request=add_esb_info_before_request,214 )215 self.migrate_preview = DataAPI(216 method="POST",217 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/migrate_preview/",218 module=self.MODULE,219 description="åæ´è®¡ç®é¢è§",220 before_request=add_esb_info_before_request,221 )222 self.metric_list = DataAPI(223 method="GET",224 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/healthz/",225 module=self.MODULE,226 description="èªçæ§ææ æ£æ¥",227 before_request=add_esb_info_before_request,...
__init__.py
Source:__init__.py
...9from API.database import database as dbBlueprint10from API.login_log import login_log as logBlueprint11from API.auth import token_auth12@token_auth13def before_request():14 pass15# token_authãè§å¾16userBlueprint.before_request(before_request)17arctypeBlueprint.before_request(before_request)18archiveBlueprint.before_request(before_request)19commentBlueprint.before_request(before_request)20configBlueprint.before_request(before_request)21dbBlueprint.before_request(before_request)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!