forked from alibaba/nacos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature_cmdb' into 0.7.0
# Conflicts: # api/pom.xml # api/src/main/java/com/alibaba/nacos/api/exception/NacosException.java # client/pom.xml # client/src/main/java/com/alibaba/nacos/client/config/impl/HttpSimpleClient.java # client/src/main/java/com/alibaba/nacos/client/naming/net/NamingProxy.java # common/pom.xml # config/pom.xml # console/pom.xml # core/pom.xml # distribution/conf/application.properties # distribution/conf/nacos-logback.xml # distribution/pom.xml # distribution/release-nacos.xml # example/pom.xml # naming/pom.xml # naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java # pom.xml # test/pom.xml
- Loading branch information
Showing
56 changed files
with
2,126 additions
and
456 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
api/src/main/java/com/alibaba/nacos/api/cmdb/pojo/Entity.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,52 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.pojo; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public class Entity { | ||
|
||
private String type; | ||
private String name; | ||
private Map<String, String> labels; | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public Map<String, String> getLabels() { | ||
return labels; | ||
} | ||
|
||
public void setLabels(Map<String, String> labels) { | ||
this.labels = labels; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
api/src/main/java/com/alibaba/nacos/api/cmdb/pojo/EntityEvent.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,50 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.pojo; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public class EntityEvent { | ||
|
||
private EntityEventType type; | ||
private String entityName; | ||
private String entityType; | ||
|
||
public EntityEventType getType() { | ||
return type; | ||
} | ||
|
||
public void setType(EntityEventType type) { | ||
this.type = type; | ||
} | ||
|
||
public String getEntityName() { | ||
return entityName; | ||
} | ||
|
||
public void setEntityName(String entityName) { | ||
this.entityName = entityName; | ||
} | ||
|
||
public String getEntityType() { | ||
return entityType; | ||
} | ||
|
||
public void setEntityType(String entityType) { | ||
this.entityType = entityType; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/alibaba/nacos/api/cmdb/pojo/EntityEventType.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,30 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.pojo; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public enum EntityEventType { | ||
/** | ||
* | ||
*/ | ||
ENTITY_ADD_OR_UPDATE, | ||
/** | ||
* | ||
*/ | ||
ENTITY_REMOVE | ||
} |
52 changes: 52 additions & 0 deletions
52
api/src/main/java/com/alibaba/nacos/api/cmdb/pojo/Label.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,52 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.pojo; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public class Label { | ||
|
||
private String name; | ||
private Set<String> values; | ||
private String description; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public Set<String> getValues() { | ||
return values; | ||
} | ||
|
||
public void setValues(Set<String> values) { | ||
this.values = values; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
api/src/main/java/com/alibaba/nacos/api/cmdb/pojo/PreservedEntityTypes.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,30 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.pojo; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public enum PreservedEntityTypes { | ||
/** | ||
* | ||
*/ | ||
ip, | ||
/** | ||
* | ||
*/ | ||
service | ||
} |
97 changes: 97 additions & 0 deletions
97
api/src/main/java/com/alibaba/nacos/api/cmdb/spi/CmdbService.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,97 @@ | ||
/* | ||
* Copyright 1999-2018 Alibaba Group Holding Ltd. | ||
* | ||
* 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.alibaba.nacos.api.cmdb.spi; | ||
|
||
import com.alibaba.nacos.api.cmdb.pojo.Entity; | ||
import com.alibaba.nacos.api.cmdb.pojo.EntityEvent; | ||
import com.alibaba.nacos.api.cmdb.pojo.Label; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Service to visit CMDB store | ||
* | ||
* @author <a href="mailto:[email protected]">nkorange</a> | ||
*/ | ||
public interface CmdbService { | ||
|
||
/** | ||
* Get all label names stored in CMDB | ||
* | ||
* @return label name set | ||
*/ | ||
Set<String> getLabelNames(); | ||
|
||
/** | ||
* Get all possible entity types in CMDB | ||
* | ||
* @return all entity types | ||
*/ | ||
Set<String> getEntityTypes(); | ||
|
||
/** | ||
* Get label info | ||
* | ||
* @param labelName label name | ||
* @return label info | ||
*/ | ||
Label getLabel(String labelName); | ||
|
||
/** | ||
* Get label value of label name of ip | ||
* | ||
* @param entityType entity type | ||
* @param entityValue entity value | ||
* @param labelName target label name | ||
* @return label value | ||
*/ | ||
String getLabelValue(String entityValue, String entityType, String labelName); | ||
|
||
/** | ||
* Get all label value of ip | ||
* | ||
* @param entityType entity type | ||
* @param entityValue entity value | ||
* @return all label values | ||
*/ | ||
Map<String, String> getLabelValues(String entityValue, String entityType); | ||
|
||
/** | ||
* Dump all entities in CMDB | ||
* | ||
* @return all entities | ||
*/ | ||
Map<String, Map<String, Entity>> getAllEntities(); | ||
|
||
/** | ||
* get label change events | ||
* | ||
* @param timestamp start time of generated events | ||
* @return label events | ||
*/ | ||
List<EntityEvent> getEntityEvents(long timestamp); | ||
|
||
/** | ||
* Get single entity | ||
* | ||
* @param entityName name of entity | ||
* @param entityType type of entity | ||
* @return | ||
*/ | ||
Entity getEntity(String entityName, String entityType); | ||
} |
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.