Skip to content

Commit 8955107

Browse files
tornado-ssysongshiyuan 00649746
and
songshiyuan 00649746
authored
[feat] support define environment (#69)
Co-authored-by: songshiyuan 00649746 <[email protected]>
1 parent 88da93f commit 8955107

File tree

2 files changed

+82
-19
lines changed

2 files changed

+82
-19
lines changed

Diff for: discovery/error.go

+21-19
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,27 @@ const (
2525
)
2626

2727
const (
28-
ErrInvalidParams int32 = 400001
29-
ErrUnhealthy int32 = 400002
30-
ErrServiceAlreadyExists int32 = 400010
31-
ErrServiceNotExists int32 = 400012
32-
ErrDeployedInstance int32 = 400013
33-
ErrUndefinedSchemaID int32 = 400014
34-
ErrModifySchemaNotAllow int32 = 400015
35-
ErrSchemaNotExists int32 = 400016
36-
ErrInstanceNotExists int32 = 400017
37-
ErrTagNotExists int32 = 400018
38-
ErrRuleAlreadyExists int32 = 400019
39-
ErrBlackAndWhiteRule int32 = 400020
40-
ErrModifyRuleNotAllow int32 = 400021
41-
ErrRuleNotExists int32 = 400022
42-
ErrDependedOnConsumer int32 = 400023
43-
ErrPermissionDeny int32 = 400024
44-
ErrEndpointAlreadyExists int32 = 400025
45-
ErrServiceVersionNotExists int32 = 400026
46-
ErrNotEnoughQuota int32 = 400100
28+
ErrInvalidParams int32 = 400001
29+
ErrUnhealthy int32 = 400002
30+
ErrServiceAlreadyExists int32 = 400010
31+
ErrServiceNotExists int32 = 400012
32+
ErrDeployedInstance int32 = 400013
33+
ErrUndefinedSchemaID int32 = 400014
34+
ErrModifySchemaNotAllow int32 = 400015
35+
ErrSchemaNotExists int32 = 400016
36+
ErrInstanceNotExists int32 = 400017
37+
ErrTagNotExists int32 = 400018
38+
ErrRuleAlreadyExists int32 = 400019
39+
ErrBlackAndWhiteRule int32 = 400020
40+
ErrModifyRuleNotAllow int32 = 400021
41+
ErrRuleNotExists int32 = 400022
42+
ErrDependedOnConsumer int32 = 400023
43+
ErrPermissionDeny int32 = 400024
44+
ErrEndpointAlreadyExists int32 = 400025
45+
ErrServiceVersionNotExists int32 = 400026
46+
ErrNotEnoughQuota int32 = 400100
47+
ErrEnvironmentAlreadyExists int32 = 400027
48+
ErrEnvironmentNotExists int32 = 400028
4749

4850
ErrForbidden int32 = 403001
4951

Diff for: env/environment.go

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package env
2+
3+
type Environment struct {
4+
ID string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty" bson:"id"`
5+
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty" bson:"name"`
6+
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty" bson:"description"`
7+
Timestamp string `protobuf:"bytes,11,opt,name=timestamp" json:"timestamp,omitempty"`
8+
ModTimestamp string `protobuf:"bytes,15,opt,name=modTimestamp" json:"modTimestamp,omitempty" bson:"mod_timestamp"`
9+
}
10+
11+
type Response struct {
12+
Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"`
13+
Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
14+
}
15+
16+
type GetEnvironmentsResponse struct {
17+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"-"`
18+
Environments []*Environment `protobuf:"bytes,2,rep,name=environments" json:"environments,omitempty"`
19+
}
20+
21+
type CreateEnvironmentRequest struct {
22+
Environment *Environment `protobuf:"bytes,1,opt,name=environment" json:"environment,omitempty"`
23+
}
24+
25+
type CreateEnvironmentResponse struct {
26+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"-"`
27+
EnvId string `protobuf:"bytes,2,opt,name=envId" json:"envId,omitempty"`
28+
}
29+
30+
type EnvironmentKey struct {
31+
// Tenant: The format is "{domain}/{project}"
32+
Tenant string `protobuf:"bytes,1,opt,name=tenant" json:"tenant,omitempty"`
33+
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty" bson:"name"`
34+
}
35+
36+
type GetEnvironmentRequest struct {
37+
EnvironmentId string `protobuf:"bytes,1,opt,name=environmentId" json:"environmentId,omitempty"`
38+
}
39+
40+
type GetEnvironmentResponse struct {
41+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"-"`
42+
Environment *Environment `protobuf:"bytes,2,opt,name=environment" json:"environment,omitempty"`
43+
}
44+
45+
type DeleteEnvironmentRequest struct {
46+
EnvironmentId string `protobuf:"bytes,1,opt,name=environmentId" json:"environmentId,omitempty"`
47+
}
48+
49+
type UpdateEnvironmentRequest struct {
50+
Environment *Environment `protobuf:"bytes,1,opt,name=environment" json:"environment,omitempty"`
51+
}
52+
53+
type GetEnvironmentCountRequest struct {
54+
Domain string `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"`
55+
Project string `protobuf:"bytes,2,opt,name=project" json:"project,omitempty"`
56+
}
57+
58+
type GetEnvironmentCountResponse struct {
59+
Response *Response `protobuf:"bytes,1,opt,name=response" json:"-"`
60+
Count int64 `protobuf:"varint,2,opt,name=count" json:"count,omitempty"`
61+
}

0 commit comments

Comments
 (0)