Skip to content

Commit 867e7f8

Browse files
committed
Issue #286, Issue #281, Issue #289, Issue #278
1 parent ecbe9b1 commit 867e7f8

File tree

13 files changed

+506
-363
lines changed

13 files changed

+506
-363
lines changed

core/src/main/java/org/openstack4j/api/networking/PortService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.openstack4j.common.RestService;
66
import org.openstack4j.model.compute.ActionResponse;
77
import org.openstack4j.model.network.Port;
8+
import org.openstack4j.model.network.options.PortListOptions;
89

910
/**
1011
* OpenStack (Neutron) Port based Operations
@@ -19,6 +20,14 @@ public interface PortService extends RestService {
1920
* @return the list of ports
2021
*/
2122
List<? extends Port> list();
23+
24+
/**
25+
* Lists all Ports authorized by the current Tenant
26+
*
27+
* @param options filtering options
28+
* @return the list of ports
29+
*/
30+
List<? extends Port> list(PortListOptions options);
2231

2332
/**
2433
* Gets the Port by ID

core/src/main/java/org/openstack4j/api/networking/RouterService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public interface RouterService extends RestService {
8989
* @param subnetId the subnet identifier
9090
* @param portId the port identifier
9191
* @return the router interface that was detached
92+
* @throws ClientResponseException if one of the specified identifiers does not exist
9293
*/
9394
RouterInterface detachInterface(String routerId, String subnetId, String portId);
9495
}

