add FWaaS extension to openstack-neutron
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/289cce04 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/289cce04 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/289cce04 Branch: refs/heads/master Commit: 289cce042a81782f3ef5f4128ba3482f59d72007 Parents: 83b104d Author: Andrea Turli <[email protected]> Authored: Tue Jun 9 17:25:25 2015 +0200 Committer: Zack Shoylev <[email protected]> Committed: Thu Jul 2 15:00:36 2015 -0500 ---------------------------------------------------------------------- apis/openstack-neutron/pom.xml | 5 + .../openstack/neutron/v2/NeutronApi.java | 11 + .../neutron/v2/domain/CreateFirewall.java | 120 +++ .../neutron/v2/domain/CreateFirewallPolicy.java | 142 +++ .../neutron/v2/domain/CreateFirewallRule.java | 231 +++++ .../openstack/neutron/v2/domain/Firewall.java | 47 + .../neutron/v2/domain/FirewallPolicies.java | 36 + .../neutron/v2/domain/FirewallPolicy.java | 48 + .../neutron/v2/domain/FirewallRule.java | 52 + .../neutron/v2/domain/FirewallRules.java | 36 + .../openstack/neutron/v2/domain/Firewalls.java | 36 + .../openstack/neutron/v2/domain/IpVersion.java | 50 + .../neutron/v2/domain/UpdateFirewall.java | 68 ++ .../neutron/v2/domain/UpdateFirewallPolicy.java | 80 ++ .../neutron/v2/domain/UpdateFirewallRule.java | 100 ++ .../v2/extensions/ExtensionNamespaces.java | 4 + .../neutron/v2/extensions/FWaaSApi.java | 253 +++++ .../FirewallPolicyToPagedIterable.java | 63 ++ .../functions/FirewallRuleToPagedIterable.java | 63 ++ .../v2/functions/FirewallToPagedIterable.java | 63 ++ .../v2/functions/ParseFirewallPolicies.java | 38 + .../v2/functions/ParseFirewallRules.java | 38 + .../neutron/v2/functions/ParseFirewalls.java | 38 + .../neutron/v2/extensions/FWaaSApiLiveTest.java | 199 ++++ .../neutron/v2/extensions/FWaaSApiMockTest.java | 984 +++++++++++++++++++ .../v2/features/ExtensionApiMockTest.java | 2 +- .../src/test/resources/extension_list.json | 262 +++-- .../test/resources/firewall_create_request.json | 6 + .../resources/firewall_create_response.json | 11 + .../test/resources/firewall_get_response.json | 11 + .../test/resources/firewall_list_response.json | 13 + .../firewall_policy_create_request.json | 8 + .../firewall_policy_create_response.json | 11 + .../resources/firewall_policy_get_response.json | 14 + .../firewall_policy_insert_rule_request.json | 1 + .../firewall_policy_insert_rule_response.json | 10 + .../firewall_policy_list_response.json | 255 +++++ .../resources/firewall_rule_create_request.json | 12 + .../firewall_rule_create_response.json | 19 + .../resources/firewall_rule_get_response.json | 19 + .../resources/firewall_rule_update_request.json | 6 + .../firewall_rule_update_response.json | 19 + .../test/resources/firewall_update_request.json | 5 + .../resources/firewall_update_response.json | 11 + .../src/test/resources/logback.xml | 43 +- 45 files changed, 3371 insertions(+), 172 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/pom.xml ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/pom.xml b/apis/openstack-neutron/pom.xml index 15e0225..42da458 100644 --- a/apis/openstack-neutron/pom.xml +++ b/apis/openstack-neutron/pom.xml @@ -111,6 +111,11 @@ <artifactId>auto-service</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>com.google.auto.value</groupId> + <artifactId>auto-value</artifactId> + <scope>provided</scope> + </dependency> </dependencies> <profiles> http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java index 4dca71b..6eb3f53 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/NeutronApi.java @@ -26,6 +26,7 @@ import org.jclouds.openstack.neutron.v2.extensions.FloatingIPApi; import org.jclouds.openstack.neutron.v2.extensions.RouterApi; import org.jclouds.openstack.neutron.v2.extensions.SecurityGroupApi; import org.jclouds.openstack.neutron.v2.extensions.lbaas.v1.LBaaSApi; +import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; import org.jclouds.openstack.neutron.v2.features.NetworkApi; import org.jclouds.openstack.neutron.v2.features.PortApi; import org.jclouds.openstack.neutron.v2.features.SubnetApi; @@ -120,4 +121,14 @@ public interface NeutronApi extends Closeable { */ @Delegate Optional<LBaaSApi> getLBaaSApi(@EndpointParam(parser = VersionAwareRegionToEndpoint.class) String region); + + /** + * Provides access to FWaaS features. + * + * <h3>NOTE</h3> + * This API is an extension that may or may not be present in your OpenStack cloud. Use the Optional return type + * to determine if it is present. + */ + @Delegate + Optional<FWaaSApi> getFWaaSApi(@EndpointParam(parser = VersionAwareRegionToEndpoint.class) String region); } http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewall.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewall.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewall.java new file mode 100644 index 0000000..9c65419 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewall.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +/** + * Representation of creation options for an OpenStack Neutron Firewall. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class CreateFirewall { + + /** + * @see Builder#tenantId(String) + */ + @Nullable public abstract String getTenantId(); + + /** + * @see Builder#name(String) + */ + @Nullable public abstract String getName(); + + /** + * @see Builder#description(String) + */ + @Nullable public abstract String getDescription(); + + /** + * @see Builder#adminStateUp(Boolean) + */ + @Nullable public abstract Boolean getAdminStateUp(); + + /** + * @see Builder#firewallPolicyId(String) + */ + @Nullable public abstract String getFirewallPolicyId(); + + @SerializedNames({ "tenant_id", "name", "description", "admin_state_up", "firewall_policy_id"}) + public static CreateFirewall create(String tenantId, String name, String description, Boolean adminStateUp, String firewallPolicyId) { + return builder().tenantId(tenantId).name(name).description(description).adminStateUp(adminStateUp) + .firewallPolicyId(firewallPolicyId).build(); + } + + public static Builder builder() { + return new AutoValue_CreateFirewall.Builder(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + /** + * + * @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own. + * @return The CreateFirewall builder. + */ + public abstract Builder tenantId(String tenantId); + + /** + * + * @param name Human readable name for the firewall (255 characters limit). + * @return The CreateFirewall builder. + */ + public abstract Builder name(String name); + + /** + * + * @param description Human readable description for the firewall (1024 characters limit). + * @return The CreateFirewall builder. + */ + public abstract Builder description(String description); + + /** + * + * @param adminStateUp The administrative state of the firewall. If False (down), the firewall does not forward any packets. + * @return The CreateFirewall builder. + */ + public abstract Builder adminStateUp(Boolean adminStateUp); + + /** + * + * @param firewallPolicyId The firewall policy uuid that this firewall is associated with. This firewall implements the rules contained in the + * firewall policy represented by this uuid. + * + * @return The CreateFirewall builder. + */ + public abstract Builder firewallPolicyId(String firewallPolicyId); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getAdminStateUp(); + @Nullable public abstract String getFirewallPolicyId(); + + public abstract CreateFirewall build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallPolicy.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallPolicy.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallPolicy.java new file mode 100644 index 0000000..6418c0d --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallPolicy.java @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.util.List; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; +import com.google.common.collect.ImmutableList; + +/** + * Representation of creation options for an OpenStack Neutron Firewall Policy. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class CreateFirewallPolicy { + + /** + * @see Builder#tenantId(String) + */ + @Nullable public abstract String getTenantId(); + + /** + * @see Builder#name(String) + */ + @Nullable public abstract String getName(); + + /** + * @see Builder#description(String) + */ + @Nullable public abstract String getDescription(); + + /** + * @see Builder#shared(Boolean) + */ + @Nullable public abstract Boolean getShared(); + + /** + * @see Builder#firewallRules(java.util.List) + */ + @Nullable public abstract List<String> getFirewallRules(); + + /** + * @see Builder#audited(Boolean) + */ + @Nullable public abstract Boolean getAudited(); + + @SerializedNames({"tenant_id", "name", "description", "shared", "firewall_rules", "audited"}) + private static CreateFirewallPolicy create(String tenantId, String name, String description, Boolean shared, List<String> firewallRules, Boolean audited) { + return builder().tenantId(tenantId).name(name).description(description).shared(shared).firewallRules(firewallRules).audited(audited).build(); + } + + public static Builder builder() { + return new AutoValue_CreateFirewallPolicy.Builder().shared(false).audited(false); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + /** + * + * @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own. + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder tenantId(String tenantId); + + /** + * + * @param name Human readable name for the firewall (255 characters limit). + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder name(String name); + + /** + * + * @param description Human readable description for the firewall (1024 characters limit). + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder description(String description); + + /** + * + * @param shared When set to True makes this firewall policy visible to tenants other than its owner and + * can be used to associate with firewalls not owned by its tenant. + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder shared(Boolean shared); + + /** + * + * @param firewallRules This is an ordered list of firewall rule uuids. + * The firewall applies the rules in the order in which they appear in this list. + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder firewallRules(List<String> firewallRules); + + /** + * + * @param audited When set to True by the policy owner indicates that the firewall policy has been audited. This attribute is meant to aid in the + * firewall policy audit work flows. Each time the firewall policy or the associated firewall rules are changed, this attribute is set + * to False and must be explicitly set to True through an update operation. + * @return The CreateFirewallPolicy builder. + */ + public abstract Builder audited(Boolean audited); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract List<String> getFirewallRules(); + @Nullable public abstract Boolean getAudited(); + + abstract CreateFirewallPolicy autoBuild(); + + public CreateFirewallPolicy build() { + firewallRules(getFirewallRules() != null ? ImmutableList.copyOf(getFirewallRules()) : ImmutableList.<String>of()); + return autoBuild(); + } + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallRule.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallRule.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallRule.java new file mode 100644 index 0000000..0e7bdbe --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/CreateFirewallRule.java @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +/** + * Representation of creation options for an OpenStack Neutron Firewall Rule. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class CreateFirewallRule { + + /** + * @see Builder#tenantId(String) + */ + @Nullable public abstract String getTenantId(); + /** + * @see Builder#name(String) + */ + @Nullable public abstract String getName(); + /** + * @see Builder#description(String) + */ + @Nullable public abstract String getDescription(); + /** + * @see Builder#firewallPolicyId(String) + */ + @Nullable public abstract String getFirewallPolicyId(); + /** + * @see Builder#shared(Boolean) + */ + @Nullable public abstract Boolean getShared(); + /** + * @see Builder#protocol(String) + */ + @Nullable public abstract String getProtocol(); + /** + * @see Builder#ipVersion(IpVersion) + */ + @Nullable public abstract IpVersion getIpVersion(); + /** + * @see Builder#sourceIpAddress(String) + */ + @Nullable public abstract String getSourceIpAddress(); + /** + * @see Builder#destinationIpAddress(String) + */ + @Nullable public abstract String getDestinationIpAddress(); + /** + * @see Builder#sourcePort(String) + */ + @Nullable public abstract String getSourcePort(); + /** + * @see Builder#destinationPort(String) + */ + @Nullable public abstract String getDestinationPort(); + /** + * see Builder#position(Integer) + */ + @Nullable public abstract Integer getPosition(); + /** + * @see Builder#action(String) + */ + @Nullable public abstract String getAction(); + /** + * @see Builder#enabled(Boolean) + */ + @Nullable public abstract Boolean getEnabled(); + + @SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", + "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) + public static CreateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol, + IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, + String action, Boolean enabled) { + return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared) + .protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort) + .destinationPort(destinationPort).position(position).action(action).enabled(enabled).build(); + } + + public static Builder builder() { + return new AutoValue_CreateFirewallRule.Builder(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + /** + * + * @param tenantId Owner of the firewall. Only admin users can specify a tenant_id other than its own. + * @return The CreateFirewallRule builder. + */ + public abstract Builder tenantId(String tenantId); + + /** + * + * @param name Human readable name for the firewall (255 characters limit). + * @return The CreateFirewallRule builder. + */ + public abstract Builder name(String name); + + /** + * + * @param description Human readable description for the firewall (1024 characters limit). + * @return The CreateFirewallRule builder. + */ + public abstract Builder description(String description); + + /** + * + * @param shared When set to True makes this firewall policy visible to tenants other than its owner and + * can be used to associate with firewalls not owned by its tenant. + * @return The CreateFirewallRule builder. + */ + public abstract Builder shared(Boolean shared); + + /** + * + * @param firewallPolicyId This is a read-only attribute that gets populated with the uuid of the firewall policy when this firewall rule is associated + * with a firewall policy. A firewall rule can be associated with only one firewall policy at a time. However, the association + * can be changed to a different firewall policy. + * @return The CreateFirewallRule builder. + */ + public abstract Builder firewallPolicyId(String firewallPolicyId); + + /** + * + * @param protocol IP protocol (icmp, tcp, udp, None). + * @return The CreateFirewallRule builder. + */ + public abstract Builder protocol(String protocol); + + /** + * + * @param ipVersion IP version (4, 6). + * @return The CreateFirewallRule builder. + */ + public abstract Builder ipVersion(IpVersion ipVersion); + + /** + * + * @param sourceIpAddress Source IP address or CIDR. + * @return The CreateFirewallRule builder. + */ + public abstract Builder sourceIpAddress(String sourceIpAddress); + + /** + * + * @param destinationIpAddress Destination IP address or CIDR. + * @return The CreateFirewallRule builder. + */ + public abstract Builder destinationIpAddress(String destinationIpAddress); + + /** + * + * @param sourcePort Source port number or a range. + * @return The CreateFirewallRule builder. + */ + public abstract Builder sourcePort(String sourcePort); + + /** + * + * @param destinationPort Destination port number or a range. + * @return The CreateFirewallRule builder. + */ + public abstract Builder destinationPort(String destinationPort); + + /** + * + * @param position This is a read-only attribute that gets assigned to this rule when the rule is associated with a firewall policy. It indicates the + * position of this rule in that firewall policy. + * @return The CreateFirewallRule builder. + */ + public abstract Builder position(Integer position); + + /** + * + * @param action Action to be performed on the traffic matching the rule (allow, deny). + * @return The CreateFirewallRule builder. + */ + public abstract Builder action(String action); + + /** + * + * @param enabled When set to False, disables this rule in the firewall policy. Facilitates selectively turning off rules without having to + * disassociate the rule from the firewall policy. + * @return The CreateFirewallRule builder. + */ + public abstract Builder enabled(Boolean enabled); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract String getFirewallPolicyId(); + @Nullable public abstract String getProtocol(); + @Nullable public abstract IpVersion getIpVersion(); + @Nullable public abstract String getSourceIpAddress(); + @Nullable public abstract String getDestinationIpAddress(); + @Nullable public abstract String getSourcePort(); + @Nullable public abstract String getDestinationPort(); + @Nullable public abstract Integer getPosition(); + @Nullable public abstract String getAction(); + @Nullable public abstract Boolean getEnabled(); + + public abstract CreateFirewallRule build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewall.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewall.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewall.java new file mode 100644 index 0000000..e9e8e6e --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewall.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +/** + * A Firewall + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class Firewall { + + public abstract String getId(); + public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean isAdminStateUp(); + public abstract String getStatus(); + @Nullable public abstract String getFirewallPolicyId(); + + @SerializedNames({"id", "tenant_id", "name", "description", "admin_state_up", "status", "firewall_policy_id"}) + public static Firewall create(String id, String tenantId, String name, String description, Boolean adminStateUp, String status, String firewallPolicyId) { + return new AutoValue_Firewall(id, tenantId, name, description, adminStateUp, status, firewallPolicyId); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicies.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicies.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicies.java new file mode 100644 index 0000000..1dbf429 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicies.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.beans.ConstructorProperties; + +import org.jclouds.openstack.v2_0.domain.Link; +import org.jclouds.openstack.v2_0.domain.PaginatedCollection; + +import com.google.common.collect.ImmutableSet; + +/** + * A collection of FirewallPolicies + */ +public class FirewallPolicies extends PaginatedCollection<FirewallPolicy> { + public static final FirewallPolicies EMPTY = new FirewallPolicies(ImmutableSet.<FirewallPolicy> of(), ImmutableSet.<Link> of()); + + @ConstructorProperties({"firewall_policies", "firewall_policies_links"}) + protected FirewallPolicies(Iterable<FirewallPolicy> firewallPolicies, Iterable<Link> firewallPoliciesLinks) { + super(firewallPolicies, firewallPoliciesLinks); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicy.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicy.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicy.java new file mode 100644 index 0000000..d0f2fec --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallPolicy.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.util.List; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +/** + * A firewall policy + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api doc</a> + */ +@AutoValue +public abstract class FirewallPolicy { + + public abstract String getId(); + public abstract String getTenantId(); + public abstract String getName(); + @Nullable public abstract String getDescription(); + public abstract boolean isShared(); + @Nullable public abstract List<String> getFirewallRules(); + public abstract boolean isAudited(); + + @SerializedNames({"id", "tenant_id", "name", "description", "shared", "firewall_rules", "audited"}) + private static FirewallPolicy create(String id, String tenantId, String name, String description, boolean shared, List<String> firewallRules, boolean audited) { + return new AutoValue_FirewallPolicy(id, tenantId, name, description, shared, firewallRules, audited); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRule.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRule.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRule.java new file mode 100644 index 0000000..0bc23de --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRule.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +@AutoValue +public abstract class FirewallRule { + + public abstract String getId(); + public abstract String getTenantId(); + public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract String getFirewallPolicyId(); + public abstract boolean isShared(); + @Nullable public abstract String getProtocol(); + @Nullable public abstract IpVersion getIpVersion(); + @Nullable public abstract String getSourceIpAddress(); + @Nullable public abstract String getDestinationIpAddress(); + @Nullable public abstract String getSourcePort(); + @Nullable public abstract String getDestinationPort(); + @Nullable public abstract Integer getPosition(); // for AutoValue.builder + @Nullable public abstract String getAction(); + public abstract boolean isEnabled(); + + @SerializedNames({"id", "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", + "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) + public static FirewallRule create(String id, String tenantId, String name, String description, String firewallPolicyId, boolean shared, String protocol, + IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, + String action, boolean enabled) { + return new AutoValue_FirewallRule(id, tenantId, name, description, firewallPolicyId, shared, protocol, ipVersion, sourceIpAddress, + destinationIpAddress, sourcePort, destinationPort, position, action, enabled); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java new file mode 100644 index 0000000..79281b8 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/FirewallRules.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.beans.ConstructorProperties; + +import org.jclouds.openstack.v2_0.domain.Link; +import org.jclouds.openstack.v2_0.domain.PaginatedCollection; + +import com.google.common.collect.ImmutableSet; + +/** + * A collection of FirewallRules + */ +public class FirewallRules extends PaginatedCollection<FirewallRule> { + public static final FirewallRules EMPTY = new FirewallRules(ImmutableSet.<FirewallRule> of(), ImmutableSet.<Link> of()); + + @ConstructorProperties({"firewall_rules", "firewall_rules_links"}) + protected FirewallRules(Iterable<FirewallRule> firewallRules, Iterable<Link> firewallRulesLinks) { + super(firewallRules, firewallRulesLinks); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java new file mode 100644 index 0000000..739e0e2 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/Firewalls.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.beans.ConstructorProperties; + +import org.jclouds.openstack.v2_0.domain.Link; +import org.jclouds.openstack.v2_0.domain.PaginatedCollection; + +import com.google.common.collect.ImmutableSet; + +/** + * A collection of Firewalls + */ +public class Firewalls extends PaginatedCollection<Firewall> { + public static final Firewalls EMPTY = new Firewalls(ImmutableSet.<Firewall> of(), ImmutableSet.<Link> of()); + + @ConstructorProperties({"firewalls", "firewalls_links"}) + protected Firewalls(Iterable<Firewall> firewalls, Iterable<Link> firewallsLinks) { + super(firewalls, firewallsLinks); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java new file mode 100644 index 0000000..c1be347 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/IpVersion.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +public enum IpVersion { + + IPV4(4), + IPV6(6), + UNRECOGNIZED(Integer.MAX_VALUE);; + + private final int version; + + IpVersion(int version) { + this.version = version; + } + + public int version() { + return this.version; + } + + public static IpVersion fromValue(String value) { + try { + int statusCode = Integer.parseInt(value); + switch (statusCode) { + case 4: + return IpVersion.IPV4; + case 6: + return IpVersion.IPV6; + default: + return IpVersion.IPV4; + } + } catch (NumberFormatException e) { + return IpVersion.UNRECOGNIZED; + } + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java new file mode 100644 index 0000000..10f5cab --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewall.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + + +/** + * Representation of update options for an OpenStack Neutron Firewall. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class UpdateFirewall { + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getAdminStateUp(); + @Nullable public abstract String getFirewallPolicyId(); + + @SerializedNames({"tenant_id", "name", "description", "admin_state_up", "firewall_policy_id"}) + public static UpdateFirewall create(String tenantId, String name, String description, Boolean adminStateUp, String firewallPolicyId) { + return builder().tenantId(tenantId).name(name).description(description).adminStateUp(adminStateUp).firewallPolicyId(firewallPolicyId).build(); + } + + public static Builder builder() { + return new AutoValue_UpdateFirewall.Builder(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder tenantId(String tenantId); + public abstract Builder name(String name); + public abstract Builder description(String description); + public abstract Builder adminStateUp(Boolean adminStateUp); + public abstract Builder firewallPolicyId(String firewallPolicyId); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getAdminStateUp(); + @Nullable public abstract String getFirewallPolicyId(); + + public abstract UpdateFirewall build(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java new file mode 100644 index 0000000..3791b34 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallPolicy.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import java.util.List; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; +import com.google.common.collect.ImmutableList; + +/** + * Representation of update options for an OpenStack Neutron Firewall Policy. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class UpdateFirewallPolicy { + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract List<String> getFirewallRules(); + @Nullable public abstract Boolean getAudited(); + + @SerializedNames({"tenant_id", "name", "description", "shared", "firewall_rules", "audited"}) + private static UpdateFirewallPolicy create(String tenantId, String name, String description, Boolean shared, List<String> firewallRules, Boolean audited) { + return builder().tenantId(tenantId).name(name).description(description).shared(shared).firewallRules(firewallRules).audited(audited).build(); + } + + public static Builder builder() { + return new AutoValue_UpdateFirewallPolicy.Builder().shared(false).audited(false); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder tenantId(String tenantId); + public abstract Builder name(String name); + public abstract Builder description(String description); + public abstract Builder shared(Boolean shared); + public abstract Builder firewallRules(List<String> firewallRules); + public abstract Builder audited(Boolean audited); + + abstract UpdateFirewallPolicy autoBuild(); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract List<String> getFirewallRules(); + @Nullable public abstract Boolean getAudited(); + + public UpdateFirewallPolicy build() { + firewallRules(getFirewallRules() != null ? ImmutableList.copyOf(getFirewallRules()) : ImmutableList.<String>of()); + return autoBuild(); + } + + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java new file mode 100644 index 0000000..b66e902 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/domain/UpdateFirewallRule.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import com.google.auto.value.AutoValue; + +/** + * Representation of update options for an OpenStack Neutron Firewall Rule. + * + * @see <a + * href="http://docs.openstack.org/admin-guide-cloud/content/fwaas_api_abstractions.html">api + * doc</a> + */ +@AutoValue +public abstract class UpdateFirewallRule { + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract String getFirewallPolicyId(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract String getProtocol(); + @Nullable public abstract IpVersion getIpVersion(); + @Nullable public abstract String getSourceIpAddress(); + @Nullable public abstract String getDestinationIpAddress(); + @Nullable public abstract String getSourcePort(); + @Nullable public abstract String getDestinationPort(); + @Nullable public abstract Integer getPosition(); + @Nullable public abstract String getAction(); + @Nullable public abstract Boolean getEnabled(); + + @SerializedNames({ "tenant_id", "name", "description", "firewall_policy_id", "shared", "protocol", "ip_version", "source_ip_address", + "destination_ip_address", "source_port", "destination_port", "position", "action", "enabled"}) + public static UpdateFirewallRule create(String tenantId, String name, String description, String firewallPolicyId, Boolean shared, String protocol, + IpVersion ipVersion, String sourceIpAddress, String destinationIpAddress, String sourcePort, String destinationPort, int position, + String action, Boolean enabled) { + return builder().tenantId(tenantId).name(name).description(description).firewallPolicyId(firewallPolicyId).shared(shared) + .protocol(protocol).ipVersion(ipVersion).sourceIpAddress(sourceIpAddress).destinationIpAddress(destinationIpAddress).sourcePort(sourcePort) + .destinationPort(destinationPort).position(position).action(action).enabled(enabled).build(); + } + + public static Builder builder() { + return new AutoValue_UpdateFirewallRule.Builder().shared(false).enabled(false).position(null); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder tenantId(String tenantId); + public abstract Builder name(String name); + public abstract Builder description(String description); + public abstract Builder firewallPolicyId(String firewallPolicyId); + public abstract Builder shared(Boolean shared); + public abstract Builder protocol(String protocol); + public abstract Builder ipVersion(IpVersion ipVersion); + public abstract Builder sourceIpAddress(String sourceIpAddress); + public abstract Builder destinationIpAddress(String destinationIpAddress); + public abstract Builder sourcePort(String sourcePort); + public abstract Builder destinationPort(String destinationPort); + public abstract Builder position(Integer position); + public abstract Builder action(String action); + public abstract Builder enabled(Boolean enabled); + + @Nullable public abstract String getTenantId(); + @Nullable public abstract String getName(); + @Nullable public abstract String getDescription(); + @Nullable public abstract String getFirewallPolicyId(); + @Nullable public abstract Boolean getShared(); + @Nullable public abstract String getProtocol(); + @Nullable public abstract IpVersion getIpVersion(); + @Nullable public abstract String getSourceIpAddress(); + @Nullable public abstract String getDestinationIpAddress(); + @Nullable public abstract String getSourcePort(); + @Nullable public abstract String getDestinationPort(); + @Nullable public abstract Integer getPosition(); + @Nullable public abstract String getAction(); + @Nullable public abstract Boolean getEnabled(); + + public abstract UpdateFirewallRule build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java index 60d23a3..2130972 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/ExtensionNamespaces.java @@ -32,6 +32,10 @@ public final class ExtensionNamespaces { * LBaaS Extension. */ public static final String LBAAS = "http://wiki.openstack.org/neutron/LBaaS/API_1.0"; + /** + * FWaaS Extension. + */ + public static final String FWAAS = "http://wiki.openstack.org/Neutron/FWaaS/API_1.0"; private ExtensionNamespaces() { throw new AssertionError("intentionally unimplemented"); http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java new file mode 100644 index 0000000..6c5338f --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/extensions/FWaaSApi.java @@ -0,0 +1,253 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.extensions; + +import static org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; +import static org.jclouds.Fallbacks.FalseOnNotFoundOr404; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; + +import javax.inject.Named; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; + +import org.jclouds.collect.PagedIterable; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404; +import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; +import org.jclouds.openstack.neutron.v2.domain.CreateFirewall; +import org.jclouds.openstack.neutron.v2.domain.CreateFirewallPolicy; +import org.jclouds.openstack.neutron.v2.domain.CreateFirewallRule; +import org.jclouds.openstack.neutron.v2.domain.Firewall; +import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy; +import org.jclouds.openstack.neutron.v2.domain.FirewallRule; +import org.jclouds.openstack.neutron.v2.domain.UpdateFirewall; +import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallPolicy; +import org.jclouds.openstack.neutron.v2.domain.UpdateFirewallRule; +import org.jclouds.openstack.neutron.v2.functions.FirewallPolicyToPagedIterable; +import org.jclouds.openstack.neutron.v2.functions.FirewallRuleToPagedIterable; +import org.jclouds.openstack.neutron.v2.functions.FirewallToPagedIterable; +import org.jclouds.openstack.neutron.v2.functions.ParseFirewallPolicies; +import org.jclouds.openstack.neutron.v2.functions.ParseFirewallRules; +import org.jclouds.openstack.neutron.v2.functions.ParseFirewalls; +import org.jclouds.openstack.v2_0.ServiceType; +import org.jclouds.openstack.v2_0.domain.PaginatedCollection; +import org.jclouds.openstack.v2_0.options.PaginationOptions; +import org.jclouds.openstack.v2_0.services.Extension; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.Transform; +import org.jclouds.rest.annotations.WrapWith; + +import com.google.common.annotations.Beta; + +/** + * The FWaaS extension provides OpenStack users with the ability to deploy firewalls to protect their networks. + * <p/> + * + * @see <a href= + * "http://specs.openstack.org/openstack/neutron-specs/specs/api/firewall_as_a_service__fwaas_.html">api doc</a> + */ +@Beta +@Path("/fw") +@RequestFilters(AuthenticateRequest.class) +@Consumes(MediaType.APPLICATION_JSON) +@Extension(of = ServiceType.NETWORK, namespace = ExtensionNamespaces.FWAAS) +public interface FWaaSApi { + + /** + * Returns the list of all routers currently defined in Neutron for the current tenant. The list provides the unique + * identifier of each firewall configured for the tenant + * + * @return the list of all firewall references configured for the tenant. + */ + @Named("fw:list") + @GET + @Transform(FirewallToPagedIterable.class) + @ResponseParser(ParseFirewalls.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + @Path("/firewalls") + PagedIterable<Firewall> list(); + + /** + * @return the list of all firewall references configured for the tenant. + */ + @Named("firewall:list") + @GET + @ResponseParser(ParseFirewalls.class) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/firewalls") + PaginatedCollection<Firewall> list(PaginationOptions options); + + /** + * Returns the details for a specific firewall. + * + * @param id the id of the firewall to return + * @return firewall or empty if not found + */ + @Named("firewall:get") + @GET + @Path("/firewalls/{id}") + @SelectJson("firewall") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + Firewall get(@PathParam("id") String id); + + /** + * Create a new firewall + * + * @param firewall Options for creating a firewall + * @return the newly created firewall + */ + @Named("firewall:create") + @POST + @SelectJson("firewall") + @Path("/firewalls") + Firewall create(@WrapWith("firewall") CreateFirewall firewall); + + /** + * Update a firewall + * + * @param id the id of the firewall to update + * @param updateFirewall Contains only the attributes to update + * @return The modified firewall + */ + @Named("firewall:update") + @PUT + @Path("/firewalls/{id}") + @SelectJson("firewall") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + Firewall update(@PathParam("id") String id, @WrapWith("firewall") UpdateFirewall updateFirewall); + + /** + * Deletes the specified firewall + * + * @param id the id of the firewall to delete + * @return true if delete successful, false if not + */ + @Named("firewall:delete") + @DELETE + @Path("/firewalls/{id}") + @Fallback(FalseOnNotFoundOr404.class) + boolean delete(@PathParam("id") String id); + + @Named("firewall:createPolicy") + @POST + @SelectJson("firewall_policy") + @Path("/firewall_policies") + FirewallPolicy createFirewallPolicy(@WrapWith("firewall_policy") CreateFirewallPolicy firewallPolicy); + + @Named("firewall:listPolicies") + @GET + @Transform(FirewallPolicyToPagedIterable.class) + @ResponseParser(ParseFirewallPolicies.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + @Path("/firewall_policies") + PagedIterable<FirewallPolicy> listFirewallPolicies(); + + @Named("firewall:listPolicies") + @GET + @ResponseParser(ParseFirewallPolicies.class) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/firewall_policies") + PaginatedCollection<FirewallPolicy> listFirewallPolicies(PaginationOptions options); + + @Named("firewall:getPolicy") + @GET + @SelectJson("firewall_policy") + @Fallback(NullOnNotFoundOr404.class) + @Path("/firewall_policies/{id}") + FirewallPolicy getFirewallPolicy(@PathParam("id") String id); + + @Named("firewall:updatePolicy") + @PUT + @SelectJson("firewall_policy") + @Fallback(NullOnNotFoundOr404.class) + @Path("/firewall_policies/{id}") + FirewallPolicy updateFirewallPolicy(@PathParam("id") String id, @WrapWith("firewall_policy") UpdateFirewallPolicy updateFirewallPolicy); + + @Named("firewall:deletePolicy") + @DELETE + @Path("/firewall_policies/{id}") + boolean deleteFirewallPolicy(@PathParam("id") String id); + + @Named("firewall:createFirewallRule") + @POST + @SelectJson("firewall_rule") + @Path("/firewall_rules") + FirewallRule createFirewallRule(@WrapWith("firewall_rule") CreateFirewallRule firewallRule); + + @Named("firewall:listFirewallRules") + @GET + @Transform(FirewallRuleToPagedIterable.class) + @ResponseParser(ParseFirewallRules.class) + @Fallback(EmptyPagedIterableOnNotFoundOr404.class) + @Path("/firewall_rules") + PagedIterable<FirewallRule> listFirewallRules(); + + @Named("firewall:listFirewallRules") + @GET + @ResponseParser(ParseFirewallRules.class) + @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) + @Path("/firewall_rules") + PaginatedCollection<FirewallRule> listFirewallRules(PaginationOptions options); + + @Named("firewall:getFirewallRule") + @GET + @Path("/firewall_rules/{id}") + @SelectJson("firewall_rule") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FirewallRule getFirewallRule(@PathParam("id") String firewallRuleId); + + @Named("firewall:updateFirewallRule") + @PUT + @Path("/firewall_rules/{id}") + @SelectJson("firewall_rule") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FirewallRule updateFirewallRule(@PathParam("id") String id, @WrapWith("firewall_rule") UpdateFirewallRule updateFirewallRule); + + @Named("firewall:deleteFirewallRule") + @DELETE + @Path("/firewall_rules/{id}") + @Fallback(FalseOnNotFoundOr404.class) + boolean deleteFirewallRule(@PathParam("id") String id); + + @Named("firewall:insertFirewallRuleToPolicy") + @PUT + @Path("/firewall_policies/{id}/insert_rule") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FirewallPolicy insertFirewallRuleToPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId); + + @Named("firewall:removeFirewallRuleFromPolicy") + @DELETE + @Path("/firewall_policies/{id}/remove_rule") + @Fallback(NullOnNotFoundOr404.class) + @Nullable + FirewallPolicy removeFirewallRuleFromPolicy(@PathParam("id") String policyId, @WrapWith("firewall_rule_id") String firewallRuleId); + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java new file mode 100644 index 0000000..f70a83d --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallPolicyToPagedIterable.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import javax.inject.Inject; + +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.internal.Arg0ToPagedIterable; +import org.jclouds.openstack.neutron.v2.NeutronApi; +import org.jclouds.openstack.neutron.v2.domain.FirewallPolicy; +import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; + +import com.google.common.base.Function; +import com.google.common.base.Optional; + +/** + * Ensures FirewallRule works as PagedIterable. + */ +public class FirewallPolicyToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallPolicy, FirewallPolicyToPagedIterable> { + + private final NeutronApi api; + + @Inject + protected FirewallPolicyToPagedIterable(NeutronApi api) { + this.api = checkNotNull(api, "api"); + } + + @Override + protected Function<Object, IterableWithMarker<FirewallPolicy>> markerToNextForArg0(Optional<Object> arg0) { + String region = arg0.isPresent() ? arg0.get().toString() : null; + final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); + return new Function<Object, IterableWithMarker<FirewallPolicy>>() { + + @SuppressWarnings("unchecked") + @Override + public IterableWithMarker<FirewallPolicy> apply(Object input) { + return IterableWithMarker.class.cast(firewallApi.listFirewallPolicies()); + } + + @Override + public String toString() { + return "listFirewallPolicies()"; + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java new file mode 100644 index 0000000..eff4dc1 --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallRuleToPagedIterable.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import javax.inject.Inject; + +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.internal.Arg0ToPagedIterable; +import org.jclouds.openstack.neutron.v2.NeutronApi; +import org.jclouds.openstack.neutron.v2.domain.FirewallRule; +import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; + +import com.google.common.base.Function; +import com.google.common.base.Optional; + +/** + * Ensures FirewallRule works as PagedIterable. + */ +public class FirewallRuleToPagedIterable extends Arg0ToPagedIterable.FromCaller<FirewallRule, FirewallRuleToPagedIterable> { + + private final NeutronApi api; + + @Inject + protected FirewallRuleToPagedIterable(NeutronApi api) { + this.api = checkNotNull(api, "api"); + } + + @Override + protected Function<Object, IterableWithMarker<FirewallRule>> markerToNextForArg0(Optional<Object> arg0) { + String region = arg0.isPresent() ? arg0.get().toString() : null; + final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); + return new Function<Object, IterableWithMarker<FirewallRule>>() { + + @SuppressWarnings("unchecked") + @Override + public IterableWithMarker<FirewallRule> apply(Object input) { + return IterableWithMarker.class.cast(firewallApi.listFirewallRules()); + } + + @Override + public String toString() { + return "listFirewallRules()"; + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java new file mode 100644 index 0000000..5d6892a --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/FirewallToPagedIterable.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import javax.inject.Inject; + +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.collect.internal.Arg0ToPagedIterable; +import org.jclouds.openstack.neutron.v2.NeutronApi; +import org.jclouds.openstack.neutron.v2.domain.Firewall; +import org.jclouds.openstack.neutron.v2.extensions.FWaaSApi; + +import com.google.common.base.Function; +import com.google.common.base.Optional; + +/** + * Ensures Firewall works as PagedIterable. + */ +public class FirewallToPagedIterable extends Arg0ToPagedIterable.FromCaller<Firewall, FirewallToPagedIterable> { + + private final NeutronApi api; + + @Inject + protected FirewallToPagedIterable(NeutronApi api) { + this.api = checkNotNull(api, "api"); + } + + @Override + protected Function<Object, IterableWithMarker<Firewall>> markerToNextForArg0(Optional<Object> arg0) { + String region = arg0.isPresent() ? arg0.get().toString() : null; + final FWaaSApi firewallApi = api.getFWaaSApi(region).get(); + return new Function<Object, IterableWithMarker<Firewall>>() { + + @SuppressWarnings("unchecked") + @Override + public IterableWithMarker<Firewall> apply(Object input) { + return IterableWithMarker.class.cast(firewallApi.list()); + } + + @Override + public String toString() { + return "listFirewalls()"; + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java new file mode 100644 index 0000000..4773e2b --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallPolicies.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.http.functions.ParseJson; +import org.jclouds.json.Json; +import org.jclouds.openstack.neutron.v2.domain.FirewallPolicies; + +import com.google.inject.TypeLiteral; + +/** + * Used by jclouds to provide more specific collections and fallbacks. + */ +@Singleton +public class ParseFirewallPolicies extends ParseJson<FirewallPolicies> { + + @Inject + public ParseFirewallPolicies(Json json) { + super(json, TypeLiteral.get(FirewallPolicies.class)); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java new file mode 100644 index 0000000..126a2ce --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewallRules.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.http.functions.ParseJson; +import org.jclouds.json.Json; +import org.jclouds.openstack.neutron.v2.domain.FirewallRules; + +import com.google.inject.TypeLiteral; + +/** + * Used by jclouds to provide more specific collections and fallbacks. + */ +@Singleton +public class ParseFirewallRules extends ParseJson<FirewallRules> { + + @Inject + public ParseFirewallRules(Json json) { + super(json, TypeLiteral.get(FirewallRules.class)); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/289cce04/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java ---------------------------------------------------------------------- diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java new file mode 100644 index 0000000..89208cd --- /dev/null +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/functions/ParseFirewalls.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.jclouds.openstack.neutron.v2.functions; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.http.functions.ParseJson; +import org.jclouds.json.Json; +import org.jclouds.openstack.neutron.v2.domain.Firewalls; + +import com.google.inject.TypeLiteral; + +/** + * Used by jclouds to provide more specific collections and fallbacks. + */ +@Singleton +public class ParseFirewalls extends ParseJson<Firewalls> { + + @Inject + public ParseFirewalls(Json json) { + super(json, TypeLiteral.get(Firewalls.class)); + } +}
