Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify tag command line parameter #626

Open
iggyzap opened this issue Feb 23, 2023 · 3 comments
Open

Unable to specify tag command line parameter #626

iggyzap opened this issue Feb 23, 2023 · 3 comments

Comments

@iggyzap
Copy link

iggyzap commented Feb 23, 2023

  • Command Format:
% aliyun --version
Alibaba Cloud Command Line Interface Version 3.0.149
  • Execution Command:
$ aliyun resourcemanager ListTagResources --Tag "[{'foo':'bar'}]"  --endpoint resourcemanager.cn-shenzhen.aliyuncs.com 
  • Output:
ERROR: SDK.ServerError
ErrorCode: InvalidTag; Illegal parameter serialization format. Flat format is required.
Recommend: https://next.api.aliyun.com/troubleshoot?q=InvalidTag; Illegal parameter serialization format. Flat format is required.&product=ResourceManager
RequestId: <edit>
Message: Specified parameter Tag; Illegal parameter serialization format. Flat format is required. is not valid.
RespHeaders: map[Access-Control-Allow-Origin:[*] Connection:[keep-alive] Content-Length:[464] Content-Type:[application/json;charset=utf-8] Date:[Thu, 23 Feb 2023 16:54:22 GMT] X-Acs-Request-Id:[<edit>] X-Acs-Trace-Id:[<edit>]]

I am trying to invoke cli towards endpoint to list all the resources that have specific tag attached, unfortunately I am seeing error message from API.

Could someone help on how to pass tag array to cli ?

@TsinghuaDream
Copy link
Contributor

aliyun resourcemanager ListTagResources --region cn-shanghai --Tag.1.Key 123 --Tag.1.Value 123 --ResourceId.1 123 --version 2020-03-31 --force
There is a CLI command generated in the upper right corner.
https://next.api.aliyun.com/api/ResourceManager/2020-03-31/ListTagResources?params={%22Tag%22:[{%22Key%22:%22123%22,%22Value%22:%22123%22}],%22ResourceId%22:[%22123%22]}

@iggyzap
Copy link
Author

iggyzap commented Mar 1, 2023

Thanks, that worked although I did not get data I would have expected. Also, there is another problem, without --force flag CLI fails parameter validation:

% aliyun resourcemanager ListTagResources --Tag.1.Key purpose --Tag.1.Value migration --endpoint resourcemanager.cn-shenzhen.aliyuncs.com
ERROR: '--Tag.1.Key' is not a valid parameter or flag. See `aliyun help resourcemanager ListTagResources`.

And if I do not specify --endpoint then it fails to recognise region:

% aliyun resourcemanager ListTagResources   --force --secure --region cn-shenzhen 
ERROR: unknown endpoint for resourcemanager/cn-shenzhen! failed unknown endpoint for region cn-shenzhen
  you need to add --endpoint xxx.aliyuncs.com
  LC_Error: [SDK.CanNotResolveEndpoint] Can not resolve endpoint(param = {"Domain":"","Product":"ResourceManager","RegionId":"cn-shenzhen","LocationProduct":"resourcemanager","LocationEndpointType":"openAPI"}), please check your accessKey with secret, and read the user guide
 
caused by:
SDK.ServerError
ErrorCode: InvalidRegionId
Recommend: https://next.api.aliyun.com/troubleshoot?q=InvalidRegionId&product=Location
RequestId: FE9C4719-965C-32E2-A7A4-291EF5E43F3F
Message: The specified region does not exist.
RespHeaders: map[Access-Control-Allow-Origin:[*] Connection:[keep-alive] Content-Length:[258] Content-Type:[application/json;charset=utf-8] Date:[Wed, 01 Mar 2023 09:04:48 GMT] X-Acs-Request-Id:[FE9C4719-965C-32E2-A7A4-291EF5E43F3F] X-Acs-Trace-Id:[20df621eb083c3cc8460f0d317cf9ca8]]

I've installed CLI via brew.

@TsinghuaDream
Copy link
Contributor

Download the latest version directly in Git and decompress it. --force is necessary.
Resource management is centralized deployment, so try it cn-hangzhou or just need add --endpoint xxx.aliyuncs.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants