fix: remove apiversion param from session

This commit is contained in:
QIU Jian
2022-08-25 09:43:50 +08:00
committed by Qiu Jian
parent c6f557fd68
commit 293afd2e69
165 changed files with 381 additions and 487 deletions
+4 -7
View File
@@ -68,9 +68,9 @@ type BaseOptions struct {
OsRegionName string `default:"$OS_REGION_NAME" help:"Defaults to env[OS_REGION_NAME]"`
OsZoneName string `default:"$OS_ZONE_NAME" help:"Defaults to env[OS_ZONE_NAME]"`
OsEndpointType string `default:"$OS_ENDPOINT_TYPE|internalURL" help:"Defaults to env[OS_ENDPOINT_TYPE] or internalURL" choices:"publicURL|internalURL|adminURL"`
ApiVersion string `default:"$API_VERSION" help:"override default modules service api version"`
OutputFormat string `default:"$CLIMC_OUTPUT_FORMAT|table" choices:"table|kv|json|flatten-table|flatten-kv" help:"output format"`
SUBCOMMAND string `help:"climc subcommand" subcommand:"true"`
// ApiVersion string `default:"$API_VERSION" help:"override default modules service api version"`
OutputFormat string `default:"$CLIMC_OUTPUT_FORMAT|table" choices:"table|kv|json|flatten-table|flatten-kv" help:"output format"`
SUBCOMMAND string `help:"climc subcommand" subcommand:"true"`
}
func getSubcommandsParser() (*structarg.ArgumentParser, error) {
@@ -222,16 +222,13 @@ func newClientSession(options *BaseOptions) (*mcclient.ClientSession, error) {
}
}
if options.ApiVersion != "" {
mcclient.DisableApiVersionByModule()
}
session := client.NewSession(
context.Background(),
options.OsRegionName,
options.OsZoneName,
options.OsEndpointType,
cacheToken,
options.ApiVersion)
)
return session, nil
}
+1 -1
View File
@@ -58,7 +58,7 @@ func init() {
svcUrl string
)
if len(opts.Service) > 0 {
svcUrl, err = s.GetServiceURL(opts.Service, "")
svcUrl, err = s.GetServiceURL(opts.Service, "", "")
if err != nil {
return errors.Wrapf(err, "get service %s url", opts.Service)
}
+1 -3
View File
@@ -62,9 +62,7 @@ func init() {
if opts.All {
resSets := sets.NewString()
mods, _ := modulebase.GetRegisterdModules()
for _, ress := range mods {
resSets.Insert(ress...)
}
resSets.Insert(mods...)
resources = resSets.List()
}
if len(resources) == 0 {
+1 -1
View File
@@ -62,7 +62,7 @@ func newClientSession(options *options.CloudMonOptions) (*mcclient.ClientSession
"",
options.EndpointType,
token,
options.ApiVersion)
)
return session, nil
}