mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(climc): fix proxy for cli
This commit is contained in:
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/aliyun"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/aliyun/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -85,12 +90,27 @@ func newClient(options *BaseOptions) (*aliyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := aliyun.NewAliyunClient(
|
||||
aliyun.NewAliyunClientConfig(
|
||||
options.CloudEnv,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+20
-1
@@ -16,8 +16,12 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
@@ -87,13 +91,28 @@ func newClient(options *BaseOptions) (*apsara.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := apsara.NewApsaraClient(
|
||||
apsara.NewApsaraClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.Endpoint,
|
||||
options.SApsaraEndpoints,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,11 +16,16 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/aws"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/aws/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -87,13 +92,28 @@ func newClient(options *BaseOptions) (*aws.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := aws.NewAwsClient(
|
||||
aws.NewAwsClientConfig(
|
||||
options.AccessUrl,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.AccountId,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/azure"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/azure/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
@@ -100,6 +105,16 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Cloud Environment")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := azure.NewAzureClient(
|
||||
azure.NewAzureClientConfig(
|
||||
options.CloudEnv,
|
||||
@@ -108,7 +123,12 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
|
||||
options.ApplicationKey,
|
||||
).
|
||||
SubscriptionId(options.SubscriptionID).
|
||||
Debug(options.Debug),
|
||||
Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/cloudpods"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/cloudpods/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -88,12 +93,27 @@ func newClient(options *BaseOptions) (*cloudpods.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing access secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := cloudpods.NewCloudpodsClient(
|
||||
cloudpods.NewCloudpodsClientConfig(
|
||||
options.AuthURL,
|
||||
options.AccessKey,
|
||||
options.AccessSecret,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/ctyun"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/ctyun/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -84,10 +89,25 @@ func newClient(options *BaseOptions) (*ctyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := ctyun.NewSCtyunClient(
|
||||
ctyun.NewSCtyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/ecloud"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/ecloud/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -84,10 +89,25 @@ func newClient(options *Options) (*ecloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing access secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := ecloud.NewEcloudClient(
|
||||
ecloud.NewEcloudClientConfig(
|
||||
ecloud.NewRamRoleSigner(options.AccessKey, options.AccessSecret),
|
||||
).SetDebug(options.Debug),
|
||||
).SetDebug(options.Debug).
|
||||
SetCloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/esxi"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/esxi/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -88,13 +93,28 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
|
||||
return nil, fmt.Errorf("Missing password")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
return esxi.NewESXiClient2(
|
||||
esxi.NewESXiClientConfig(
|
||||
options.Host,
|
||||
options.Port,
|
||||
options.Account,
|
||||
options.Password,
|
||||
),
|
||||
).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+21
-1
@@ -16,13 +16,18 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/google"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/google/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
@@ -112,13 +117,28 @@ func newClient(options *BaseOptions) (*google.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing ProjectID")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := google.NewGoogleClient(
|
||||
google.NewGoogleClientConfig(
|
||||
options.ProjectID,
|
||||
options.ClientEmail,
|
||||
options.PrivateKeyID,
|
||||
options.PrivateKey,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+20
-1
@@ -16,8 +16,12 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
@@ -87,13 +91,28 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := huawei.NewHuaweiClient(
|
||||
huawei.NewHuaweiClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
&options.SHCSOEndpoints,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/huawei"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/huawei/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -86,13 +91,28 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := huawei.NewHuaweiClient(
|
||||
huawei.NewHuaweiClientConfig(
|
||||
options.CloudEnv,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+20
-1
@@ -16,13 +16,17 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/jdcloud"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/jdcloud/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -89,7 +93,22 @@ func newClient(options *Options) (*jdcloud.SRegion, error) {
|
||||
if regionId == "" {
|
||||
regionId = jdcloud.JDCLOUD_DEFAULT_REGION
|
||||
}
|
||||
region := jdcloud.NewRegion(regionId, options.AccessKey, options.AccessSecret, nil, options.Debug)
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cfcg := &cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
}
|
||||
|
||||
region := jdcloud.NewRegion(regionId, options.AccessKey, options.AccessSecret, cfcg, options.Debug)
|
||||
if region == nil {
|
||||
return nil, fmt.Errorf("no such region %s", regionId)
|
||||
}
|
||||
|
||||
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/openstack"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/openstack/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -93,6 +98,16 @@ func newClient(options *BaseOptions) (*openstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := openstack.NewOpenStackClient(
|
||||
openstack.NewOpenstackClientConfig(
|
||||
options.AuthURL,
|
||||
@@ -103,7 +118,12 @@ func newClient(options *BaseOptions) (*openstack.SRegion, error) {
|
||||
).
|
||||
EndpointType(options.EndpointType).
|
||||
DomainName(options.DomainName).
|
||||
Debug(options.Debug),
|
||||
Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+22
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/qcloud"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/qcloud/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -85,11 +90,27 @@ func newClient(options *BaseOptions) (*qcloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing SecretID")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
if cli, err := qcloud.NewQcloudClient(
|
||||
qcloud.NewQcloudClientConfig(
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
).AppId(options.AppID).Debug(options.Debug),
|
||||
).AppId(options.AppID).
|
||||
Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
} else if region := cli.GetRegion(options.RegionId); region == nil {
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/ucloud"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/ucloud/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -86,11 +91,26 @@ func newClient(options *BaseOptions) (*ucloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := ucloud.NewUcloudClient(
|
||||
ucloud.NewUcloudClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).ProjectId(options.ProjectId).Debug(options.Debug),
|
||||
).ProjectId(options.ProjectId).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+21
-1
@@ -16,10 +16,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"golang.org/x/net/http/httpproxy"
|
||||
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/zstack"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/zstack/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
@@ -89,12 +94,27 @@ func newClient(options *BaseOptions) (*zstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cfg := &httpproxy.Config{
|
||||
HTTPProxy: os.Getenv("HTTP_PROXY"),
|
||||
HTTPSProxy: os.Getenv("HTTPS_PROXY"),
|
||||
NoProxy: os.Getenv("NO_PROXY"),
|
||||
}
|
||||
cfgProxyFunc := cfg.ProxyFunc()
|
||||
proxyFunc := func(req *http.Request) (*url.URL, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cli, err := zstack.NewZStackClient(
|
||||
zstack.NewZstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
).Debug(options.Debug),
|
||||
).Debug(options.Debug).
|
||||
CloudproviderConfig(
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user