Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
2ca490a1
Commit
2ca490a1
authored
Jun 24, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6cd90c16
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
ClusterController.java
...framework/apollo/portal/controller/ClusterController.java
+9
-0
ClusterService.java
...ctrip/framework/apollo/portal/service/ClusterService.java
+0
-6
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java
View file @
2ca490a1
...
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.ctrip.framework.apollo.core.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.service.ClusterService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -13,20 +14,28 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
static
com
.
ctrip
.
framework
.
apollo
.
common
.
utils
.
RequestPrecondition
.
checkArgument
;
import
static
com
.
ctrip
.
framework
.
apollo
.
common
.
utils
.
RequestPrecondition
.
checkModel
;
@RestController
public
class
ClusterController
{
@Autowired
private
ClusterService
clusterService
;
@Autowired
private
UserInfoHolder
userInfoHolder
;
@PreAuthorize
(
value
=
"@permissionValidator.hasCreateClusterPermission(#appId)"
)
@RequestMapping
(
value
=
"apps/{appId}/envs/{env}/clusters"
,
method
=
RequestMethod
.
POST
)
public
ClusterDTO
createCluster
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@RequestBody
ClusterDTO
cluster
){
checkModel
(
cluster
!=
null
);
checkArgument
(
cluster
.
getAppId
(),
cluster
.
getName
());
String
operator
=
userInfoHolder
.
getUser
().
getUserId
();
cluster
.
setDataChangeLastModifiedBy
(
operator
);
cluster
.
setDataChangeCreatedBy
(
operator
);
return
clusterService
.
createCluster
(
Env
.
valueOf
(
env
),
cluster
);
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
View file @
2ca490a1
...
...
@@ -3,7 +3,6 @@ package com.ctrip.framework.apollo.portal.service;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,8 +13,6 @@ import java.util.List;
public
class
ClusterService
{
@Autowired
private
UserInfoHolder
userInfoHolder
;
@Autowired
private
AdminServiceAPI
.
ClusterAPI
clusterAPI
;
public
List
<
ClusterDTO
>
findClusters
(
Env
env
,
String
appId
){
...
...
@@ -23,9 +20,6 @@ public class ClusterService {
}
public
ClusterDTO
createCluster
(
Env
env
,
ClusterDTO
cluster
){
String
operator
=
userInfoHolder
.
getUser
().
getUserId
();
cluster
.
setDataChangeLastModifiedBy
(
operator
);
cluster
.
setDataChangeCreatedBy
(
operator
);
return
clusterAPI
.
createOrUpdate
(
env
,
cluster
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment