aliyun / alibaba-cloud-sdk-go

Alibaba Cloud SDK for Go
Apache License 2.0
1.15k stars 271 forks source link

endpoint API does not return regional endpoints #577

Open fairclothjm opened 1 year ago

fairclothjm commented 1 year ago

I need to query the API for all the available STS endpoints. However, it seems that the STS endpoints returned by the API do not match what is defined in the documentation.

See:

The STS endpoints_config.go regional_endpoints field is null. So making the following call:

    r := &endpoints.LocalRegionalResolver{}
    endpoint, supported, err := r.TryResolve(&endpoints.ResolveParam{
        Product: "sts",
                 RegionId: "us-east-1",
    })

endpoint will always be the gobal endpoint. But I would expect it to return sts.us-east-1.aliyuncs.com as defined in the documentation.

rfyiamcool commented 1 year ago

+1

TsinghuaDream commented 3 months ago

The latest version will be routed to sts.us-east-1.aliyuncs.com.
client, err := sts.NewClientWithAccessKey("us-east-1", ak, sk)

The reason is that we have set the splicing rules here. https://github.com/aliyun/alibaba-cloud-sdk-go/blob/b1c01de8f0017802b803632faf38868978e8db39/services/sts/endpoint.go#L7