Browse Source

fix:update endpoint file

tags/1.60.60
wenzuochao 7 months ago
parent
commit
e4bd607d0a
5 changed files with 3347 additions and 871 deletions
  1. +3325
    -869
      sdk/endpoints/endpoints_config.go
  2. +1
    -1
      sdk/endpoints/endpoints_config_test.go
  3. +1
    -1
      tools/document.md
  4. +20
    -0
      tools/endpoint.go
  5. +0
    -0
      tools/endpoints.json

+ 3325
- 869
sdk/endpoints/endpoints_config.go
File diff suppressed because it is too large
View File


+ 1
- 1
sdk/endpoints/endpoints_config_test.go View File

@@ -13,5 +13,5 @@ func Test_getEndpointConfigData(t *testing.T) {
products := d["products"]
p, ok := products.([]interface{})
assert.True(t, ok)
assert.Equal(t, 46, len(p))
assert.Equal(t, 127, len(p))
}

+ 1
- 1
tools/document.md View File

@@ -12,4 +12,4 @@
### endpoint

1. Convert endpoints from java json to golang file
`go run endpoint parse <javaJsonFilepath> <golangFilePath>`
`go run ./... endpoint parse <javaJsonFilepath> <golangFilePath>`

+ 20
- 0
tools/endpoint.go View File

@@ -73,6 +73,23 @@ func endpointParse(srcpath string) (string, error) {
return "", err
}
realEndpoints := &RealEndpoints{}
for key := range endponit.GlobalEndpoints {
if endponit.DocumentID[key] == "" {
endponit.DocumentID[key] = "sdk"
}
}

for key := range endponit.RegionalEndpointPattern {
if endponit.DocumentID[key] == "" {
endponit.DocumentID[key] = "sdk"
}
}

for key := range endponit.RegionalEndpoints {
if endponit.DocumentID[key] == "" {
endponit.DocumentID[key] = "sdk"
}
}
for key, value := range endponit.DocumentID {
realEndpoint := Product{
Code: key,
@@ -81,6 +98,9 @@ func endpointParse(srcpath string) (string, error) {
GlobalEndpoint: endponit.GlobalEndpoints[key],
RegionalEndpointPattern: endponit.RegionalEndpointPattern[key],
}
if realEndpoint.DocumentID == "sdk" {
realEndpoint.DocumentID = ""
}
for key1, value1 := range endponit.LocationCodeMapping {
if value1 == key {
realEndpoint.Code = key1


+ 0
- 0
tools/endpoints.json View File


Loading…
Cancel
Save