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
261b382c
Commit
261b382c
authored
Aug 11, 2016
by
Jason Song
Committed by
GitHub
Aug 11, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #376 from lepdou/open
add envclusters interface
parents
450548f0
9670438e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
OpenEnvClusterDTO.java
...ctrip/framework/apollo/openapi/dto/OpenEnvClusterDTO.java
+25
-0
AppController.java
...framework/apollo/openapi/v1/controller/AppController.java
+47
-0
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/dto/OpenEnvClusterDTO.java
0 → 100644
View file @
261b382c
package
com
.
ctrip
.
framework
.
apollo
.
openapi
.
dto
;
import
java.util.Set
;
public
class
OpenEnvClusterDTO
{
private
String
env
;
private
Set
<
String
>
clusters
;
public
String
getEnv
()
{
return
env
;
}
public
void
setEnv
(
String
env
)
{
this
.
env
=
env
;
}
public
Set
<
String
>
getClusters
()
{
return
clusters
;
}
public
void
setClusters
(
Set
<
String
>
clusters
)
{
this
.
clusters
=
clusters
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/AppController.java
0 → 100644
View file @
261b382c
package
com
.
ctrip
.
framework
.
apollo
.
openapi
.
v1
.
controller
;
import
com.ctrip.framework.apollo.common.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO
;
import
com.ctrip.framework.apollo.portal.PortalSettings
;
import
com.ctrip.framework.apollo.portal.service.ClusterService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.LinkedList
;
import
java.util.List
;
@RestController
(
"openapiAppController"
)
@RequestMapping
(
"/openapi/v1"
)
public
class
AppController
{
@Autowired
private
PortalSettings
portalSettings
;
@Autowired
private
ClusterService
clusterService
;
@RequestMapping
(
"/apps/{appId}/envclusters"
)
public
List
<
OpenEnvClusterDTO
>
loadEnvClusterInfo
(
@PathVariable
String
appId
){
List
<
OpenEnvClusterDTO
>
envClusters
=
new
LinkedList
<>();
List
<
Env
>
envs
=
portalSettings
.
getActiveEnvs
();
for
(
Env
env
:
envs
)
{
OpenEnvClusterDTO
envCluster
=
new
OpenEnvClusterDTO
();
envCluster
.
setEnv
(
env
.
name
());
List
<
ClusterDTO
>
clusterDTOs
=
clusterService
.
findClusters
(
env
,
appId
);
envCluster
.
setClusters
(
BeanUtils
.
toPropertySet
(
"name"
,
clusterDTOs
));
envClusters
.
add
(
envCluster
);
}
return
envClusters
;
}
}
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