denverdino / aliyungo Goto Github PK
View Code? Open in Web Editor NEWGo SDK for Aliyun (Alibaba Cloud) - Golang API for ECS, OSS, DNS, SLB, RDS, RAM, MNS, STS, SLS, MQ, Push, OpenSearch, DM, Container Service etc.
License: Apache License 2.0
Go SDK for Aliyun (Alibaba Cloud) - Golang API for ECS, OSS, DNS, SLB, RDS, RAM, MNS, STS, SLS, MQ, Push, OpenSearch, DM, Container Service etc.
License: Apache License 2.0
http://docs.aliyun.com/?spm=5176.100054.3.1.1uupTM#/pub/ecs/open-api/instance&createinstance
实例的密码。8 - 30 个字符,同时包含大小写字母和数字,不支持特殊符号。
I intend to package this in Debian[1]. But I can't run this package's tests since the build env can't access network and we don't have aliyun's ACCESS_KEY_ID.
For now, I just disabled tests during packaging. But it's not good for package's quality. Please consider provide tests that don't need network and ACCESS_KEY_ID.
HI,
Aliyun just released support for new regions: Japan, Germany, Dubai & Australia. Can these be added to the library.
On a side note, I tried to find the region ids for Aliyun. I could not find it from there api docs. Do you mind showing how to figure this out?
Thanks.
Currently, the build project is in https://drone.io/github.com/denverdino/aliyungo
According to this https://help.aliyun.com/document_detail/25687.html, instance status has some changes. Creating
has become Pending
and there is also a new one called Deleted
.
Also, according to this https://help.aliyun.com/document_detail/25503.html, there is an added field UserData
in ModifyInstanceAttributeArg
.
I saw document (https://help.aliyun.com/document_detail/25489.html?spm=5176.doc25492.6.686.RpFcit) and it said that entry point is <ecs.aliyuncs.com>.
But i see https://github.com/denverdino/aliyungo/blob/master/ecs/client.go#L20 and it is "https://ecs-cn-hangzhou.aliyuncs.com" by default.
It will lead to "Error creating machine: Error in driver during machine creation: Aliyun API Error: ... dial tcp 140.205.155.65:443: i/o timeout" when i create ecs instance.
能否增加iOSBadgeAutoIncrement参数,能否增加其它接口调用的方式?
现在v2版本的接口,只能使用主账号的key,子账号的不能用。能提供一下v3版本的就好了。
根据文档:https://help.aliyun.com/document_detail/35230.html?spm=5176.doc35226.6.676.mCU5KZ, 当调用DescribeRules接口时,可以拿到所有的规则列表,但是返回的列表里只有RuleName,没有RuleId
使用场景:比如我想删除某个loadbalancer配置的所有Rules:
问题是DescribeRules没有返回RuleId,而DeleteRules接口又需要RuleId作参数。
cc @superxi @ddysher
I'm trying to use docker-machine(0.5.0rc4) with aliyunecs driver and there are some issues.
First, I started to create swarm-ecs-master but there's TLS handshake timeout error:
$ docker-machine create --driver aliyunecs --swarm --swarm-master --swarm-discovery token://42391e615c9ee3ea568c92dddf9ee7a5 --engine-insecure-registry registry.mirrors.aliyuncs.com swarm-ecs-master
Creating CA: /Users/jie/.docker/machine/certs/ca.pem
Creating client certificate: /Users/jie/.docker/machine/certs/cert.pem
Running pre-create checks...
Creating machine...
Error creating machine: Error in driver during machine creation: Aliyun Error: Status Code -1: Code AliyunGoClientFailure: Message Get https://ecs.aliyuncs.com?xxxxxxxx(Some security info has been removed): net/http: TLS handshake timeout
Recreate is not allowed:
$ docker-machine create --driver aliyunecs --swarm --swarm-master --swarm-discovery token://42391e615c9ee3ea568c92dddf9ee7a5 --engine-insecure-registry registry.mirrors.aliyuncs.com swarm-ecs-master
Host already exists: "swarm-ecs-master"
Then, I tried to kill it but it still got error like below:
$ docker-machine kill swarm-ecs-master
swarm-ecs-master | Unable to kill instance : Aliyun Error: Status Code 400: Code MissingParameter: Message The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
Run docker-machine ls just like this:
$ docker-machine ls
error getting URL for host swarm-ecs-master: Aliyun Error: Status Code 400: Code MissingParameter: Message The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
error getting state for host swarm-ecs-master: Aliyun Error: Status Code 400: Code MissingParameter: Message The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
NAME ACTIVE DRIVER STATE URL SWARM
swarm-ecs-master - aliyunecs Error swarm-ecs-master (master)
For example, it supports this fuzzy query kube-*
:
args1 := ecs.DescribeInstancesArgs{
RegionId: "cn-beijing",
InstanceName: "kube-*",
Status: ecs.Running,
}
instance, _, err := client.DescribeInstances(&args1)
I got the result:
[]ecs.InstanceAttributesType{ecs.InstanceAttributesType{InstanceId:"i-25ruedcj2", InstanceName:"kube-master", ...},
ecs.InstanceAttributesType{InstanceId:"i-25zf0s2mo", InstanceName:"kube-node1", ...},
ecs.InstanceAttributesType{InstanceId:"i-25lx43e3z", InstanceName:"kube-node2", ...},
ecs.InstanceAttributesType{InstanceId:"i-25mo0ad2d", InstanceName:"kube-node3", ...}
$ go test
2015/06/06 22:58:33 StructArray.1. : {a 1}
2015/06/06 22:58:33 StructArray.2. : {x 2}
--- FAIL: TestISO8601Time (0.00 seconds)
iso6801_test.go:29: Time 2015-06-06T14:58:33Z does not equal expected 2015-06-06T14:58:33Z
FAIL
exit status 1
$ go version
go version go1.3.3 linux/amd64
我在调试 API 时遇到:
* aliyun_ecs_instance.test01: Failed to create instance from Image ubuntu1404_64_40G_aliaegis_20160222.vhd: Aliyun API Error: RequestId: D0CC639E-180D-4827-97CB-FC609F6C95CD Status Code: 403 Code: OperationDenied Message: The resource is out of usage.
请问该如何解决?
// NewClient creates a new instance of ECS client
func NewClient(accessKeyId, accessKeySecret string) *Client {
endpoint := os.Getenv("ECS_ENDPOINT")
if endpoint == "" {
endpoint = ECSDefaultEndpoint
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
}
Although we can set endpoint by an Environment variable, It is not convenient.
How about Variadic Functions for NewClient?
func NewClient(accessKeyId, accessKeySecret, args ...string) *Client {
endpoint := ""
if len(args) > 0 {
endpoint = args[0]
} else {
endpoint = os.Getenv("ECS_ENDPOINT")
if endpoint == "" {
endpoint = ECSDefaultEndpoint
}
}
return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
}
I am thinking, for http errors, we may be able to check the status code to see if the request is retry-able. We have no reason to retry a request with status code 400, 403, 404.
However, as we have so many http status codes, it may be hard to check every code to tell if it is retry-able or not. I could not find any document about those http codes that are not retry-able.
Let me know if you have any comments, thanks.
Does this SDK support "append" object?
I see PutReader has parameter type "io.Reader", instead of "io.ReaderSeeker". Does it mean this method can upload data as a stream (no need wait for EOF of the data)?
ecs use PayByBandwidth
:
https://help.aliyun.com/document_detail/25499.html?spm=5176.product25365.6.235.VIlqu1
but slb use paybytraffic
:
https://help.aliyun.com/document_detail/27577.html?spm=5176.product27537.6.118.R6Bqe6
So, slb could not use common.PayByBandwidth
in CreateLoadBalancerArgs
struct:
type CreateLoadBalancerArgs struct {
RegionId common.Region
LoadBalancerName string
AddressType AddressType
VSwitchId string
InternetChargeType common.InternetChargeType
Bandwidth int
ClientToken string
}
The status will be the stable status E.g. Running, Stopped, etc. We need the enumeration of them.
Thanks
源码中,代码:
type RecordType struct {
DomainName string
RecordId string
RR string
Type string
Value string
TTL int32
Priority int32
Line string
Status string
Locked bool
}
实际返回结果中,TTL为string类型,实际请求结果如下:
"DomainRecords": {
"Record": [
{
"RR": "test",
"Status": "ENABLE",
"Value": "1.1.1.1",
"RecordId": "342037109689856011",
"Type": "A",
"DomainName": "example.com",
"Locked": false,
"Line": "default",
"TTL": "600"
}
]
}
@denverdino
Seems this SDK does not provide SLB L7 loadbalancing rules related API, see: https://help.aliyun.com/document_detail/35226.html?spm=5176.doc35226.3.3.Grvi97
can not unmarshal LockReason result to ecs.LockReason struct (type string).
example response:
OperationLocks":{"LockReason":[{"LockReason":"financial"}]}
type ModifyScalingGroupArgs struct {
ScalingGroupId string
ScalingGroupName string
ActiveScalingConfigurationId string
MinSize int
MaxSize int
DefaultCooldown int
RemovalPolicy common.FlattenArray
}
MinSize
and MaxSize
is allowed to set to 0, but the default value is also 0.
When set query value, aliyungo treat 0 as not set, this is not true sometimes.
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
i := field.Uint()
if i != 0 {
value = strconv.FormatUint(i, 10)
}
We better use a int pointer to indicate whether is zero value or value not set
请问是否有支持阿里云容器服务的API计划?
RT.
No method DescribeInstanceTypeFamilies found in godoc and source code. Pls check it.
CreateLoadBalancerArgs InternetChargeType
InternetChargeType value is one of paybybandwidth and paybytraffic
https://help.aliyun.com/document_detail/27577.html?spm=5176.doc27592.6.617.am98PA
AliyunSLB DeleteSLB ERROR:
Aliyun API Error: RequestId: XXXXXXXX Status Code: 400 Code:
MissingParameter Message: The input parameter "StickySession" that is mandatory for processing this request is not supplied.
根据 https://help.aliyun.com/document_detail/27602.html?spm=5176.doc27606.6.666.hIo2xa 的文档,为Listener配置默认的VServerGroup,除了需要VServerGroupId以外,还需要一个 VServerGroup 的参数,其类型为 slb.FlagType。
目前的API事实上无法为Listener配置VserverGroup。添加VServerGroup后,工作才正常。
请问如何在阿里云内ECS里使用OSS内网推送?
如果支持的话,MACHINE_DOCKER_INSTALL_URL 和 ecs_region 怎么写?
So far, only PayByBandwidth is supported
DomainGroup related document is at https://help.aliyun.com/document_detail/29762.html?spm=5176.doc29762.3.3.blxLT1
BTW, aliyun dose not support DescribeDoaminGroup ? I want to list all domain in a group.
aliyun opensearch 包不能用。
I have used your repo to get information of metadata, but i can't find the interface of getting zone-id. So i add it.
I use the OSS
as the docker registry backend. The registry container run on the ECS, I want to connect to OSS
with internal endpoint. I get the internal endpoint url from ali guide.
storage:
oss:
accesskeyid: xxxxxxx
accesskeysecret: yyyyyyyy
region: oss-cn-hangzhou
endpoint: bucket1.oss-cn-hangzhou-internal.aliyuncs.com
internal: true
bucket: bucket1
When I start the registry, it error out.
2016/01/23 06:42:41 GET https://bucket1.oss-cn-hangzhou-internal.aliyuncs.com/?delimiter=&marker=&max-keys=1&prefix=test ...
panic: Get https://bucket1.oss-cn-hangzhou-internal.aliyuncs.com/?delimiter=&marker=&max-keys=1&prefix=test: x509: certificate is valid for *.oss-internal.aliyuncs.com, not registry1.oss-cn-hangzhou-internal.aliyuncs.com
go/src/github.com/denverdino/aliyungo/common/client.go:149:20: error: reference to undefined identifier 'http.MethodGet'
if method == http.MethodGet {
^
调用错误:
Aliyun API Error: RequestId: 5D792366-E7EA-4615-A9F7-85E0FC148EE5 Status Code: 404 Code: InvalidDayuStatus.Malformed Message: The specified dayu status is wrongly formed.
希望大神能尽快补丁
目前我需要用到MNS服务 可否有提供MNS相关的demo
It prompted the below message after running 'docker pull mysql' successfully. In fact it behaves the same whatever I am pulling.
"docker.io/library/mysql: this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker."
I checked the configuration and found docker daemon is using registry.mirrors.aliyuncs.com as default registry. Is this registry maintained officially by Aliyun?
请求json:
[{"RuleId":"","RuleName":"32507","Domain":"caicloud.io","Url":"","VServerGroupId":"rsp-wz9ulsi3q77ec"}]
报错:
Aliyun API Error: RequestId: 96AC3877-44F5-46C5-B6F6-D9E57CB9AAAD Status Code: 500 Code: InternalError Message: The request processing has failed due to some unknown error, exception or failure.
Error removing machine test2: unable to terminate instance: ECS Error: Status Code 400: Code DependencyViolation.RouteEntry: Message Specified instance is used by route entry.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.