### Install Dependencies and Run Dev Server Source: https://edgeone.ai/zh/document/196763737788014592 Navigate into the created project directory, install its dependencies, and start the development server. ```bash cd my-vue-app npm install npm run dev ``` -------------------------------- ### PHP SDK Example Source: https://edgeone.ai/zh/document/74213 Example of using the Tencent Cloud SDK for PHP to call the ConfirmMultiPathGatewayOriginACL API. Ensure the SDK is installed and configured. ```php "zone-27q0p0bal192", "GatewayId" => "mpgw-lbxuhk1oh", "OriginACLVersion" => 1 ); $req->fromJsonString(json_encode($params)); $resp = $client->ConfirmMultiPathGatewayOriginACL($req); echo(ConfirmMultiPathGatewayOriginACLResponse::toJsonString($resp)); } catch(TencentCloudSDKException $e) { echo $e; } ?> ``` -------------------------------- ### Python SDK Example Source: https://edgeone.ai/zh/document/74213 Example of using the Tencent Cloud SDK for Python to call the ConfirmMultiPathGatewayOriginACL API. Ensure the SDK is installed and configured. ```python from tencentcloud.teo.v20220901 import teo_client from tencentcloud.common import credential from tencentcloud.common.exception import TencentCloudSDKException try: cred = credential.Credential("SECRETID", "SECRETKEY") client = teo_client.TeoClient(cred, "ap-guangzhou") req = models.ConfirmMultiPathGatewayOriginACLRequest() params = { "ZoneId": "zone-27q0p0bal192", "GatewayId": "mpgw-lbxuhk1oh", "OriginACLVersion": 1 } req.from_json_string(json.dumps(params)) resp = client.ConfirmMultiPathGatewayOriginACL(req) print(resp.to_json_string()) except TencentCloudSDKException as err: print(err) ``` -------------------------------- ### HTTP GET Request Example Source: https://edgeone.ai/zh/document/50457 Demonstrates the structure of an HTTP GET request for querying Cloud Virtual Machine instances, including common signature parameters. ```http https://cvm.tencentcloudapi.com/?Action=DescribeInstances&Version=2017-03-12&SignatureMethod=HmacSHA256&Timestamp=1527672334&Signature=37ac2f4fde00b0ac9bd9eadeb459b1bbee224158d66e7ae5fcadb70b2d181d02&Region=ap-guangzhou&Nonce=23823223&SecretId=AKID******************************** Host: cvm.tencentcloudapi.com Content-Type: application/x-www-form-urlencoded ``` -------------------------------- ### Query Package Information List Source: https://edgeone.ai/zh/document/72310 This example shows how to query the package information list sorted by package activation time in descending order, starting from the 0th package and fetching 4 package details. ```http POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: DescribePlans { "Offset": 0, "Limit": 4, "Order": "enable-time", "Direction": "desc" } ``` -------------------------------- ### Start Local Gatsby Development Server Source: https://edgeone.ai/zh/document/178279639901777920 Commands to install dependencies and start the Gatsby development server, along with EdgeOne's local preview. Ensure the ports match. ```bash npm install gatsby develop && edgeone pages dev --fePort=8000 ``` -------------------------------- ### Install Blob SDK Source: https://edgeone.ai/zh/document/210063146417373184 Install the Node.js SDK for interacting with Blob storage. ```bash npm install @edgeone/pages-blob ``` -------------------------------- ### HTTP GET Request Structure Source: https://edgeone.ai/zh/document/50457 Example of an HTTP GET request including common TC3-HMAC-SHA256 parameters in the headers. ```http https://cvm.tencentcloudapi.com/?Limit=10&Offset=0 Authorization: TC3-HMAC-SHA256 Credential=AKID********************************/2018-10-09/cvm/tc3_request, SignedHeaders=content-type;host, Signature=5da7a33f6993f0614b047e5df4582db9e9bf4672ba50567dba16c6ccf174c474 Content-Type: application/x-www-form-urlencoded Host: cvm.tencentcloudapi.com X-TC-Action: DescribeInstances X-TC-Version: 2017-03-12 X-TC-Timestamp: 1539084154 X-TC-Region: ap-guangzhou ``` -------------------------------- ### CI/CD Pipeline Preview Deployment Example Source: https://edgeone.ai/zh/document/162228053922476032 Example of deploying to the preview environment from a CI/CD pipeline, specifying the project name, environment, and API token. ```bash edgeone pages deploy -n project-name -e preview -t $EDGEONE_API_TOKEN ``` -------------------------------- ### Node.js SDK Example Source: https://edgeone.ai/zh/document/74213 Example of using the Tencent Cloud SDK for Node.js to call the ConfirmMultiPathGatewayOriginACL API. Ensure the SDK is installed and configured. ```javascript const tencentcloud = require("tencentcloud-sdk-nodejs-intl-en"); const TeoClient = tencentcloud.teo.v20220901.Client; const models = tencentcloud.teo.v20220901.Models; const credential = new (require("tencentcloud-sdk-core").credential.Credential)("SECRETID", "SECRETKEY"); const client = new TeoClient(credential, "ap-guangzhou", "cvm.tencentcloudapi.com"); const req = new models.ConfirmMultiPathGatewayOriginACLRequest(); const params = { "ZoneId": "zone-27q0p0bal192", "GatewayId": "mpgw-lbxuhk1oh", "OriginACLVersion": 1 }; req.from_json_string(JSON.stringify(params)); client.ConfirmMultiPathGatewayOriginACL(req).then( (data) => { console.log(data); }, (err) => { console.error(err); } ); ``` -------------------------------- ### Start React Development Server Source: https://edgeone.ai/zh/document/196763685510774784 Navigate into your project directory and start the development server to see your React application in action. ```bash cd my-react-app npm start ``` -------------------------------- ### Create Application Proxy Input Example Source: https://edgeone.ai/zh/document/50985 This example demonstrates how to construct the input parameters for creating an application proxy. It includes details like zone ID, proxy name, platform type, security and acceleration settings, session persistence, IPv6 configuration, and application proxy rules for TCP and UDP protocols. ```json POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: CreateApplicationProxy { "ZoneId": "zone-21xfqlh4qjee", "ProxyName": "instancd-name", "ProxyType": "instance", "PlatType": "ip", "SecurityType": 1, "AccelerateType": 1, "SessionPersistTime": 3600, "Ipv6": { "Switch": "on" }, "ApplicationProxyRules": [ { "Proto": "TCP", "Port": [ "80", "90", "99-110" ], "OriginType": "custom", "OriginValue": [ "1.1.1.1:80" ] }, { "Proto": "UDP", "Port": [ "999", "888", "99-110" ], "OriginType": "custom", "OriginValue": [ "1.1.1.1:80", "2.2.2.2:80" ] } ] } ``` -------------------------------- ### CreatePlanForZone API Input Example Source: https://edgeone.ai/zh/document/50546 This example demonstrates how to construct the input for the CreatePlanForZone API call to purchase a new site plan. Ensure common request parameters are included. ```http POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: CreatePlanForZone { "ZoneId": "zone-25z65bfb4414", "PlanType": "sta" } ``` -------------------------------- ### Go SDK Example Source: https://edgeone.ai/zh/document/74213 Example of using the Tencent Cloud SDK for Go to call the ConfirmMultiPathGatewayOriginACL API. Ensure the SDK is imported and initialized. ```go package main import ( "fmt" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" ) func main() { cpf := profile.NewClientProfile() cpf.HttpProfile.Endpoint = "teo.tencentcloudapi.com" credential := common.NewCredential("SECRETID", "SECRETKEY") client, _ := teo.NewClient(credential, "ap-guangzhou", cpf) request := teo.NewConfirmMultiPathGatewayOriginACLRequest() request.ZoneId = common.StringPtr("zone-27q0p0bal192") request.GatewayId = common.StringPtr("mpgw-lbxuhk1oh") request.OriginACLVersion = common.Int64Ptr(1) response, err := client.ConfirmMultiPathGatewayOriginACL(request) if err != nil { fmt.Printf("Error: %s\n", err) return } fmt.Printf("%s\n", response.ToJsonString()) } ``` -------------------------------- ### Query User Site Information List Source: https://edgeone.ai/zh/document/50481 This example demonstrates how to query site information by providing the exact site name 'example.com' as a filter. Ensure common request parameters are included. ```http POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: DescribeZones { "Filters": [ { "Name": "zone-name", "Values": [ "example.com" ], "Fuzzy": false } ] } ``` -------------------------------- ### Handle GET Requests with Dynamic Route Parameters Source: https://edgeone.ai/zh/document/187317955530207232 This example demonstrates how to handle GET requests and access dynamic route parameters, such as user IDs, within your Edge Function. ```javascript export function onRequestGet(context) { return new Response(`User id is ${context.params.id}`); } ``` -------------------------------- ### Enable QUIC Parameters Source: https://edgeone.ai/zh/document/68152 Example of enabling QUIC with specific parameters. ```json "QUICParameters": { "Switch": "on" } } ] } ] } ``` -------------------------------- ### Complete Edge Functions Configuration Example Source: https://edgeone.ai/zh/document/204988861724463104 This JSON configuration defines routing rules for Edge Functions. It includes examples of source path matching, setting cache control headers, and handling filesystem requests. Use this as a template for your routing setup. ```json { "version": 3, "routes": [ { "src": "^/([^.]+[^/.])$", "dest": "/$1/", "continue": true }, { "src": "/test-ssg", "headers": { "Cache-Control": "max-age=3600" } }, { "src": "/api/cookies-test", "headers": { "Cache-Control": "public, max-age=60, stale-while-revalidate=300" } }, { "handle": "filesystem" }, { "src": "^/about$", "dest": "/about.html" }, { "src": "^/blog/([^/]+)$", "dest": "/blog/$1" }, { "src": "^/api/cookies-test-cache$" }, { "src": "^/api/seconde/query-test$" }, { "src": "^/api/cookies-test$" }, { "src": "^/posts/([^/]+)$" }, { "src": "^/auth$" }, { "src": "^/$" }, { "src": "^/(.*)$" } ] } ``` -------------------------------- ### Python SDK for DescribeIPRegion Source: https://edgeone.ai/zh/document/59030 Example of using the Tencent Cloud SDK for Python to call the DescribeIPRegion API. Ensure you have the SDK installed and configured with your credentials. ```Python from tencentcloud.teo.v20220901 import teo_client from tencentcloud.common import credential from tencentcloud.common.exception import TencentCloudSDKException try: cred = credential.Credential("SECRETID", "SECRETKEY") client = teo_client.TeoClient(cred, "ap-guangzhou") req = teo_client.DescribeIPRegionRequest() req.IPs = ["120.226.17.168", "2402:4e00:1403:eb00:0:9440:b55a:39a8"] resp = client.DescribeIPRegion(req) print(resp.to_json_string()) except TencentCloudSDKException as err: print(err) ``` -------------------------------- ### Enable QUIC for Site Acceleration Source: https://edgeone.ai/zh/document/68147 This example shows how to enable QUIC for all domain names under the site by modifying the global QUIC configuration for site acceleration. ```json POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: ModifyL7AccSetting { "ZoneId": "zone-21xfqlh4qjee", "ZoneConfig": { "QUIC": { "Switch": "on" } } } ``` ```json { "Response": { "RequestId": "5e0a2b4e-df6d-4d2a-ac39-1706cbf8a707" } } ``` -------------------------------- ### Tencent Cloud SDK 3.0 for C++ Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for C++ to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```cpp #include #include "tencentcloud/core/TencentCloud.h" #include "tencentcloud/core/profile/HttpProfile.h" #include "tencentcloud/core/profile/ClientProfile.h" #include "tencentcloud/core/Credential.h" #include "tencentcloud/teo/v20220901/teo_client.h" #include "tencentcloud/teo/v20220901/model/ConfirmOriginACLUpdateRequest.h" #include "tencentcloud/teo/v20220901/model/ConfirmOriginACLUpdateResponse.h" using namespace std; using namespace TencentCloud::Teo::V20220901; using namespace TencentCloud::Teo::V20220901::Model; using namespace TencentCloud::Core; int main() { try { // 实例化一个认证对象,入参需要包含secretId和secretKey,请替换为您的实际值。 Credential cred("SECRETID", "SECRETKEY"); // 实例化一个 http 选项对象,可选,如: HttpProfile httpProfile; // 实例化一个 clientProfile 对象,可选,如: ClientProfile clientProfile; clientProfile.SetHttpProfile(httpProfile); // 实例化要请求产品的client对象,clientProfile是可选的。 TeoClient client(cred, "ap-guangzhou", clientProfile); // 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 ConfirmOriginACLUpdateRequest req; // post请求的例子 string params = R"({ "ZoneId": "zone-276zs184g93m" })"; req.FromJsonString(params); // 通过client对象调用想要调用的接口,需要传入请求对象 ConfirmOriginACLUpdateResponse resp; client.ConfirmOriginACLUpdate(req, resp); // 输出json格式的字符串回包 cout << resp.ToJsonString() << endl; } catch (TencentCloudSDKException &e) { cerr << "Tencent Cloud SDK Exception: " << e.what() << endl; } return 0; } ``` -------------------------------- ### Start Hexo Local Server Source: https://edgeone.ai/zh/document/177813016598880256 Use this command to start a local preview server for your Hexo site. Access the preview at http://localhost:4000. ```bash hexo server ``` -------------------------------- ### Deploy to Preview Environment Source: https://edgeone.ai/zh/document/162228053922476032 Deploy your project to the preview environment using the `deploy` command with the `-e preview` flag. ```bash edgeone pages deploy -e preview ``` -------------------------------- ### Tencent Cloud SDK 3.0 for .NET Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for .NET to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```csharp using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Teo.V20220901; using TencentCloud.Teo.V20220901.Models; namespace TencentCloud.Examples.Teo.V20220901 { class ConfirmOriginACLUpdateExample { public static void Main(string[] args) { try { // 实例化一个认证对象,入参需要包含secretId和secretKey,请替换为您的实际值。 Credential cred = new Credential("SECRETID", "SECRETKEY"); // 实例化一个 clientProfile 对象,可选,如: ClientProfile clientProfile = new ClientProfile(); // 实例化要请求产品的client对象,clientProfile是可选的。 TeoClient client = new TeoClient(cred, "ap-guangzhou", clientProfile); // 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 ConfirmOriginACLUpdateRequest req = new ConfirmOriginACLUpdateRequest(); // post请求的例子 req.ZoneId = "zone-276zs184g93m"; // 通过client对象调用想要调用的接口,需要传入请求对象 ConfirmOriginACLUpdateResponse resp = client.ConfirmOriginACLUpdateSync(req); // 输出json格式的字符串回包 Console.WriteLine(AbstractModel.ToJsonString(resp)); } catch (TencentCloudSDKException e) { Console.WriteLine(e); } } } } ``` -------------------------------- ### Import Site Layer-7 Acceleration Configuration Source: https://edgeone.ai/zh/document/67241 This example shows how to import the entire Layer-7 acceleration configuration for a site. Ensure you have the correct Zone ID and the configuration content in JSON format, UTF-8 encoded. ```bash curl "https://teo.intl.tencentcloudapi.com/" \ -H "Content-Type: application/json" \ -H "Authorization: " \ -X POST \ -d '{ "ZoneId": "zone-m2kplohsdc4b", "Content": "{\"name\":\"zone-m2kplohsdc4b\",\"description\":\"\",\"plan_id\":\"standard\",\"type\":\"full\",\"create_time\":\"2023-01-01T10:00:00Z\",\"update_time\":\"2023-01-01T10:00:00Z\",\"status\":\"enabled\",\"owner\":\"100000000001\",\"resource_id\":\"zone-m2kplohsdc4b\",\"zone_name\":\"example.com\",\"plan_name\":\"standard\",\"alias\":\"\",\"ttl\":300,\"cname_api_domain\":\"example.com.cdn.dnsv1.com\",\"dns_status\":\"active\",\"accelerate_type\":\"global\",\"origin_group_id\":\"\",\"origin_group_name\":\"\",\"origin_group_fallback_origin\":\"\",\"origin_group_fallback_timeout\":30,\"origin_group_fallback_status\":\"off\",\"origin_group_protocol\":\"http\",\"origin_group_host_header\":\"\",\"origin_group_connect_timeout\":5,\"origin_group_idle_timeout\":5,\"origin_group_type\":\"cos\",\"origin_group_list\":[ { \"origin_id\": \"origin-xxxxxx\", \"origin\": \"your-cos-bucket.cos.ap-guangzhou.myqcloud.com\", \"weight\": 100, \"port\": 80, \"enabled\": 1, \"backup_origin\": \"\" } ],\"security_policy_id\":\"\",\"security_policy_name\":\"\",\"security_policy_status\":\"off\",\"security_policy_type\":\"managed\",\"security_policy_rule_list\":[],\"waf_domain_id\":\"\",\"waf_domain_status\":\"off\",\"waf_domain_rule_id\":\"\",\"waf_domain_rule_status\":\"off\",\"waf_domain_rule_type\":\"managed\",\"waf_domain_rule_list\":[],\"rate_limit_id\":\"\",\"rate_limit_name\":\"\",\"rate_limit_status\":\"off\",\"rate_limit_type\":\"managed\",\"rate_limit_rule_list\":[],\"bot_management_id\":\"\",\"bot_management_name\":\"\",\"bot_management_status\":\"off\",\"bot_management_type\":\"managed\",\"bot_management_rule_list\":[],\"ssl_id\":\"\",\"ssl_name\":\"\",\"ssl_status\":\"off\",\"ssl_type\":\"managed\",\"ssl_list\":[],\"http2_status\":\"on\",\"quic_status\":\"off\",\"compression_status\":\"off\",\"compression_type\":\"brotli\",\"compression_list\":[],\"cache_key_id\":\"\",\"cache_key_name\":\"\",\"cache_key_status\":\"off\",\"cache_key_type\":\"managed\",\"cache_key_rule_list\":[],\"cache_rule_id\":\"\",\"cache_rule_name\":\"\",\"cache_rule_status\":\"off\",\"cache_rule_type\":\"managed\",\"cache_rule_list\":[],\"hsts_id\":\"\",\"hsts_name\":\"\",\"hsts_status\":\"off\",\"hsts_type\":\"managed\",\"hsts_rule_list\":[],\"offline_page_id\":\"\",\"offline_page_name\":\"\",\"offline_page_status\":\"off\",\"offline_page_type\":\"managed\",\"offline_page_rule_list\":[],\"domain_status\":\"enabled\",\"domain_alias\":\"\",\"domain_cname\":\"example.com.cdn.dnsv1.com\",\"domain_accelerate_type\":\"global\",\"domain_origin_group_id\":\"\",\"domain_origin_group_name\":\"\",\"domain_origin_group_fallback_origin\":\"\",\"domain_origin_group_fallback_timeout\":30,\"domain_origin_group_fallback_status\":\"off\",\"domain_origin_group_protocol\":\"http\",\"domain_origin_group_host_header\":\"\",\"domain_origin_group_connect_timeout\":5,\"domain_origin_group_idle_timeout\":5,\"domain_origin_group_type\":\"cos\",\"domain_origin_group_list\":[ { \"origin_id\": \"origin-xxxxxx\", \"origin\": \"your-cos-bucket.cos.ap-guangzhou.myqcloud.com\", \"weight\": 100, \"port\": 80, \"enabled\": 1, \"backup_origin\": \"\" } ],\"domain_security_policy_id\":\"\",\"domain_security_policy_name\":\"\",\"domain_security_policy_status\":\"off\",\"domain_security_policy_type\":\"managed\",\"domain_security_policy_rule_list\":[],\"domain_waf_domain_id\":\"\",\"domain_waf_domain_status\":\"off\",\"domain_waf_domain_rule_id\":\"\",\"domain_waf_domain_rule_status\":\"off\",\"domain_waf_domain_rule_type\":\"managed\",\"domain_waf_domain_rule_list\":[],\"domain_rate_limit_id\":\"\",\"domain_rate_limit_name\":\"\",\"domain_rate_limit_status\":\"off\",\"domain_rate_limit_type\":\"managed\",\"domain_rate_limit_rule_list\":[],\"domain_bot_management_id\":\"\",\"domain_bot_management_name\":\"\",\"domain_bot_management_status\":\"off\",\"domain_bot_management_type\":\"managed\",\"domain_bot_management_rule_list\":[],\"domain_ssl_id\":\"\",\"domain_ssl_name\":\"\",\"domain_ssl_status\":\"off\",\"domain_ssl_type\":\"managed\",\"domain_ssl_list\":[],\"domain_http2_status\":\"on\",\"domain_quic_status\":\"off\",\"domain_compression_status\":\"off\",\"domain_compression_type\":\"brotli\",\"domain_compression_list\":[],\"domain_cache_key_id\":\"\",\"domain_cache_key_name\":\"\",\"domain_cache_key_status\":\"off\",\"domain_cache_key_type\":\"managed\",\"domain_cache_key_rule_list\":[],\"domain_cache_rule_id\":\"\",\"domain_cache_rule_name\":\"\",\"domain_cache_rule_status\":\"off\",\"domain_cache_rule_type\":\"managed\",\"domain_cache_rule_list\":[],\"domain_hsts_id\":\"\",\"domain_hsts_name\":\"\",\"domain_hsts_status\":\"off\",\"domain_hsts_type\":\"managed\",\"domain_hsts_rule_list\":[],\"domain_offline_page_id\":\"\",\"domain_offline_page_name\":\"\",\"domain_offline_page_status\":\"off\",\"domain_offline_page_type\":\"managed\",\"domain_offline_page_rule_list\":[] }'"} ``` -------------------------------- ### Tencent Cloud SDK 3.0 for Node.js Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for Node.js to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```javascript const tencentcloud = require("tencentcloud-sdk-nodejs-intl-en"); // Import the client const teo = tencentcloud.teo.v20220901; // Import the client constructor const { Client } = teo; // Import the request model const models = teo.models; async function main() { // 实例化一个认证对象,入参需要包含secretId和secretKey,请替换为您的实际值。 let cred = new tencentcloud.common.Credential("SECRETID", "SECRETKEY"); // 实例化可选择的 clientProfile 对象,如: let clientProfile = new tencentcloud.common.Profile.ClientProfile(); // 实例化要请求产品的client对象,clientProfile是可选的。 let client = new Client(cred, "ap-guangzhou", clientProfile); // 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 let req = new models.ConfirmOriginACLUpdateRequest(); // post请求的例子 let params = { "ZoneId": "zone-276zs184g93m" }; req.from_json_string(JSON.stringify(params)); // 通过client对象调用想要调用的接口,需要传入请求对象 let resp = await client.ConfirmOriginACLUpdate(req); // 输出json格式的字符串回包 console.log(resp); } main().catch(e => { console.error(e); }); ``` -------------------------------- ### Project Structure Example Source: https://edgeone.ai/zh/document/211789991131570176 Illustrates the directory structure for a project using Makers Agent, separating session-mode runtime for LLM/Agent loops and request-mode runtime for non-LLM business logic. ```tree project/ agents/ ← 会话模式 Runtime(LLM / Agent 循环) customer-service/ index.ts → POST /customer-service stop.ts → POST /customer-service/stop cloud-functions/ ← 请求模式 Runtime(非 LLM 业务) conversations/ list.ts → GET /conversations/list (读 store) edgeone.json ← 项目级配置 ``` -------------------------------- ### Tencent Cloud SDK 3.0 for Go Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for Go to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```go package main import ( "fmt" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" ) func main() { // 实例化一个认证对象,入参需要包含secretId和secretKey,请替换为您的实际值。 cred, err := common.NewCredential("SECRETID", "SECRETKEY") if err != nil { panic(err) } // 实例化一个 clientProfile 对象,可选,如: clientProfile, err := profile.NewClientProfile() if err != nil { panic(err) } // 实例化要请求产品的client对象,clientProfile是可选的。 client, err := teo.NewClient(cred, "ap-guangzhou", clientProfile) if err != nil { panic(err) } // 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 req := teo.NewConfirmOriginACLUpdateRequest() // post请求的例子 params := map[string]interface{}{ "ZoneId": "zone-276zs184g93m", } err = req.FromParameterMap(params) if err != nil { panic(err) } // 通过client对象调用想要调用的接口,需要传入请求对象 resp, err := client.ConfirmOriginACLUpdate(req) if err != nil { panic(err) } // 输出json格式的字符串回包 fmt.Printf("%s\n", resp.ToJsonString()) } ``` -------------------------------- ### CreatePlanForZone API Output Example Source: https://edgeone.ai/zh/document/50546 This example shows the expected output structure when successfully creating a plan for a zone using the CreatePlanForZone API. It includes resource names and deal numbers. ```json { "Response": { "RequestId": "a06f52e7-2aab-4510-b2c2-1065bfb4414c", "ResourceNames": [ "plan_sta" ], "DealNames": [ "2022080135400110011001" ] } } ``` -------------------------------- ### Tencent Cloud SDK 3.0 for PHP Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for PHP to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```php setEndpoint("teo.tencentcloudapi.com"); // 实例化一个 clientProfile 对象,可选,如: $clientProfile = new ClientProfile(); $clientProfile->setHttpProfile($httpProfile); // 实例化要请求产品的client对象,clientProfile是可选的。 $client = new TeoClient($cred, "ap-guangzhou", $clientProfile); // 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 $req = new ConfirmOriginACLUpdateRequest(); $params = [ "ZoneId" => "zone-276zs184g93m" ]; $req->fromJsonString(json_encode($params)); // 通过client对象调用想要调用的接口,需要传入请求对象 $resp = $client->ConfirmOriginACLUpdate($req); // 输出json格式的字符串回包 return $resp->toJsonString(); } catch(TencentCloudSDKException $e) { echo $e; } ?> ``` -------------------------------- ### Tencent Cloud SDK 3.0 for Python Source: https://edgeone.ai/zh/document/71119 This is an example of how to use the Tencent Cloud SDK for Python to call the ConfirmOriginACLUpdate API. Ensure you have the SDK installed and configured. ```python from tencentcloud.teo.v20220901.teo_client import TeoClient from tencentcloud.common import credential from tencentcloud.common.exception import TencentCloudSDKException try: # 实例化一个认证对象,入参需要包含secretId和secretKey,请替换为您的实际值。 cred = credential.Credential("SECRETID", "SECRETKEY") # 实例化要请求产品的client对象,clientProfile是可选的。 client = TeoClient(cred, "ap-guangzhou") # 实例化一个请求对象,每个接口都会对应一个থেকেRequest对象 req = ConfirmOriginACLUpdate.ConfirmOriginACLUpdateRequest() # post请求的例子 params = { "ZoneId": "zone-276zs184g93m" } req.from_json_string(json.dumps(params)) # 通过client对象调用想要调用的接口,需要传入请求对象 resp = client.ConfirmOriginACLUpdate(req) # 输出json格式的字符串回包 print(resp.to_json_string()) except TencentCloudSDKException as err: print(err) ``` -------------------------------- ### CI/CD Pipeline Production Deployment Example Source: https://edgeone.ai/zh/document/162228053922476032 Example of deploying to the production environment from a CI/CD pipeline using the `deploy` command with project name and API token. ```bash edgeone pages deploy -n project-name -t $EDGEONE_API_TOKEN ``` -------------------------------- ### Node.js SDK for DeleteL4ProxyRules Source: https://edgeone.ai/zh/document/59025 This Node.js code example shows how to call the DeleteL4ProxyRules API using the Tencent Cloud SDK. Ensure your SDK is installed and authenticated. ```javascript const tencentcloud = require("tencentcloud-sdk-nodejs-intl-en"); // Import SDK Client const teo = tencentcloud.teo.v20220901; // Import client profile and credential const clientConfig = { credential: { secretId: "YOUR_SECRET_ID", secretKey: "YOUR_SECRET_KEY", }, region: "ap-guangzhou", profile: { httpProfile: { endpoint: "teo.intl.tencentcloudapi.com", }, }, }; // Create a client instance const client = new teo.Client(clientConfig); const req = new teo.models.DeleteL4ProxyRulesRequest(); const params = { "ZoneId": "zone-24wjy25v1cwi", "ProxyId": "sid-2qwk27xf7j9g", "RuleIds": [ "rule-2qzkbvx3hxl7", "rule-3pszkbox0hm1" ] }; req.from_json_string(JSON.stringify(params)); client.DeleteL4ProxyRules(req).then( (data) => { console.log(data); }, (err) => { console.error("ERROR:", err); } ); ``` -------------------------------- ### Create a New Project with OpenAI Agents SDK Source: https://edgeone.ai/zh/document/211791724117319680 Quickly create a starter project based on the OpenAI Agents SDK using the EdgeOne CLI. This command sets up a basic Node.js agent template. ```bash edgeone makers create --template openai-agents-starter-node ``` -------------------------------- ### .NET SDK for Tencent Cloud EdgeOne Source: https://edgeone.ai/zh/document/74211 Example of using the Tencent Cloud SDK for .NET to interact with the EdgeOne API. This snippet demonstrates client setup. ```csharp using TencentCloud.Teo.V20220901; using TencentCloud.Teo.V20220901.Models; using TencentCloud.Common; using TencentCloud.Common.Profile; namespace TencentCloudSDKExample.Teo.V20220901 { class ModifyMultiPathGatewayStatusExample { public void MainMethod() { try { // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey Credential cred = new Credential("YOUR_SECRET_ID", "YOUR_SECRET_KEY"); // 实例化 ap-guangzhou 的 client 对象 TeoClient client = new TeoClient(cred, "ap-guangzhou"); // 移动到 SDK 3.0, 推荐使用 ClientProfile 来设置 HttpProfile HttpProfile httpProfile = new HttpProfile(); httpProfile.setEndpoint("teo.tencentcloudapi.com"); ClientProfile clientProfile = new ClientProfile(); clientProfile.setHttpProfile(httpProfile); // 实例化要请求产品 client 的 client 对象,clientProfile是可选的 TeoClient client = new TeoClient(cred, "ap-guangzhou", clientProfile); // 接口请求参数结构体 ModifyMultiPathGatewayStatusRequest req = new ModifyMultiPathGatewayStatusRequest(); req.GatewayId = "eo-gw-lb-uhk1oh"; req.GatewayStatus = "offline"; req.ZoneId = "zone-27q0p0bal192"; // 调用 DescribeZones 接口 ModifyMultiPathGatewayStatusResponse resp = client.ModifyMultiPathGatewayStatus(req); // 输出 JSON 格式的字符串 Console.WriteLine(AbstractModel.ToJsonString(resp)); } catch (TencentCloudSDKException e) { Console.WriteLine(e); } } } } ``` -------------------------------- ### EdgeKVList API Initial Query Input Example Source: https://edgeone.ai/zh/document/78825 This example demonstrates the input for an initial query to list EdgeKV keys with a specific prefix and limit. It shows the necessary HTTP headers and the JSON body containing zone ID, namespace, prefix, and limit. ```HTTP POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: EdgeKVList { "ZoneId": "zone-3j1xw7910arp", "Namespace": "ns-011", "Prefix": "he", "Limit": 1 } ``` -------------------------------- ### PHP SDK for Tencent Cloud EdgeOne Source: https://edgeone.ai/zh/document/74211 Example of using the Tencent Cloud SDK for PHP to interact with the EdgeOne API. This snippet demonstrates client setup. ```php use TencentCloud\Teo\V20220901\TeoClient; use TencentCloud\Teo\V20220901\Models\ModifyMultiPathGatewayStatusRequest; use TencentCloud\Common\Credential\Credential; use TencentCloud\Common\Profile\ClientProfile; use TencentCloud\Common\Profile\HttpProfile; try { // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey $cred = new Credential("YOUR_SECRET_ID", "YOUR_SECRET_KEY"); // 实例化 ap-guangzhou 的 client 对象 $client = new TeoClient($cred, "ap-guangzhou"); // 移动到 SDK 3.0, 推荐使用 ClientProfile 来设置 HttpProfile $httpProfile = new HttpProfile(); $httpProfile->setEndpoint("teo.tencentcloudapi.com"); $clientProfile = new ClientProfile(); $clientProfile->setHttpProfile($httpProfile); // 实例化要请求产品 client 的 client 对象,clientProfile是可选的 $client = new TeoClient($cred, "ap-guangzhou", $clientProfile); // 接口请求参数结构体 $req = new ModifyMultiPathGatewayStatusRequest(); $req->GatewayId = "eo-gw-lb-uhk1oh"; $req->GatewayStatus = "offline"; $req->ZoneId = "zone-27q0p0bal192"; // 调用 DescribeZones 接口 $resp = $client->ModifyMultiPathGatewayStatus($req); print_r(ResponseFormat::toJson($resp)); } catch(TencentCloudSDKException $e) { echo $e; } ``` -------------------------------- ### Verify Site Ownership Output Example Source: https://edgeone.ai/zh/document/50480 This example shows the expected output when verifying site ownership, including DNS record and verification file details. ```JSON { "Response": { "Ascription": { "Subdomain": "edgeonereclaim", "RecordType": "TXT", "RecordValue": "reclaim-a24aba2420cf4ce8b7bff7c8be6d337f" }, "FileAscription": { "IdentifyPath": "/.well-known/teo-verification/vd4ewuqa9n.txt", "IdentifyContent": "88v24mnnljwbhaohrpfx80f63duhdnjx" }, "RequestId": "9kl50bew-89ga-44f4-91ce-78125d53vd2a" } } ``` -------------------------------- ### Python API Request Signing Source: https://edgeone.ai/zh/document/50459 This Python code snippet shows how to sign a Tencent Cloud API request. It requires the 'requests' library to be installed. The example includes functions for generating the string to sign and performing the HMAC-SHA1 signing. Note that this example uses hardcoded credentials and timestamps for demonstration. ```python # -*- coding: utf8 -*- import base64 import hashlib import hmac import time import requests secret_id = "AKID********************************" secret_key = "********************************" def get_string_to_sign(method, endpoint, params): s = method + endpoint + "/?" query_str = "&".join("%s=%s" % (k, params[k]) for k in sorted(params)) return s + query_str def sign_str(key, s, method): hmac_str = hmac.new(key.encode("utf8"), s.encode("utf8"), method).digest() return base64.b64encode(hmac_str) if __name__ == '__main__': endpoint = "cvm.tencentcloudapi.com" data = { 'Action' : 'DescribeInstances', 'InstanceIds.0' : 'ins-09dx96dg', 'Limit' : 20, 'Nonce' : 11886, 'Offset' : 0, 'Region' : 'ap-guangzhou', 'SecretId' : secret_id, 'Timestamp' : 1465185768, # int(time.time()) 'Version': '2017-03-12' } s = get_string_to_sign("GET", endpoint, data) data["Signature"] = sign_str(secret_key, s, hashlib.sha1) print(data["Signature"]) # An actual invocation would occur here, which may incur fees after success # resp = requests.get("https://" + endpoint, params=data) # print(resp.url) ``` -------------------------------- ### Koa.js Basic Application Source: https://edgeone.ai/zh/document/187317588167897088 A basic Koa.js application setup for deployment on EdgeOne Pages. Ensure all dependencies are installed and use `edgeone pages dev` for local testing. ```javascript // ./node-functions/koa/[[default]].js import Koa from 'koa'; import Router from '@koa/router'; const app = new Koa(); const router = new Router(); app.use(async (ctx, next) => { const start = Date.now(); await next(); const ms = Date.now() - start; ctx.set('X-Response-Time', `${ms}ms`); }); router.get('/', async (ctx) => { ctx.body = { message: 'Hello from Koa on Node Functions!' }; }); app.use(router.routes()); app.use(router.allowedMethods()); export default app; ``` -------------------------------- ### Express.js Basic Application Source: https://edgeone.ai/zh/document/187317588167897088 A basic Express.js application setup for deployment on EdgeOne Pages. Ensure all dependencies are installed and use `edgeone pages dev` for local testing. ```javascript // ./node-functions/express/[[default]].js import express from "express"; const app = express(); app.use((req, res, next) => { console.log(`[Log] ${req.method} ${req.url}`); next(); }); app.get("/", (req, res) => { res.json({ message: "Hello from Express on Node Functions!" }); }); export default app; ``` -------------------------------- ### Go Module File Example Source: https://edgeone.ai/zh/document/204373855432982528 Example `go.mod` file specifying the module path, Go version, and required dependencies with their versions. ```go.mod module my-project go 1.26 require ( github.com/gin-gonic/gin v1.10.0 ) ``` -------------------------------- ### Bind Site to Target Plan Source: https://edgeone.ai/zh/document/51733 This example demonstrates how to bind a site to a target plan using a POST request. Ensure common request parameters and the correct content type are included. ```HTTP POST / HTTP/1.1 Host: teo.intl.tencentcloudapi.com Content-Type: application/json X-TC-Action: BindZoneToPlan { "ZoneId": "zone-xxyyyzzz", "PlanId": "edgeone-qqqwwweee" } ```