core/src/main/java/org/openstack4j/model/compute/AbsoluteLimit.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,17 @@ public interface AbsoluteLimit extends ModelEntity {
197197
*/
198198
int getTotalFloatingIpsUsed();
199199

200+
/**
201+
* Gets the max server group members
202+
*
203+
* @return the max server group members (-1 indicates no value)
204+
*/
205+
int getMaxServerGroupMembers();
206+
207+
/**
208+
* Gets the max server groups
209+
*
210+
* @return the max server groups (-1 indicates no value)
211+
*/
212+
int getMaxServerGroups();
200213
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package org.openstack4j.model.network.options;
2+
3+
import java.util.Map;
4+
5+
import com.google.common.collect.Maps;
6+
7+
/**
8+
* Provides server-side filtering options for listing ports
9+
*
10+
* @author Jeremy Unruh
11+
*
12+
*/
13+
public class PortListOptions {
14+
15+
private Map<String,String> queryParams = Maps.newHashMap();
16+
17+
private PortListOptions() { }
18+
19+
public static PortListOptions create() {
20+
return new PortListOptions();
21+
}
22+
23+
/**
24+
* The ID of the entity that uses this port. For example, a DHCP agent.
25+
*
26+
* @param deviceOwner the device owner
27+
* @return options
28+
*/
29+
public PortListOptions deviceOwner(String deviceOwner) {
30+
return add("device_owner", deviceOwner);
31+
}
32+
33+
/**
34+
* The ID of the device that uses this port. For example, a virtual server.
35+
*
36+
* @param deviceId the device id
37+
* @return options
38+
*/
39+
public PortListOptions deviceId(String deviceId) {
40+
return add("device_id", deviceId);
41+
}
42+
43+
/**
44+
* The ID of the attached network
45+
*
46+
* @param networkId the network id
47+
* @return options
48+
*/
49+
public PortListOptions networkId(String networkId) {
50+
return add("network_id", networkId);
51+
}
52+
53+
/**
54+
* The administrative state of the router, which is up (true) or down (false)
55+
*
56+
* @param adminState the admin state
57+
* @return options
58+
*/
59+
public PortListOptions adminState(boolean adminState) {
60+
return add("admin_state", String.valueOf(adminState));
61+
}
62+
63+
/**
64+
* The port name
65+
*
66+
* @param displayName the port name
67+
* @return options
68+
*/
69+
public PortListOptions displayName(String displayName) {
70+
return add("display_name", displayName);
71+
}
72+
73+
/**
74+
* The ID of the tenant who owns the network
75+
*
76+
* @param tenantId the tenant id
77+
* @return options
78+
*/
79+
public PortListOptions tenantId(String tenantId) {
80+
return add("tenant_id", tenantId);
81+
}
82+
83+
/**
84+
* The MAC address of the port
85+
*
86+
* @param macAddress the mac address
87+
* @return options
88+
*/
89+
public PortListOptions macAddress(String macAddress) {
90+
return add("mac_address", macAddress);
91+
}
92+
93+
private PortListOptions add(String param, String value) {
94+
if (value != null)
95+
this.queryParams.put(param, value);
96+
return this;
97+
}
98+
99+
public Map<String, String> getOptions() {
100+
return queryParams;
101+
}
102+
}

core/src/main/java/org/openstack4j/model/sahara/Cluster.java

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -15,110 +15,110 @@
1515
*/
1616
public interface Cluster extends ModelEntity, Buildable<ClusterBuilder> {
1717

18-
/**
19-
* TODO: Shall this return a Status object?
20-
* @return the status of the cluster
21-
*/
22-
String getStatus();
23-
24-
/**
25-
* @return the information of the cluster
26-
*/
27-
Map<String, ? extends ServiceInfo> getInfos();
28-
29-
/**
30-
* @return the template id of the cluster
31-
*/
32-
String getClusterTemplateId();
33-
34-
/**
35-
* @return the if the cluster is transient
36-
*/
37-
Boolean isTransient();
38-
39-
/**
40-
* @return the description of the cluster
41-
*/
42-
String getDescription();
43-
44-
/**
45-
* @return the configurations of the cluster
46-
*/
47-
Map<String,? extends ServiceConfig> getClusterConfigs();
48-
49-
/**
50-
* @return the created date of the cluster
51-
*/
52-
Date getCreatedAt();
53-
54-
/**
55-
* @return the default image id of the cluster
56-
*/
57-
String getDefaultImageId();
58-
59-
/**
60-
* @return the user keypair id of the cluster
61-
*/
62-
String getUserKeypairId();
63-
64-
/**
65-
* @return the updated date of the cluster
66-
*/
67-
Date getUpdatedAt();
68-
69-
/**
70-
* @return the plugin name of the cluster
71-
*/
72-
String getPluginName();
73-
74-
/**
75-
* @return the management network of the cluster
76-
*/
77-
String getManagementNetworkId();
78-
79-
/**
80-
* @return the anti-affinity of the cluster
81-
*/
82-
List<String> getAntiAffinity();
83-
84-
/**
85-
* @return the tenant id of the cluster
86-
*/
87-
String getTenantId();
88-
89-
/**
90-
* @return the node groups of the cluster
91-
*/
92-
List<? extends NodeGroup> getNodeGroups();
93-
94-
/**
95-
* @return the management public key of the cluster
96-
*/
97-
String getManagementPublicKey();
98-
99-
/**
100-
* @return the status description of the cluster
101-
*/
102-
String getStatusDescription();
103-
104-
/**
105-
* @return the hadoop version of the cluster
106-
*/
107-
String getHadoopVersion();
108-
109-
/**
110-
* @return the identifier of the cluster
111-
*/
112-
String getId();
113-
114-
/**
115-
* @return the trust id of the cluster
116-
*/
117-
String getTrustId();
118-
119-
/**
120-
* @return the name of the cluster
121-
*/
122-
String getName();
123-
18+
/**
19+
* TODO: Shall this return a Status object?
20+
* @return the status of the cluster
21+
*/
22+
String getStatus();
23+
24+
/**
25+
* @return the information of the cluster
26+
*/
27+
Map<String, ? extends ServiceInfo> getInfos();
28+
29+
/**
30+
* @return the template id of the cluster
31+
*/
32+
String getClusterTemplateId();
33+
34+
/**
35+
* @return the if the cluster is transient
36+
*/
37+
Boolean isTransient();
38+
39+
/**
40+
* @return the description of the cluster
41+
*/
42+
String getDescription();
43+
44+
/**
45+
* @return the configurations of the cluster
46+
*/
47+
Map<String,? extends ServiceConfig> getClusterConfigs();
48+
49+
/**
50+
* @return the created date of the cluster
51+
*/
52+
Date getCreatedAt();
53+
54+
/**
55+
* @return the default image id of the cluster
56+
*/
57+
String getDefaultImageId();
58+
59+
/**
60+
* @return the user keypair id of the cluster
61+
*/
62+
String getUserKeypairId();
63+
64+
/**
65+
* @return the updated date of the cluster
66+
*/
67+
Date getUpdatedAt();
68+
69+
/**
70+
* @return the plugin name of the cluster
71+
*/
72+
String getPluginName();
73+
74+
/**
75+
* @return the management network of the cluster
76+
*/
77+
String getManagementNetworkId();
78+
79+
/**
80+
* @return the anti-affinity of the cluster
81+
*/
82+
List<String> getAntiAffinity();
83+
84+
/**
85+
* @return the tenant id of the cluster
86+
*/
87+
String getTenantId();
88+
89+
/**
90+
* @return the node groups of the cluster
91+
*/
92+
List<? extends NodeGroup> getNodeGroups();
93+
94+
/**
95+
* @return the management public key of the cluster
96+
*/
97+
String getManagementPublicKey();
98+
99+
/**
100+
* @return the status description of the cluster
101+
*/
102+
String getStatusDescription();
103+
104+
/**
105+
* @return the hadoop version of the cluster
106+
*/
107+
String getHadoopVersion();
108+
109+
/**
110+
* @return the identifier of the cluster
111+
*/
112+
String getId();
113+
114+
/**
115+
* @return the trust id of the cluster
116+
*/
117+
String getTrustId();
118+
119+
/**
120+
* @return the name of the cluster
121+
*/
122+
String getName();
123+
124124
}

core/src/main/java/org/openstack4j/model/sahara/ConfigInfo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.openstack4j.model.sahara;
22

33
import java.util.List;
4-
import java.util.Map;
54

65
import org.openstack4j.model.ModelEntity;
76

0 commit comments

Comments
 (0)