Merge pull request #50 from chai2010/master

makefile: Add generate target to generate service code
This commit is contained in:
chai2010 2017-09-11 13:34:28 +08:00 committed by GitHub
commit cc9cf10201
4 changed files with 40 additions and 1 deletions

2
.gitignore vendored
View File

@ -29,3 +29,5 @@ coverage
release
.idea
glide.lock
snips

View File

@ -16,6 +16,7 @@ help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " all to check, build, test and release this SDK"
@echo " check to vet and lint the SDK"
@echo " generate to generate service code"
@echo " build to build the SDK"
@echo " unit to run all sort of unit tests except runtime"
@echo " unit-test to run unit test"
@ -44,6 +45,23 @@ lint:
if [[ -n $${lint} ]]; then echo "$${lint}"; exit 1; fi
@echo "ok"
generate: snips ../qingcloud-api-specs/package.json
./snips \
-s=${shell go env GOPATH}/src/github.com/yunify \
-m=qingcloud-api-specs \
-n=2013-08-30 \
-t=./template \
-o=./service
go fmt ./service/...
@echo "ok"
snips:
curl -L https://github.com/yunify/snips/releases/download/v0.0.9/snips-v0.0.9-${shell go env GOOS}_amd64.tar.gz | tar zx
../qingcloud-api-specs/package.json:
-go get -d github.com/yunify/qingcloud-api-specs
file %@
build:
@echo "build the SDK"
GOOS=linux GOARCH=amd64 go build ${PKGS_TO_CHECK}
@ -51,6 +69,7 @@ build:
GOOS=windows GOARCH=amd64 go build ${PKGS_TO_CHECK}
@echo "ok"
unit: unit-test unit-benchmark unit-coverage unit-race
unit-test:

View File

@ -201,7 +201,7 @@ type CreateMongoInput struct {
MongoPassword *string `json:"mongo_password" name:"mongo_password" location:"params"`
MongoType *int `json:"mongo_type" name:"mongo_type" location:"params"` // Required
MongoUsername *string `json:"mongo_username" name:"mongo_username" location:"params"`
MongoVersion *int `json:"mongo_version" name:"mongo_version" location:"params"`
MongoVersion *string `json:"mongo_version" name:"mongo_version" location:"params"`
PrivateIPs []*MongoPrivateIP `json:"private_ips" name:"private_ips" location:"params"`
ResourceClass *int `json:"resource_class" name:"resource_class" location:"params"`
StorageSize *int `json:"storage_size" name:"storage_size" location:"params"` // Required

View File

@ -1339,6 +1339,7 @@ type Mongo struct {
Status *string `json:"status" name:"status"`
StatusTime *time.Time `json:"status_time" name:"status_time" format:"ISO 8601"`
StorageSize *int `json:"storage_size" name:"storage_size"`
Tags []*Tag `json:"tags" name:"tags"`
// TransitionStatus's available values: creating, stopping, starting, deleting, resizing, suspending, vxnet-changing, snapshot-creating, instances-adding, instances-removing, pg-applying
TransitionStatus *string `json:"transition_status" name:"transition_status"`
VxNet *VxNet `json:"vxnet" name:"vxnet"`
@ -1386,6 +1387,14 @@ func (v *Mongo) Validate() error {
}
}
if len(v.Tags) > 0 {
for _, property := range v.Tags {
if err := property.Validate(); err != nil {
return err
}
}
}
if v.TransitionStatus != nil {
transitionStatusValidValues := []string{"creating", "stopping", "starting", "deleting", "resizing", "suspending", "vxnet-changing", "snapshot-creating", "instances-adding", "instances-removing", "pg-applying"}
transitionStatusParameterValue := fmt.Sprint(*v.TransitionStatus)
@ -2112,6 +2121,7 @@ type S2Server struct {
// Status's available values: pending, active, poweroffed, suspended, deleted, ceased
Status *string `json:"status" name:"status"`
StatusTime *time.Time `json:"status_time" name:"status_time" format:"ISO 8601"`
Tags []*Tag `json:"tags" name:"tags"`
// TransitionStatus's available values: creating, updating, suspending, resuming, poweroffing
TransitionStatus *string `json:"transition_status" name:"transition_status"`
VxNet *VxNet `json:"vxnet" name:"vxnet"`
@ -2199,6 +2209,14 @@ func (v *S2Server) Validate() error {
}
}
if len(v.Tags) > 0 {
for _, property := range v.Tags {
if err := property.Validate(); err != nil {
return err
}
}
}
if v.TransitionStatus != nil {
transitionStatusValidValues := []string{"creating", "updating", "suspending", "resuming", "poweroffing"}
transitionStatusParameterValue := fmt.Sprint(*v.TransitionStatus)