Easily use Alibaba Cloud resource orchestration to facilitate your API management

At the beginning of November, Alibaba Cloud ROS officially released the API Gateway (API Gateway) resource to provide cloud computing users with high-performance and highly available API hosting services, helping users to open up their applications deployed on Alibaba Cloud products such as ECS and container services. Provide complete API release, management, maintenance life cycle management. Users only need to perform simple operations to open data or services quickly, at low cost, and with low risk.

Users only need to define their own API management templates according to their own needs and according to the template specification of ROS, and then they can easily create/update API groups, create/update APIs, release or switch versions of APIs, and authorize APIs , configuration pre-updates for signatures, flow control, etc.

Take the example of creating and publishing a new API to the test environment. First of all, users define their own templates according to the template specification of ROS. The template will contain the following resources. For detailed resource introduction, please refer to the help document,
ALIYUN::ApiGateway::Group,
ALIYUN::ApiGateway::API,
ALIYUN: :ApiGateway::Deployment

一个最简单的模板定义如下:
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Create an API Gateway",
"Parameters": {
"CustomStage": {
"Type": "String",
"Description": "环境",
"AllowedValues": [
"TEST",
"PRE",
"RELEASE"
],
"Label": "环境",
"Default": "TEST"
}
},
"Resources": {
"Group": {
"Type": "ALIYUN::ApiGateway::Group",
"Properties": {
"GroupName": "my_api_group",
"Description": "my api group"
}
},
"Deployment": {
"Type": "ALIYUN::ApiGateway::Deployment",
"Properties": {
"Description": "liyi_test",
"StageName": {
"Ref": "CustomStage"
},
"ApiId": {
"Fn::GetAtt": [
"API",
"ApiId"
]
},
"GroupId": {
"Fn::GetAtt": [
"Group",
"GroupId"
]
}
}
},
"API": {
"Type": "ALIYUN::ApiGateway::Api",
"Properties": {
"RequestConfig": {
"RequestPath": "/my_resource",
"RequestProtocol": "HTTP,HTTPS",
"RequestHttpMethod": "GET",
"PostBodyDescription": "k:v",
"BodyFormat": "FORM"
},
"ResultSample": "my_test sample result",
"ServiceConfig": {
"ServiceAddress": "http://my_url_site",
"MockResult": "Nothing",
"ContentTypeValue": "application/x-www-form-urlencoded; charset=UTF-8",
"ServiceVpcEnable": "FALSE",
"ServiceTimeOut": 20000,
"ServiceProtocol": "HTTP",
"ServicePath": "/my_data",
"ServiceHttpMethod": "GET",
"ContentTypeCatagory": "DEFAULT",
"Mock": "FALSE"
},
"ApiName": "my_test_first_api",
"Visibility": "PRIVATE",
"AuthType": "APP",
"ResultType": "JSON",
"FailResultSample": "my_test faile sample result",
"GroupId": {
"Fn::GetAtt": [
"Group",
"GroupId"
]
}
}
}
},
"Outputs": {
"APIId": {
"Value": {
"Fn::GetAtt": [
"API",
"ApiId"
]
}
},
"GroupId": {
"Value": {
"Fn::GetAtt": [
"Group",
"GroupId"
]
}
}
}
}

Then submit your template on the ROS console (ros.console.aliyun.com):
Enter the ROS console as shown in the figure below, and then click the "New Resource Stack" button.
2

Then the new page will be displayed as follows, you need to select the region in the new page, fill in the template provided above, and then click "Next".
3

Then you will switch to this page, you need to belong to some parameter information when you create it, the name of the resource stack, and which environment you need to publish the API in. After the parameters are set, click the "Create" button.
4

The ROS orchestration engine will create API groups and APIs based on the template and parameter information, and finally publish them to the test environment. Return to the resource stack management page, you can see the following information, the resource stack named "my_api_v1" was created successfully.
5

Click the resource stack name to view the related properties of the resource stack. The ID of the API group and the ID of the API to output are defined in our template above.
6

Jump to the console of the API Gateway, and you can see the API we created through the template.
7

The above is to create and publish the API through the ROS console.

ROS 当前支持的所有 API 网关的资源类型如下:
ALIYUN::ApiGateway::Group
https://help.aliyun.com/document_detail/61467.html?spm=5176.doc61480.6.650.0oTm2p
创建 API 分组
ALIYUN::ApiGateway::StageConfig::SignatureBinding
https://help.aliyun.com/document_detail/61483.html?spm=5176.doc61482.6.652.43jUI8
创建 API 分组中测试、预发、线上环境变量
ALIYUN::ApiGateway::Api
https://help.aliyun.com/document_detail/61459.html?spm=5176.doc28930.6.645.VIyhF4
创建 API
ALIYUN::ApiGateway::App
https://help.aliyun.com/document_detail/61468.html?spm=5176.doc61459.6.646.jep7UM
创建应用
ALIYUN::ApiGateway::Authorization
https://help.aliyun.com/document_detail/61478.html?spm=5176.doc61468.6.647.wFQfvi
给 API 授权应用的访问权限
ALIYUN::ApiGateway::CustomDomain
https://help.aliyun.com/document_detail/61479.html?spm=5176.doc61478.6.648.O62moc
给 API 分组创建绑定自定义域名
ALIYUN::ApiGateway::Deployment
https://help.aliyun.com/document_detail/61480.html?spm=5176.doc61479.6.649.s0Ltp0
发布 API 或快速切换 API 版
ALIYUN::ApiGateway::Signature
https://help.aliyun.com/document_detail/61482.html?spm=5176.doc61467.6.651.JHTCZz
创建后端签名密钥
ALIYUN::ApiGateway::SignatureBinding
https://help.aliyun.com/document_detail/61483.html?spm=5176.doc61482.6.652.43jUI8
绑定 API 与后端签名密钥
ALIYUN::ApiGateway::TrafficControl
https://help.aliyun.com/document_detail/61485.html?spm=5176.doc61484.6.654.u6Ymvw
创建用户自定义的流控策略
ALIYUN::ApiGateway::TrafficControlBinding
https://help.aliyun.com/document_detail/61488.html?spm=5176.doc61485.6.655.cz94Ob
给 API 绑定用户自定义流控
ALIYUN::ApiGateway::VpcAccessConfig
https://help.aliyun.com/document_detail/61489.html?spm=5176.doc61488.6.656.KXYFQT
配置 VPC 授权以便专有网络的 API 能对外提供服务

ROS也支持openAPI的方式做资源的操作,具体可以参考ROS云栖博客索引
https://yq.aliyun.com/articles/57553?spm=5176.100239.0.0.LzywAe
中的这两篇文章,
1、《阿里云资源编排服务Python SDK使用入门 》
https://yq.aliyun.com/articles/6904?spm=5176.100239.blogcont57553.66.N4yGwL
2、《阿里云资源编排服务Java SDK使用入门》
https://yq.aliyun.com/articles/113503?spm=5176.100239.blogcont57553.67.N4yGwL

同时用户也可以通过ROS的命令行
https://yq.aliyun.com/articles/215216?spm=5176.100239.blogcont57553.72.N4yGwL
工具创建实现资源的创建,更新等等操作。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326311281&siteId=291194637