chore: move '/internal/pkg' to '/pkg'

This commit is contained in:
Fu Diwei
2025-06-17 15:54:21 +08:00
parent 30840bbba5
commit 205275b52d
611 changed files with 693 additions and 693 deletions

47
pkg/sdk3rd/azure/env/config.go vendored Normal file
View File

@@ -0,0 +1,47 @@
package env
import (
"fmt"
"strings"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
)
func IsPublicEnv(env string) bool {
switch strings.ToLower(env) {
case "", "default", "public", "azurecloud":
return true
default:
return false
}
}
func IsUSGovernmentEnv(env string) bool {
switch strings.ToLower(env) {
case "usgovernment", "government", "azureusgovernment", "azuregovernment":
return true
default:
return false
}
}
func IsChinaEnv(env string) bool {
switch strings.ToLower(env) {
case "china", "chinacloud", "azurechina", "azurechinacloud":
return true
default:
return false
}
}
func GetCloudEnvConfiguration(env string) (cloud.Configuration, error) {
if IsPublicEnv(env) {
return cloud.AzurePublic, nil
} else if IsUSGovernmentEnv(env) {
return cloud.AzureGovernment, nil
} else if IsChinaEnv(env) {
return cloud.AzureChina, nil
}
return cloud.Configuration{}, fmt.Errorf("unknown azure cloud environment %s", env)
}