本文为您介绍如何通过阿里云CLI(3.0.25及以上版本)调用资源相关的API。
GetResourceType
查询资源类型的详细信息。
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
--ResourceType | String | 是 | ALIYUN::ROS::WaitConditionHandle |
资源类型。 |
请求示例
aliyun ros GetResourceType --ResourceType ALIYUN::ECS::VPC
正常返回示例
{
"Attributes": {
"RouteTableId": {
"Description": "The router table id of created VPC."
},
"VRouterId": {
"Description": "Router id of created VPC."
},
"VpcId": {
"Description": "Id of created VPC."
}
},
"ResourceType": "ALIYUN::ECS::VPC",
"RequestId": "8A897F64-6A61-446A-A913-30CA572EE181",
"Properties": {
"CidrBlock": {
"Required": false,
"Description": "The IP address range of the VPC in the CIDR block form. You can use the following IP address ranges and their subnets:\n10.0.0.0/8\n172.16.0.0/12 (Default)\n192.168.0.0/16",
"Immutable": true,
"Type": "string",
"Constraints": [
{
"CustomConstraint": "vpc.cidr"
}
],
"UpdateAllowed": false
},
"VpcName": {
"Required": false,
"Description": "Display name of the vpc instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'",
"Immutable": false,
"Type": "string",
"Constraints": [
{
"CustomConstraint": "ecs.name"
}
],
"UpdateAllowed": false
},
"Description": {
"Required": false,
"Description": "Description of the vpc, [2, 256] characters. Do not fill or empty, the default is empty.",
"Immutable": false,
"Type": "string",
"Constraints": [
{
"CustomConstraint": "ecs.description"
}
],
"UpdateAllowed": false
},
"ResourceGroupId": {
"Description": "Resource group id.",
"Required": false,
"Immutable": false,
"Type": "string",
"UpdateAllowed": false
}
}
}
GetResourceTypeTemplate
根据资源类型查询该资源的模板。
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
--ResourceType | String | 是 | ALIYUN::ECS::VPC |
资源类型。 |
请求示例
aliyun ros GetResourceTypeTemplate --ResourceType ALIYUN::ECS::VPC
正常返回示例
{
"TemplateBody": {
"Outputs": {
"RouteTableId": {
"Value": {
"Fn::GetAtt": [
"Vpc",
"RouteTableId"
]
},
"Description": "The router table id of created VPC."
},
"VRouterId": {
"Value": {
"Fn::GetAtt": [
"Vpc",
"VRouterId"
]
},
"Description": "Router id of created VPC."
},
"VpcId": {
"Value": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
},
"Description": "Id of created VPC."
}
},
"Parameters": {
"CidrBlock": {
"Description": "The IP address range of the VPC in the CIDR block form. You can use the following IP address ranges and their subnets:\n10.0.0.0/8\n172.16.0.0/12 (Default)\n192.168.0.0/16",
"Type": "String"
},
"VpcName": {
"Description": "Display name of the vpc instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'",
"Type": "String"
},
"Description": {
"Description": "Description of the vpc, [2, 256] characters. Do not fill or empty, the default is empty.",
"Type": "String"
},
"ResourceGroupId": {
"Description": "Resource group id.",
"Type": "String"
}
},
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "CidrBlock"
},
"VpcName": {
"Ref": "VpcName"
},
"Description": {
"Ref": "Description"
},
"ResourceGroupId": {
"Ref": "ResourceGroupId"
}
}
}
}
},
"RequestId": "F79C5749-A43E-4915-9FF1-60BD760E822B"
}
GetStackResource
查询某个资源栈的资源列表。
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
--RegionId | String | 是 | cn-hangzhou |
资源栈所属的地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
--StackId | String | 是 | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
资源栈ID。 |
--LogicalResourceId | String | 是 | WebServer |
资源逻辑ID,模板定义的名称。 |
--ShowResourceAttributes | Boolean | 否 | true |
是否查询资源属性(输出)。 |
--ClientToken | String | 否 | 123e4567-e89b-12d3-a456-42665544**** |
保证请求的幂等性。 该值由客户端生成,并且必须是全局唯一的。 仅允许使用字母数字字符(区分大小写),连字符和下划线。 它最多可包含64个字符。更多详情,请参见如何保证幂等性。 |
请求示例
aliyun ros GetStackResource --RegionId cn-beijing --StackId bd98e636-68e9-4632-82df-ce2aba56**** --LogicalResourceId Test-VPC
正常返回示例
{
"LogicalResourceId": "Test-VPC",
"Description": "",
"StackId": "bd98e636-68e9-4632-82df-ce2aba56****",
"UpdateTime": "2019-09-04T13:22:54",
"StackName": "CLI-Test-VPC",
"StatusReason": "state changed",
"Status": "CREATE_COMPLETE",
"PhysicalResourceId": "vpc-2ze4leztt48nn5u3o****",
"ResourceType": "ALIYUN::ECS::VPC",
"RequestId": "686DC916-FF92-42E1-A9CA-63B811ACDF88",
"CreateTime": "2019-09-04T13:22:51",
"Metadata": {}
}
ListStackResources
查询某个资源栈的资源列表。
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
--RegionId | String | 是 | cn-hangzhou |
资源栈所属的地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
--StackId | String | 是 | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
资源栈ID。 |
请求示例
aliyun ros ListStackResources --RegionId cn-beijing --StackId bd98e636-68e9-4632-82df-ce2aba56****
正常返回示例
{
"RequestId": "F6D7A5E4-E557-4A8D-A2EF-96036E22BD77",
"Resources": [
{
"StatusReason": "state changed",
"Status": "CREATE_COMPLETE",
"PhysicalResourceId": "vpc-2ze4leztt48nn5u3o****",
"LogicalResourceId": "MyVPC",
"ResourceType": "ALIYUN::ECS::VPC",
"StackId": "bd98e636-68e9-4632-82df-ce2aba56****",
"CreateTime": "2019-09-04T13:22:51",
"UpdateTime": "2019-09-04T13:22:54",
"StackName": "CLI-Test-VPC"
}
]
}
ListResourceTypes
查询支持的资源类型列表。
请求示例
aliyun ros ListResourceTypes
正常返回示例
{
"RequestId": "E78F6F42-209A-4F60-89AF-BC0BCEB3DDA5",
"ResourceTypes": [
"ALIYUN::ACTIONTRAIL::Trail",
"ALIYUN::ACTIONTRAIL::TrailLogging",
"ALIYUN::ApiGateway::Api",
"ALIYUN::ApiGateway::App",
"ALIYUN::ApiGateway::Authorization",
"ALIYUN::ApiGateway::CustomDomain",
"ALIYUN::ApiGateway::Deployment",
"ALIYUN::ApiGateway::Group",
"ALIYUN::ApiGateway::Signature",
"ALIYUN::ApiGateway::SignatureBinding",
"ALIYUN::ApiGateway::StageConfig",
"ALIYUN::ApiGateway::TrafficControl",
"ALIYUN::ApiGateway::TrafficControlBinding",
"ALIYUN::ApiGateway::VpcAccessConfig",
"ALIYUN::BSS::WaitOrder",
"ALIYUN::CAS::Certificate",
"ALIYUN::CDN::Domain",
"ALIYUN::CDN::DomainConfig",
"ALIYUN::CEN::CenBandwidthLimit",
"ALIYUN::CEN::CenBandwidthPackage",
"ALIYUN::CEN::CenBandwidthPackageAssociation",
"ALIYUN::CEN::CenInstance",
"ALIYUN::CEN::CenInstanceAttachment",
"ALIYUN::CEN::RouteEntry",
"ALIYUN::CMS::MonitorGroup",
"ALIYUN::CR::Namespace",
"ALIYUN::CR::Repository",
"ALIYUN::CS::App",
"ALIYUN::CS::Cluster",
"ALIYUN::DNS::Domain",
"ALIYUN::DNS::DomainGroup",
"ALIYUN::DNS::DomainRecord",
"ALIYUN::DRDS::DrdsInstance",
"ALIYUN::ECI::ContainerGroup",
"ALIYUN::ECS::AutoSnapshotPolicy",
"ALIYUN::ECS::BandwidthPackage",
"ALIYUN::ECS::Command",
"ALIYUN::ECS::CopyImage",
"ALIYUN::ECS::CustomImage",
"ALIYUN::ECS::DedicatedHost",
"ALIYUN::ECS::DeploymentSet",
"ALIYUN::ECS::Disk",
"ALIYUN::ECS::DiskAttachment",
"ALIYUN::ECS::ForwardEntry",
"ALIYUN::ECS::Instance",
"ALIYUN::ECS::InstanceClone",
"ALIYUN::ECS::InstanceGroup",
"ALIYUN::ECS::InstanceGroupClone",
"ALIYUN::ECS::Invocation",
"ALIYUN::ECS::JoinSecurityGroup",
"ALIYUN::ECS::LaunchTemplate",
"ALIYUN::ECS::NatGateway",
"ALIYUN::ECS::NetworkInterface",
"ALIYUN::ECS::NetworkInterfaceAttachment",
"ALIYUN::ECS::NetworkInterfacePermission",
"ALIYUN::ECS::PrepayInstance",
"ALIYUN::ECS::PrepayInstanceGroupClone",
"ALIYUN::ECS::Route",
"ALIYUN::ECS::SNatEntry",
"ALIYUN::ECS::SSHKeyPair",
"ALIYUN::ECS::SSHKeyPairAttachment",
"ALIYUN::ECS::SecurityGroup",
"ALIYUN::ECS::SecurityGroupClone",
"ALIYUN::ECS::SecurityGroupEgress",
"ALIYUN::ECS::SecurityGroupIngress",
"ALIYUN::ECS::Snapshot",
"ALIYUN::ECS::VPC",
"ALIYUN::ECS::VSwitch",
"ALIYUN::EMR::Cluster",
"ALIYUN::ESS::AlarmTask",
"ALIYUN::ESS::AlarmTaskEnable",
"ALIYUN::ESS::LifecycleHook",
"ALIYUN::ESS::ScalingConfiguration",
"ALIYUN::ESS::ScalingGroup",
"ALIYUN::ESS::ScalingGroupEnable",
"ALIYUN::ESS::ScalingRule",
"ALIYUN::ESS::ScheduledTask",
"ALIYUN::ElasticSearch::Instance",
"ALIYUN::FC::CustomDomain",
"ALIYUN::FC::Function",
"ALIYUN::FC::FunctionInvoker",
"ALIYUN::FC::Service",
"ALIYUN::FC::Trigger",
"ALIYUN::FNF::Flow",
"ALIYUN::KMS::Alias",
"ALIYUN::KMS::Key",
"ALIYUN::MEMCACHE::Instance",
"ALIYUN::MNS::Queue",
"ALIYUN::MNS::Subscription",
"ALIYUN::MNS::Topic",
"ALIYUN::MONGODB::Instance",
"ALIYUN::MarketPlace::Image",
"ALIYUN::MarketPlace::Order",
"ALIYUN::NAS::AccessGroup",
"ALIYUN::NAS::AccessRule",
"ALIYUN::NAS::FileSystem",
"ALIYUN::NAS::MountTarget",
"ALIYUN::OSS::Bucket",
"ALIYUN::OTS::Instance",
"ALIYUN::OTS::VpcBinder",
"ALIYUN::PVTZ::Zone",
"ALIYUN::PVTZ::ZoneRecord",
"ALIYUN::PVTZ::ZoneVpcBinder",
"ALIYUN::RAM::AccessKey",
"ALIYUN::RAM::AttachPolicyToRole",
"ALIYUN::RAM::Group",
"ALIYUN::RAM::ManagedPolicy",
"ALIYUN::RAM::Role",
"ALIYUN::RAM::User",
"ALIYUN::RAM::UserToGroupAddition",
"ALIYUN::RDS::Account",
"ALIYUN::RDS::AccountPrivilege",
"ALIYUN::RDS::DBInstance",
"ALIYUN::RDS::DBInstanceParameterGroup",
"ALIYUN::RDS::DBInstanceSecurityIps",
"ALIYUN::RDS::PrepayDBInstance",
"ALIYUN::REDIS::Instance",
"ALIYUN::REDIS::PrepayInstance",
"ALIYUN::ROS::Stack",
"ALIYUN::ROS::WaitCondition",
"ALIYUN::ROS::WaitConditionHandle",
"ALIYUN::SAG::ACL",
"ALIYUN::SAG::ACLAssociation",
"ALIYUN::SAG::ACLRule",
"ALIYUN::SAG::CloudConnectNetwork",
"ALIYUN::SAG::SmartAccessGatewayBinding",
"ALIYUN::SLB::AccessControl",
"ALIYUN::SLB::BackendServerAttachment",
"ALIYUN::SLB::BackendServerToVServerGroupAddition",
"ALIYUN::SLB::Certificate",
"ALIYUN::SLB::DomainExtension",
"ALIYUN::SLB::Listener",
"ALIYUN::SLB::LoadBalancer",
"ALIYUN::SLB::LoadBalancerClone",
"ALIYUN::SLB::MasterSlaveServerGroup",
"ALIYUN::SLB::Rule",
"ALIYUN::SLB::VServerGroup",
"ALIYUN::SLS::ApplyConfigToMachineGroup",
"ALIYUN::SLS::MachineGroup",
"ALIYUN::UIS::Uis",
"ALIYUN::UIS::UisConnection",
"ALIYUN::UIS::UisNode",
"ALIYUN::VPC::CustomerGateway",
"ALIYUN::VPC::EIP",
"ALIYUN::VPC::EIPAssociation",
"ALIYUN::VPC::PeeringRouterInterfaceBinding",
"ALIYUN::VPC::PeeringRouterInterfaceConnection",
"ALIYUN::VPC::RouterInterface",
"ALIYUN::VPC::SnatEntry",
"ALIYUN::VPC::SslVpnClientCert",
"ALIYUN::VPC::SslVpnServer",
"ALIYUN::VPC::VpnConnection",
"ALIYUN::VPC::VpnGateway"
]
}