Endpoint
更新时间:
复制 MD 格式
Endpoint
An endpoint is the network domain name used to make API requests to a service. For example, ecs.cn-hangzhou.aliyuncs.com.
For more information, see the source code.
User-defined
The user-defined method has the highest priority and lets you directly specify an endpoint.
// Takes effect globally.
endpoints.AddEndpointMapping("<RegionID>", "<Product>", "<Endpoint>")
// Takes effect only for the current request.
request := ecs.CreateDescribeRegionsRequest()
request.Domain = "<Endpoint>"
// Takes effect only for the current client.
client, _ := ecs.NewClientWithAccessKey("<RegionID>", "<AccessKeyID>", "<AccessKeySecret>")
client.Domain = "<Endpoint>"2. Endpoint concatenation rule
This resolution logic applies only when you make a request over a VPC or when the product SDK has an endpoint data file. For an example, see the ECS endpoint data file.
// Public network request
client.Network = "public"; // The default value of 'productNetwork' is 'public'. No configuration is required.
// Cross-origin request
client.Network = "share";
// IPv6 request
client.Network = "ipv6";
// Proxy request
client.Network = "proxy";
// Internal request
client.Network = "inner";
// IPv4/IPv6 dual stack
client.Network = "dualstack";
// VPC request
client.Network = "vpc";3. The endpoint is resolved based on the endpoints_config.go data file in the Go SDK core.
4. The endpoint is obtained from the remote server by calling the Location service API. The product SDK must have a ServiceCode.
该文章对您有帮助吗?