1+ /*
2+ * Copyright 2024 Apollo Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ *
16+ */
17+ package com .ctrip .framework .apollo .openapi .v1 .controller ;
18+
19+ import com .ctrip .framework .apollo .openapi .api .InstanceOpenApiService ;
20+ import org .springframework .web .bind .annotation .*;
21+
22+ @ RestController ("openapiInstanceController" )
23+ @ RequestMapping ("/openapi/v1/envs/{env}" )
24+ public class InstanceController {
25+ private final InstanceOpenApiService instanceOpenApiService ;
26+
27+ public InstanceController (InstanceOpenApiService instanceOpenApiService ) {
28+ this .instanceOpenApiService = instanceOpenApiService ;
29+ }
30+
31+ @ GetMapping (value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances" )
32+ public int getInstanceCountByNamespace (@ PathVariable String appId , @ PathVariable String env ,
33+ @ PathVariable String clusterName , @ PathVariable String namespaceName ) {
34+ return this .instanceOpenApiService .getInstanceCountByNamespace (appId , env , clusterName , namespaceName );
35+ }
36+ }
0 commit comments