-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: let open api more easier to use and development (#3943)
* refactor: add open api interface * fix: GetMapping conflict * Update apollo-openapi/src/main/java/com/ctrip/framework/apollo/openapi/client/ApolloOpenApiClient.java Co-authored-by: Jason Song <[email protected]> * fix: HttpServletRequest lack. Use an UnsupportedOperationException method instead * fix: GetMapping conflict * delete method parameter request Use 'T(org.springframework.web.context.request.RequestContextHolder).currentRequestAttributes().getRequest()' instead of '#request' * rollback controller in portal * rollback ApolloOpenApiClient * delete xxxOpenApi * refactor: use xxxOpenApiService as api * Update NamespaceBranchController.java * Update CHANGES.md Co-authored-by: Jason Song <[email protected]>
- Loading branch information
Showing
26 changed files
with
1,083 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apollo-openapi/src/main/java/com/ctrip/framework/apollo/openapi/api/AppOpenApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.openapi.api; | ||
|
||
import com.ctrip.framework.apollo.openapi.dto.OpenAppDTO; | ||
import com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO; | ||
import java.util.List; | ||
|
||
/** | ||
* @author wxq | ||
*/ | ||
public interface AppOpenApiService { | ||
|
||
List<OpenEnvClusterDTO> getEnvClusterInfo(String appId); | ||
|
||
List<OpenAppDTO> getAllApps(); | ||
|
||
List<OpenAppDTO> getAppsInfo(List<String> appIds); | ||
|
||
List<OpenAppDTO> getAuthorizedApps(); | ||
} |
29 changes: 29 additions & 0 deletions
29
...o-openapi/src/main/java/com/ctrip/framework/apollo/openapi/api/ClusterOpenApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.openapi.api; | ||
|
||
import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO; | ||
|
||
/** | ||
* @author wxq | ||
*/ | ||
public interface ClusterOpenApiService { | ||
|
||
OpenClusterDTO getCluster(String appId, String env, String clusterName); | ||
|
||
OpenClusterDTO createCluster(String env, OpenClusterDTO openClusterDTO); | ||
} |
40 changes: 40 additions & 0 deletions
40
apollo-openapi/src/main/java/com/ctrip/framework/apollo/openapi/api/ItemOpenApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.openapi.api; | ||
|
||
import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO; | ||
|
||
/** | ||
* @author wxq | ||
*/ | ||
public interface ItemOpenApiService { | ||
|
||
OpenItemDTO getItem(String appId, String env, String clusterName, String namespaceName, | ||
String key); | ||
|
||
OpenItemDTO createItem(String appId, String env, String clusterName, String namespaceName, | ||
OpenItemDTO itemDTO); | ||
|
||
void updateItem(String appId, String env, String clusterName, String namespaceName, | ||
OpenItemDTO itemDTO); | ||
|
||
void createOrUpdateItem(String appId, String env, String clusterName, String namespaceName, | ||
OpenItemDTO itemDTO); | ||
|
||
void removeItem(String appId, String env, String clusterName, String namespaceName, String key, | ||
String operator); | ||
} |
37 changes: 37 additions & 0 deletions
37
...openapi/src/main/java/com/ctrip/framework/apollo/openapi/api/NamespaceOpenApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.openapi.api; | ||
|
||
import com.ctrip.framework.apollo.openapi.dto.OpenAppNamespaceDTO; | ||
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceDTO; | ||
import com.ctrip.framework.apollo.openapi.dto.OpenNamespaceLockDTO; | ||
import java.util.List; | ||
|
||
/** | ||
* @author wxq | ||
*/ | ||
public interface NamespaceOpenApiService { | ||
|
||
OpenNamespaceDTO getNamespace(String appId, String env, String clusterName, String namespaceName); | ||
|
||
List<OpenNamespaceDTO> getNamespaces(String appId, String env, String clusterName); | ||
|
||
OpenAppNamespaceDTO createAppNamespace(OpenAppNamespaceDTO appNamespaceDTO); | ||
|
||
OpenNamespaceLockDTO getNamespaceLock(String appId, String env, String clusterName, | ||
String namespaceName); | ||
} |
35 changes: 35 additions & 0 deletions
35
...o-openapi/src/main/java/com/ctrip/framework/apollo/openapi/api/ReleaseOpenApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2021 Apollo Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.ctrip.framework.apollo.openapi.api; | ||
|
||
import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO; | ||
import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO; | ||
|
||
/** | ||
* @author wxq | ||
*/ | ||
public interface ReleaseOpenApiService { | ||
|
||
OpenReleaseDTO publishNamespace(String appId, String env, String clusterName, | ||
String namespaceName, | ||
NamespaceReleaseDTO releaseDTO); | ||
|
||
OpenReleaseDTO getLatestActiveRelease(String appId, String env, String clusterName, | ||
String namespaceName); | ||
|
||
void rollbackRelease(String env, long releaseId, String operator); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.