Skip to content

Commit 7397716

Browse files
author
Alex Huang
committed
added missing files
1 parent 4b99904 commit 7397716

11 files changed

Lines changed: 455 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
public interface EdgeService {
22+
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
import com.cloud.org.Cluster;
22+
23+
public interface ClusterEntity extends DataCenterResourceEntity, Cluster, OrganizationScope {
24+
25+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
22+
23+
import com.cloud.utils.fsm.StateMachine2;
24+
import com.cloud.utils.fsm.StateObject;
25+
26+
/**
27+
* This interface specifies the states and operations all physical
28+
* and virtual resources in the data center must implement.
29+
*/
30+
public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
31+
32+
/**
33+
* This is the state machine for how CloudStack should interact with
34+
*
35+
*/
36+
public enum State {
37+
Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."),
38+
Enabled("The resource is now enabled for CloudStack to use."),
39+
Deactivated("The resource is disactivated so CloudStack should not use it for new resource needs.");
40+
41+
String _description;
42+
43+
private State(String description) {
44+
_description = description;
45+
}
46+
47+
public enum Event {
48+
EnableRequest,
49+
DisableRequest,
50+
DeactivateRequest,
51+
ActivatedRequest
52+
}
53+
54+
protected static final StateMachine2<State, Event, DataCenterResourceEntity> s_fsm = new StateMachine2<State, Event, DataCenterResourceEntity>();
55+
static {
56+
s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled);
57+
s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled);
58+
s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated);
59+
s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled);
60+
}
61+
62+
}
63+
/**
64+
* Prepare the resource to take new on new demands.
65+
*/
66+
boolean enable();
67+
68+
/**
69+
* Disables the resource. Cleanup. Prepare for the resource to be removed.
70+
*/
71+
boolean disable();
72+
73+
/**
74+
* Do not use the resource for new demands.
75+
*/
76+
boolean deactivate();
77+
78+
/**
79+
* Reactivates a deactivated resource.
80+
*/
81+
boolean reactivate();
82+
83+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
public interface OrganizationScope {
22+
23+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
import java.util.List;
22+
23+
import com.cloud.dc.Pod;
24+
import com.cloud.org.Cluster;
25+
26+
public interface PodEntity extends DataCenterResourceEntity, Pod {
27+
28+
List<Cluster> listClusters();
29+
30+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
import com.cloud.storage.StoragePool;
22+
23+
public interface StorageEntity extends DataCenterResourceEntity, StoragePool {
24+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.datacenter.entity.api;
20+
21+
import java.util.List;
22+
23+
import com.cloud.dc.DataCenter;
24+
25+
/**
26+
* Describes a zone and operations that can be done in a zone.
27+
*/
28+
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
29+
List<PodEntity> listPods();
30+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.entity.api;
20+
21+
import java.lang.reflect.Method;
22+
import java.util.Date;
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
/**
27+
* All entities returned by the Cloud Orchestration Platform must implement
28+
* this interface. CloudValueEntity is an immutable representation of
29+
* an entity exposed by Cloud Orchestration Platform. For each object, it
30+
* defines two ids: uuid, generated by CloudStack Orchestration Platform, and
31+
* an external id that is set by the caller when the entity is created. All
32+
* ids must be unique for that entity. CloudValueEntity also can be converted
33+
* to a CloudActionableEntity which contains actions the object can perform.
34+
*/
35+
public interface CloudStackEntity {
36+
/**
37+
* @return the uuid of the object.
38+
*/
39+
String getUuid();
40+
41+
/**
42+
* @return the id which is often the database id.
43+
*/
44+
long getId();
45+
46+
/**
47+
* @return external id set by the caller
48+
*/
49+
String getExternalId();
50+
51+
/**
52+
* @return current state for the entity
53+
*/
54+
String getCurrentState();
55+
56+
/**
57+
* @return desired state for the entity
58+
*/
59+
String getDesiredState();
60+
61+
/**
62+
* Get the time the entity was created
63+
*/
64+
Date getCreatedTime();
65+
66+
/**
67+
* Get the time the entity was last updated
68+
*/
69+
Date getLastUpdatedTime();
70+
71+
/**
72+
* @return reference to the owner of this entity
73+
*/
74+
String getOwner();
75+
76+
/**
77+
* @return details stored for this entity when created.
78+
*/
79+
Map<String, String> getDetails(String source);
80+
81+
/**
82+
* @return a list of sources that have added to the details.
83+
*/
84+
List<String> getDetailSources();
85+
86+
void addDetail(String source, String name, String value);
87+
88+
void delDetail(String source, String name, String value);
89+
90+
void updateDetail(String source, String name, String value);
91+
92+
/**
93+
* @return list of actions that can be performed on the object in its current state
94+
*/
95+
List<Method> getApplicableActions();
96+
}

0 commit comments

Comments
 (0)