本文为您介绍如何通过阿里云CLI(3.0.25以下版本)调用其它的API。

DescribeRegions

查询所有的区域。

调用示例

aliyun ros GET /regions

成功示例

$ aliyun ros GET /regions

{
    "Regions": [
        {
            "LocalName": "华北 1",
            "RegionId": "cn-qingdao"
        },
        {
            "LocalName": "华北 2",
            "RegionId": "cn-beijing"
        },
        {
            "LocalName": "华北 3",
            "RegionId": "cn-zhangjiakou"
        },
        {
            "LocalName": "华北 5",
            "RegionId": "cn-huhehaote"
        },
        {
            "LocalName": "华东 1",
            "RegionId": "cn-hangzhou"
        },
        {
            "LocalName": "华东 2",
            "RegionId": "cn-shanghai"
        },
        {
            "LocalName": "华南 1",
            "RegionId": "cn-shenzhen"
        },
        {
            "LocalName": "西南1(成都)",
            "RegionId": "cn-chengdu"
        },
        {
            "LocalName": "中国香港",
            "RegionId": "cn-hongkong"
        },
        {
            "LocalName": "亚太东北 1 (东京)",
            "RegionId": "ap-northeast-1"
        },
        {
            "LocalName": "亚太东南 1 (新加坡)",
            "RegionId": "ap-southeast-1"
        },
        {
            "LocalName": "亚太东南 2 (悉尼)",
            "RegionId": "ap-southeast-2"
        },
        {
            "LocalName": "亚太东南 3 (吉隆坡)",
            "RegionId": "ap-southeast-3"
        },
        {
            "LocalName": "亚太东南 5 (雅加达)",
            "RegionId": "ap-southeast-5"
        },
        {
            "LocalName": "亚太南部 1 (孟买)",
            "RegionId": "ap-south-1"
        },
        {
            "LocalName": "美国东部 1 (弗吉尼亚)",
            "RegionId": "us-east-1"
        },
        {
            "LocalName": "美国西部 1 (硅谷)",
            "RegionId": "us-west-1"
        },
        {
            "LocalName": "英国 (伦敦)",
            "RegionId": "eu-west-1"
        },
        {
            "LocalName": "中东东部 1 (迪拜)",
            "RegionId": "me-east-1"
        },
        {
            "LocalName": "欧洲中部 1 (法兰克福)",
            "RegionId": "eu-central-1"
        }
    ]
}

DescribeEvents

查询资源栈事件信息。

命令 功能 备注
--StackName 指定资源栈的名称 必选
--StackId 指定资源栈的ID 必选
--PageNumber 事件列表的页码 可选。起始值为1,默认值为1。
--PageSize 分页查询时设置的每页行数 可选。最大值为100行,默认值为10。
--ResourceName 资源名称 可选
--ResourceStatus 资源状态 可选。可选值为:COMPLETE、FAILED和IN_PROGRESS。
--ResourceType 资源类型 可选

调用示例

aliyun ros GET /stacks/[StackName]/[StackId]/events

成功示例

$ aliyun ros GET /stacks/ros_test_cli_stack_name/***-**-**-**-***/events

{
  "TotalCount": 4,
  "PageNumber": 1,
  "Events": [
    {
      "Status": "CREATE_COMPLETE",
      "ResourceType": "ALIYUN::ROS::Stack",
      "ResourceId": "ros_test_cli_stack_name",
      "StatusReason": "Stack CREATE completed successfully",
      "Time": "2019-07-20T10:28:24",
      "ResourceName": "ros_test_cli_stack_name",
      "Id": "***-**-**-**-***",
      "ResourcePhysicalId": "***-**-**-**-***"
    },
    {
      "Status": "CREATE_COMPLETE",
      "ResourceType": "ALIYUN::VPC::EIP",
      "ResourceId": "Eip",
      "StatusReason": "state changed",
      "Time": "2019-07-20T10:28:24",
      "ResourceName": "Eip",
      "Id": "***-**-**-**-***",
      "ResourcePhysicalId": "eip-***"
    },
    {
      "Status": "CREATE_IN_PROGRESS",
      "ResourceType": "ALIYUN::VPC::EIP",
      "ResourceId": "Eip",
      "StatusReason": "state changed",
      "Time": "2019-07-20T10:28:22",
      "ResourceName": "Eip",
      "Id": "***-**-**-**-***",
      "ResourcePhysicalId": null
    },
    {
      "Status": "CREATE_IN_PROGRESS",
      "ResourceType": "ALIYUN::ROS::Stack",
      "ResourceId": "ros_test_cli_stack_name",
      "StatusReason": "Stack CREATE started",
      "Time": "2019-07-20T10:28:22",
      "ResourceName": "ros_test_cli_stack_name",
      "Id": "***-**-**-**-***",
      "ResourcePhysicalId": "***-**-**-**-***"
    }
  ],
  "PageSize": 10
}