http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java new file mode 100644 index 0000000..5417065 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VIFType.java @@ -0,0 +1,62 @@ +/* + * 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 VIFType { + UNBOUND("unbound"), + BINDING_FAILED("binding_failed"), + IOVISOR("iovisor"), + OVS("ovs"), + BRIDGE("bridge"), + _802_QBG("802.1qbg"), + _802_QBH("802.1qbh"), + HYPERV("hyperv"), + MIDONET("midonet"), + MLNX_DIRECT("mlnx_direct"), + MLNX_HOSTDEV("hostdev"), + OTHER("other"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private VIFType(String name) { + this.name = name; + } + + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static VIFType fromValue(String name){ + if (name != null) { + for (VIFType value : VIFType.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java new file mode 100644 index 0000000..80fd4aa --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/VNICType.java @@ -0,0 +1,56 @@ +/* + * 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; + +/** + * Enumerates supported VNIC types. + */ +public enum VNICType { + NORMAL("normal"), + DIRECT("direct"), + MACVTAP("macvtap"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private VNICType(String name) { + this.name = name; + } + + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static VNICType fromValue(String name){ + if (name != null) { + for (VNICType value : VNICType.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java new file mode 100644 index 0000000..593690d --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitor.java @@ -0,0 +1,450 @@ +/* + * 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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableList; + +/** + * A Neutron LBaaS v1 HealthMonitor. + */ +public class HealthMonitor { + + // Mandatory attributes when creating + @Named("tenant_id") + private String tenantId; + private ProbeType type; + // Mandatory attributes that can be updated + private Integer delay; + private Integer timeout; + @Named("max_retries") + private Integer maxRetries; + // Optional attributes that can be updated + @Named("http_method") + private HttpMethod httpMethod; + @Named("url_path") + private String urlPath; + @Named("expected_codes") + private String expectedCodes; + @Named("admin_state_up") + private Boolean adminStateUp; + // Read-only attributes + private String id; + private ImmutableList<PoolStatus> pools; + private LBaaSStatus status; + @Named("status_description") + private String statusDescription; + + /** + * Deserialization constructor + */ + @ConstructorProperties({ "id", "tenant_id", "type", "delay", "timeout", "max_retries", "http_method", "url_path", + "expected_codes", "pools", "admin_state_up", "status", "status_description" }) + private HealthMonitor(String id, String tenantId, ProbeType type, Integer delay, Integer timeout, + Integer maxRetries, HttpMethod httpMethod, String urlPath, String expectedCodes, + ImmutableList<PoolStatus> pools, Boolean adminStateUp, LBaaSStatus status, String statusDescription) { + this.id = id; + this.tenantId = tenantId; + this.type = type; + this.delay = delay; + this.timeout = timeout; + this.maxRetries = maxRetries; + this.httpMethod = httpMethod; + this.urlPath = urlPath; + this.expectedCodes = expectedCodes; + this.pools = pools; + this.adminStateUp = adminStateUp; + this.status = status; + this.statusDescription = statusDescription; + } + + /** + * Default constructor. + */ + private HealthMonitor() { + } + + /** + * Copy constructor. + * + * @param healthMonitor the HealthMonitor to copy from. + */ + private HealthMonitor(HealthMonitor healthMonitor) { + this(healthMonitor.id, healthMonitor.tenantId, healthMonitor.type, healthMonitor.delay, healthMonitor.timeout, + healthMonitor.maxRetries, healthMonitor.httpMethod, healthMonitor.urlPath, healthMonitor.expectedCodes, + healthMonitor.pools, healthMonitor.adminStateUp, healthMonitor.status, healthMonitor.statusDescription); + } + + /** + * @return the id of the HealthMonitor. + */ + @Nullable + public String getId() { + return id; + } + + /** + * @return the tenant id of the HealthMonitor. + */ + @Nullable + public String getTenantId() { + return tenantId; + } + + /** + * @return the probe type for this HealthMonitor. + */ + @Nullable + public ProbeType getType() { + return type; + } + + /** + * @return the delay for this HealthMonitor. + */ + @Nullable + public Integer getDelay() { + return delay; + } + + /** + * @return the timeout for this HealthMonitor. + */ + @Nullable + public Integer getTimeout() { + return timeout; + } + + /** + * @return the max retries for this HealthMonitor. + */ + @Nullable + public Integer getMaxRetries() { + return maxRetries; + } + + /** + * @return the HTTP method for this HealthMonitor. + */ + @Nullable + public HttpMethod getHttpMethod() { + return httpMethod; + } + + /** + * @return the URL path for this HealthMonitor. + */ + @Nullable + public String getUrlPath() { + return urlPath; + } + + /** + * @return the expected codes for this HealthMonitor. + */ + @Nullable + public String getExpectedCodes() { + return expectedCodes; + } + + /** + * @return the pools for this HealthMonitor. + */ + @Nullable + public ImmutableList<PoolStatus> getPools() { + return pools; + } + + /** + * @return the administrative state for this HealthMonitor. + */ + @Nullable + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @return the status for this HealthMonitor. + */ + @Nullable + public LBaaSStatus getStatus() { + return status; + } + + /** + * @return the status description for this HealthMonitor. + */ + @Nullable + public String getStatusDescription() { + return statusDescription; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + HealthMonitor that = (HealthMonitor) o; + + return Objects.equal(this.id, that.id) && Objects.equal(this.tenantId, that.tenantId) + && Objects.equal(this.type, that.type) && Objects.equal(this.delay, that.delay) + && Objects.equal(this.timeout, that.timeout) && Objects.equal(this.maxRetries, that.maxRetries) + && Objects.equal(this.httpMethod, that.httpMethod) && Objects.equal(this.urlPath, that.urlPath) + && Objects.equal(this.expectedCodes, that.expectedCodes) && Objects.equal(this.pools, that.pools) + && Objects.equal(this.adminStateUp, that.adminStateUp) && Objects.equal(this.status, that.status) + && Objects.equal(this.statusDescription, that.statusDescription); + } + + @Override + public int hashCode() { + return Objects.hashCode(id, tenantId, type, delay, timeout, maxRetries, httpMethod, urlPath, expectedCodes, + pools, adminStateUp, status, statusDescription); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).add("id", id).add("tenantId", tenantId).add("type", type) + .add("delay", delay).add("timeout", timeout).add("maxRetries", maxRetries).add("httpMethod", httpMethod) + .add("urlPath", urlPath).add("expectedCodes", expectedCodes).add("pools", pools) + .add("adminStateUp", adminStateUp).add("status", status).add("statusDescription", statusDescription) + .toString(); + } + + /* + * Methods to get the Create and Update builders follow. + */ + + /** + * @return the Builder for creating a new HealthMonitor. + */ + public static CreateBuilder createBuilder(ProbeType type, Integer delay, Integer timeout, Integer maxRetries) { + return new CreateBuilder(type, delay, timeout, maxRetries); + } + + /** + * @return the Builder for updating a HealthMonitor. + */ + public static UpdateBuilder updateBuilder() { + return new UpdateBuilder(); + } + + private abstract static class Builder<ParameterizedBuilderType> { + protected HealthMonitor healthMonitor; + + /** + * Default constructor. + */ + private Builder() { + healthMonitor = new HealthMonitor(); + } + + protected abstract ParameterizedBuilderType self(); + + /** + * Provides the delay for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getDelay() + */ + public ParameterizedBuilderType delay(Integer delay) { + healthMonitor.delay = delay; + return self(); + } + + /** + * Provides the timeout for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getTimeout() + */ + public ParameterizedBuilderType timeout(Integer timeout) { + healthMonitor.timeout = timeout; + return self(); + } + + /** + * Provides the max retries for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getMaxRetries() + */ + public ParameterizedBuilderType maxRetries(Integer maxRetries) { + healthMonitor.maxRetries = maxRetries; + return self(); + } + + /** + * Provides the HTTP method for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getHttpMethod() + */ + public ParameterizedBuilderType httpMethod(HttpMethod httpMethod) { + healthMonitor.httpMethod = httpMethod; + return self(); + } + + /** + * Provides the URL path for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getUrlPath() + */ + public ParameterizedBuilderType urlPath(String urlPath) { + healthMonitor.urlPath = urlPath; + return self(); + } + + /** + * Provides the expected codes for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getExpectedCodes() + */ + public ParameterizedBuilderType expectedCodes(String expectedCodes) { + healthMonitor.expectedCodes = expectedCodes; + return self(); + } + + /** + * Provides the administrative state for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getAdminStateUp() + */ + public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { + healthMonitor.adminStateUp = adminStateUp; + return self(); + } + } + + /** + * Create builder (inheriting from Builder). + */ + public static class CreateBuilder extends Builder<CreateBuilder> { + /** + * Supply required properties for creating a HealthMonitor's CreateBuilder. + * + * @param type the probe type. + * @param delay the delay. + * @param timeout the timeout. + * @param maxRetries the max retries. + */ + private CreateBuilder(ProbeType type, Integer delay, Integer timeout, Integer maxRetries) { + type(type).delay(delay).timeout(timeout).maxRetries(maxRetries); + } + + /** + * Provides the tenantId for this HealthMonitor's CreateBuilder. Admin-only. + * When keystone is enabled, it is not mandatory to specify tenant_id for resources in create requests, as the + * tenant identifier will be derived from the Authentication token. Please note that the default authorization + * settings only allow administrative users to create resources on behalf of a different tenant. + * + * @return the Builder. + * @see HealthMonitor#getTenantId() + */ + public CreateBuilder tenantId(String tenantId) { + healthMonitor.tenantId = tenantId; + return self(); + } + + /** + * Provides the probe type for this HealthMonitor's Builder. + * + * @return the Builder. + * @see HealthMonitor#getType() + */ + public CreateBuilder type(ProbeType type) { + healthMonitor.type = type; + return self(); + } + + /** + * @return a CreateHealthMonitor constructed with this Builder. + */ + public CreateHealthMonitor build() { + return new CreateHealthMonitor(healthMonitor); + } + + @Override + protected CreateBuilder self() { + return this; + } + } + + /** + * Update builder (inheriting from Builder). + */ + public static class UpdateBuilder extends Builder<UpdateBuilder> { + /** + * Supply required properties for creating a HealthMonitor's UpdateBuilder. + */ + private UpdateBuilder() { + } + + /** + * @return an UpdateHealthMonitor constructed with this Builder. + */ + public UpdateHealthMonitor build() { + return new UpdateHealthMonitor(healthMonitor); + } + + @Override + protected UpdateBuilder self() { + return this; + } + } + + /** + * Create options - extend the domain class, passed to API create calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class CreateHealthMonitor extends HealthMonitor { + /** + * Copy constructor. + * + * @param healthMonitor the HealthMonitor to copy from. + */ + private CreateHealthMonitor(HealthMonitor healthMonitor) { + super(healthMonitor); + } + } + + /** + * Update options - extend the domain class, passed to API update calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class UpdateHealthMonitor extends HealthMonitor { + /** + * Copy constructor. + * + * @param healthMonitor the HealthMonitor to copy from. + */ + private UpdateHealthMonitor(HealthMonitor healthMonitor) { + super(healthMonitor); + } + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.java new file mode 100644 index 0000000..64e3aea --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitorStatus.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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; + +/** + * A Neutron LBaaS v1 HealthMonitorStatus. + * Contains an id and status describing the health monitor's status. + * + * @see Pool#getHealthMonitorsStatus() + */ +public class HealthMonitorStatus { + + // Mandatory attributes + @Named("monitor_id") + protected final String id; + protected final LBaaSStatus status; + // Optional attributes + @Named("status_description") + protected final String statusDescription; + + @ConstructorProperties({ "monitor_id", "status", "status_description" }) + protected HealthMonitorStatus(String id, LBaaSStatus status, String statusDescription) { + this.id = id; + this.status = status; + this.statusDescription = statusDescription; + } + + /** + * @return the id of the HealthMonitorStatus. + */ + @Nullable + public String getId() { + return id; + } + + /** + * @return the status of the HealthMonitorStatus + */ + @Nullable + public LBaaSStatus getStatus() { + return status; + } + + /** + * @return the status description of the HealthMonitorStatus + */ + @Nullable + public String getStatusDescription() { + return statusDescription; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, status, statusDescription); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + HealthMonitorStatus that = HealthMonitorStatus.class.cast(obj); + return Objects.equal(this.id, that.id) && Objects.equal(this.status, that.status) + && Objects.equal(this.statusDescription, that.statusDescription); + } + + protected Objects.ToStringHelper string() { + return Objects.toStringHelper(this).add("id", id).add("status", status) + .add("statusDescription", statusDescription); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java new file mode 100644 index 0000000..a254938 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HealthMonitors.java @@ -0,0 +1,37 @@ +/* + * 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.lbaas.v1; + +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 Neutron LBaaS v1 HealthMonitors. + */ +public class HealthMonitors extends PaginatedCollection<HealthMonitor> { + public static final HealthMonitors EMPTY = new HealthMonitors(ImmutableSet.<HealthMonitor> of(), + ImmutableSet.<Link> of()); + + @ConstructorProperties({ "health_monitors", "health_monitors_links" }) + protected HealthMonitors(Iterable<HealthMonitor> healthMonitors, Iterable<Link> healthMonitorsLinks) { + super(healthMonitors, healthMonitorsLinks); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java new file mode 100644 index 0000000..f795c66 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/HttpMethod.java @@ -0,0 +1,75 @@ +/* + * 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.lbaas.v1; + + +/** + * Enumerates supported HTTP methods used by probes of type HTTP/HTTPS that are sent by health monitor to verify member state. + */ +public enum HttpMethod { + /** + * Health monitor sends a GET HTTP request to the member. + */ + GET("GET"), + /** + * Health monitor sends a POST HTTP request to the member. + */ + POST("POST"), + /** + * Health monitor sends a PUT HTTP request to the member. + */ + PUT("PUT"), + /** + * Health monitor sends a DELETE HTTP request to the member. + */ + DELETE("DELETE"), + /** + * Health monitor sends a HEAD HTTP request to the member. + */ + HEAD("HEAD"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private HttpMethod(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static HttpMethod fromValue(String name){ + if (name != null) { + for (HttpMethod value : HttpMethod.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java new file mode 100644 index 0000000..85820fc --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/LBaaSStatus.java @@ -0,0 +1,78 @@ +/* + * 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.lbaas.v1; + +/** + * Enumerates supported Neutron LBaaS v1 resources status. + */ +public enum LBaaSStatus { + /** + * The LBaaS v1 resource is ready and active. + */ + ACTIVE("active"), + /** + * The LBaaS v1 resource is being created. + */ + PENDING_CREATE("pending_create"), + /** + * The LBaaS v1 resource is being updated. + */ + PENDING_UPDATE("pending_update"), + /** + * The LBaaS v1 resource is going to be deleted. + */ + PENDING_DELETE("pending_delete"), + /** + * The LBaaS v1 resource is created but not active. + */ + INACTIVE("inactive"), + /** + * The LBaaS v1 resource is in an error state. + */ + ERROR("error"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private LBaaSStatus(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static LBaaSStatus fromValue(String name){ + if (name != null) { + for (LBaaSStatus value : LBaaSStatus.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Member.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Member.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Member.java new file mode 100644 index 0000000..da53e23 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Member.java @@ -0,0 +1,367 @@ +/* + * 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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; + +/** + * A Neutron LBaaS v1 Member. + */ +public class Member { + + // Mandatory attributes when creating + @Named("tenant_id") + private String tenantId; + private String address; + @Named("protocol_port") + private Integer protocolPort; + // Mandatory attributes that can be updated + @Named("pool_id") + private String poolId; + // Optional attributes that can be updated + private Integer weight; + @Named("admin_state_up") + private Boolean adminStateUp; + // Read-only attributes + private String id; + private LBaaSStatus status; + @Named("status_description") + private String statusDescription; + + /** + * Deserialization constructor. + */ + @ConstructorProperties({ "id", "tenant_id", "pool_id", "address", "protocol_port", "weight", "admin_state_up", + "status", "status_description" }) + private Member(String id, String tenantId, String poolId, String address, Integer protocolPort, Integer weight, + Boolean adminStateUp, LBaaSStatus status, String statusDescription) { + this.id = id; + this.tenantId = tenantId; + this.poolId = poolId; + this.address = address; + this.protocolPort = protocolPort; + this.weight = weight; + this.adminStateUp = adminStateUp; + this.status = status; + this.statusDescription = statusDescription; + } + + /** + * Default constructor. + */ + private Member() { + } + + /** + * Copy constructor. + * + * @param member the Member to copy from. + */ + private Member(Member member) { + this(member.id, member.tenantId, member.poolId, member.address, member.protocolPort, member.weight, + member.adminStateUp, member.status, member.statusDescription); + } + + /** + * @return the id of the Member. + */ + @Nullable + public String getId() { + return id; + } + + /** + * @return the tenant id of the Member. + */ + @Nullable + public String getTenantId() { + return tenantId; + } + + /** + * @return the pool id for this Member. + */ + @Nullable + public String getPoolId() { + return poolId; + } + + /** + * @return the address for this Member. + */ + @Nullable + public String getAddress() { + return address; + } + + /** + * @return the protocol port for this Member. + */ + @Nullable + public Integer getProtocolPort() { + return protocolPort; + } + + /** + * @return the weight for this Member. + */ + @Nullable + public Integer getWeight() { + return weight; + } + + /** + * @return the administrative state for this Member. + */ + @Nullable + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @return the status for this Member. + */ + @Nullable + public LBaaSStatus getStatus() { + return status; + } + + /** + * @return the status description for this Member. + */ + @Nullable + public String getStatusDescription() { + return statusDescription; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + Member that = (Member) o; + + return Objects.equal(this.id, that.id) && Objects.equal(this.tenantId, that.tenantId) + && Objects.equal(this.poolId, that.poolId) && Objects.equal(this.address, that.address) + && Objects.equal(this.protocolPort, that.protocolPort) && Objects.equal(this.weight, that.weight) + && Objects.equal(this.adminStateUp, that.adminStateUp) && Objects.equal(this.status, that.status) + && Objects.equal(this.statusDescription, that.statusDescription); + } + + @Override + public int hashCode() { + return Objects.hashCode(id, tenantId, poolId, address, protocolPort, weight, adminStateUp, status, + statusDescription); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).add("id", id).add("tenantId", tenantId).add("poolId", poolId) + .add("address", address).add("protocolPort", protocolPort).add("weight", weight) + .add("adminStateUp", adminStateUp).add("status", status).add("statusDescription", statusDescription) + .toString(); + } + + /* + * Methods to get the Create and Update builders follow. + */ + + /** + * @return the Builder for creating a new Member. + */ + public static CreateBuilder createBuilder(String poolId, String address, Integer port) { + return new CreateBuilder(poolId, address, port); + } + + /** + * @return the Builder for updating a Member. + */ + public static UpdateBuilder updateBuilder() { + return new UpdateBuilder(); + } + + private abstract static class Builder<ParameterizedBuilderType> { + protected Member member; + + /** + * Default constructor. + */ + private Builder() { + member = new Member(); + } + + protected abstract ParameterizedBuilderType self(); + + /** + * Provides the pool id for this Member's Builder. + * + * @return the Builder. + * @see Member#getPoolId() + */ + public ParameterizedBuilderType poolId(String poolId) { + member.poolId = poolId; + return self(); + } + + /** + * Provides the weight for this Member's Builder. + * + * @return the Builder. + * @see Member#getWeight() + */ + public ParameterizedBuilderType weight(Integer weight) { + member.weight = weight; + return self(); + } + + /** + * Provides the administrative state for this Member's Builder. + * + * @return the Builder. + * @see Member#getAdminStateUp() + */ + public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { + member.adminStateUp = adminStateUp; + return self(); + } + } + + /** + * Create builder (inheriting from Builder). + */ + public static class CreateBuilder extends Builder<CreateBuilder> { + /** + * Supply required properties for creating a Member's CreateBuilder. + * + * @param poolId the pool id. + * @param address the IP address. + * @param port the protocol port. + */ + private CreateBuilder(String poolId, String address, Integer port) { + poolId(poolId).address(address).protocolPort(port); + } + + /** + * Provides the tenantId for this Member's Builder. Admin-only. + * When keystone is enabled, it is not mandatory to specify tenant_id for resources in create requests, as the + * tenant identifier will be derived from the Authentication token. Please note that the default authorization + * settings only allow administrative users to create resources on behalf of a different tenant. + * + * @return the Builder. + * @see Member#getTenantId() + */ + public CreateBuilder tenantId(String tenantId) { + member.tenantId = tenantId; + return self(); + } + + /** + * Provides the address for this Member's Builder. + * + * @return the Builder. + * @see Member#getAddress() + */ + public CreateBuilder address(String address) { + member.address = address; + return self(); + } + + /** + * Provides the protocol port for this Member's Builder. + * + * @return the Builder. + * @see Member#getProtocolPort() + */ + public CreateBuilder protocolPort(Integer protocolPort) { + member.protocolPort = protocolPort; + return self(); + } + + /** + * @return a CreateMember constructed with this Builder. + */ + public CreateMember build() { + return new CreateMember(member); + } + + @Override + protected CreateBuilder self() { + return this; + } + } + + /** + * Update builder (inheriting from Builder). + */ + public static class UpdateBuilder extends Builder<UpdateBuilder> { + /** + * Supply required properties for creating a Member's UpdateBuilder. + */ + private UpdateBuilder() { + } + + /** + * @return a UpdateMember constructed with this Builder. + */ + public UpdateMember build() { + return new UpdateMember(member); + } + + @Override + protected UpdateBuilder self() { + return this; + } + } + + /** + * Create options - extend the domain class, passed to API create calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class CreateMember extends Member { + /** + * Copy constructor. + * + * @param member the Member to copy from. + */ + private CreateMember(Member member) { + super(member); + } + } + + /** + * Update options - extend the domain class, passed to API update calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class UpdateMember extends Member { + /** + * Copy constructor. + * + * @param member the Member to copy from. + */ + private UpdateMember(Member member) { + super(member); + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Members.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Members.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Members.java new file mode 100644 index 0000000..74a464d --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Members.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.lbaas.v1; + +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 of Neutron LBaaS v1 Members. + */ +public class Members extends PaginatedCollection<Member> { + public static final Members EMPTY = new Members(ImmutableSet.<Member> of(), ImmutableSet.<Link> of()); + + @ConstructorProperties({ "members", "members_links" }) + protected Members(Iterable<Member> members, Iterable<Link> membersLinks) { + super(members, membersLinks); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pool.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pool.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pool.java new file mode 100644 index 0000000..c1aa88d --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pool.java @@ -0,0 +1,481 @@ +/* + * 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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; + +/** + * A Neutron LBaaS v1 Pool. + */ +public class Pool { + + // Load balancing methods that must be supported by all providers. + // Not an enum type because any provider may support additional balancing methods. + public static String ROUND_ROBIN = "ROUND_ROBIN"; + public static String LEAST_CONNECTIONS = "LEAST_CONNECTIONS"; + public static String SOURCE_IP = "SOURCE_IP"; + + // Mandatory attributes when creating + @Named("tenant_id") + private String tenantId; + @Named("subnet_id") + private String subnetId; + private Protocol protocol; + // Mandatory attributes that can be updated + @Named("lb_method") + private String lbMethod; + // Optional attributes when creating + private String provider; + // Optional attributes that can be updated + private String name; + private String description; + @Named("health_monitors") + private ImmutableSet<String> healthMonitors; + @Named("admin_state_up") + private Boolean adminStateUp; + // Read-only attributes + private String id; + @Named("vip_id") + private String vipId; + private ImmutableSet<String> members; + @Named("health_monitors_status") + private ImmutableList<HealthMonitorStatus> healthMonitorsStatus; + private LBaaSStatus status; + @Named("status_description") + private String statusDescription; + + /** + * Deserialization constructor. + */ + @ConstructorProperties({ "id", "tenant_id", "vip_id", "name", "description", "subnet_id", "protocol", "provider", + "lb_method", "health_monitors", "health_monitors_status", "members", "admin_state_up", "status", + "status_description" }) + private Pool(String id, String tenantId, String vipId, String name, String description, String subnetId, + Protocol protocol, String provider, String lbMethod, ImmutableSet<String> healthMonitors, + ImmutableList<HealthMonitorStatus> healthMonitorsStatus, ImmutableSet<String> members, Boolean adminStateUp, + LBaaSStatus status, String statusDescription) { + this.id = id; + this.tenantId = tenantId; + this.vipId = vipId; + this.name = name; + this.description = description; + this.subnetId = subnetId; + this.protocol = protocol; + this.provider = provider; + this.lbMethod = lbMethod; + this.healthMonitors = healthMonitors; + this.healthMonitorsStatus = healthMonitorsStatus; + this.members = members; + this.adminStateUp = adminStateUp; + this.status = status; + this.statusDescription = statusDescription; + } + + /** + * Default constructor. + */ + private Pool() { + } + + /** + * Copy constructor. + * + * @param pool the Pool to copy from. + */ + private Pool(Pool pool) { + this(pool.id, pool.tenantId, pool.vipId, pool.name, pool.description, pool.subnetId, pool.protocol, + pool.provider, pool.lbMethod, pool.healthMonitors, pool.healthMonitorsStatus, pool.members, + pool.adminStateUp, pool.status, pool.statusDescription); + } + + /** + * @return the id of the Pool. + */ + @Nullable + public String getId() { + return id; + } + + /** + * @return the tenant id of the Pool. + */ + @Nullable + public String getTenantId() { + return tenantId; + } + + /** + * @return the virtual IP id of the Pool. + */ + @Nullable + public String getVIPId() { + return vipId; + } + + /** + * @return the name of the Pool. + */ + @Nullable + public String getName() { + return name; + } + + /** + * @return the description of the Pool. + */ + @Nullable + public String getDescription() { + return description; + } + + /** + * @return the subnet id for this Pool. + */ + @Nullable + public String getSubnetId() { + return subnetId; + } + + /** + * @return the protocol for this Pool. + */ + @Nullable + public Protocol getProtocol() { + return protocol; + } + + /** + * @return the provider for this Pool. + */ + @Nullable + public String getProvider() { + return provider; + } + + /** + * @return the load balancing method for this Pool. + */ + @Nullable + public String getLBMethod() { + return lbMethod; + } + + /** + * @return the health monitors for this Pool. + */ + @Nullable + public ImmutableSet<String> getHealthMonitors() { + return healthMonitors; + } + + /** + * @return the health monitors status for this Pool. + */ + @Nullable + public ImmutableList<HealthMonitorStatus> getHealthMonitorsStatus() { + return healthMonitorsStatus; + } + + /** + * @return the members for this Pool. + */ + @Nullable + public ImmutableSet<String> getMembers() { + return members; + } + + /** + * @return the administrative state for this Pool. + */ + @Nullable + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @return the status for this Pool. + */ + @Nullable + public LBaaSStatus getStatus() { + return status; + } + + /** + * @return the status description for this Pool. + */ + @Nullable + public String getStatusDescription() { + return statusDescription; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + Pool that = (Pool) o; + + return Objects.equal(this.id, that.id) && Objects.equal(this.tenantId, that.tenantId) + && Objects.equal(this.vipId, that.vipId) && Objects.equal(this.name, that.name) + && Objects.equal(this.description, that.description) && Objects.equal(this.subnetId, that.subnetId) + && Objects.equal(this.protocol, that.protocol) && Objects.equal(this.provider, that.provider) + && Objects.equal(this.lbMethod, that.lbMethod) && Objects.equal(this.healthMonitors, that.healthMonitors) + && Objects.equal(this.healthMonitorsStatus, that.healthMonitorsStatus) + && Objects.equal(this.members, that.members) && Objects.equal(this.adminStateUp, that.adminStateUp) + && Objects.equal(this.status, that.status) && Objects.equal(this.statusDescription, that.statusDescription); + } + + @Override + public int hashCode() { + return Objects.hashCode(id, tenantId, vipId, name, description, subnetId, protocol, provider, lbMethod, + healthMonitors, healthMonitorsStatus, members, adminStateUp, status, statusDescription); + } + + @Override + public String toString() { + return Objects.toStringHelper(this).add("id", id).add("tenantId", tenantId).add("vipId", vipId) + .add("name", name).add("description", description).add("subnetId", subnetId).add("protocol", protocol) + .add("provider", provider).add("lbMethod", lbMethod).add("healthMonitors", healthMonitors) + .add("healthMonitorsStatus", healthMonitorsStatus).add("members", members) + .add("adminStateUp", adminStateUp).add("status", status).add("statusDescription", statusDescription) + .toString(); + } + + /* + * Methods to get the Create and Update builders follow. + */ + + /** + * @return the Builder for creating a new Pool. + */ + public static CreateBuilder createBuilder(String subnetId, Protocol protocol, String lbMethod) { + return new CreateBuilder(subnetId, protocol, lbMethod); + } + + /** + * @return the Builder for updating a Pool. + */ + public static UpdateBuilder updateBuilder() { + return new UpdateBuilder(); + } + + private abstract static class Builder<ParameterizedBuilderType> { + protected Pool pool; + + /** + * Default constructor. + */ + private Builder() { + pool = new Pool(); + } + + protected abstract ParameterizedBuilderType self(); + + /** + * Provides the name for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getName() + */ + public ParameterizedBuilderType name(String name) { + pool.name = name; + return self(); + } + + /** + * Provides the description for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getDescription() + */ + public ParameterizedBuilderType description(String description) { + pool.description = description; + return self(); + } + + /** + * Provides the load balancing method for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getLBMethod() + */ + public ParameterizedBuilderType lbMethod(String lbMethod) { + pool.lbMethod = lbMethod; + return self(); + } + + /** + * Provides the health monitors for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getHealthMonitors() + */ + public ParameterizedBuilderType healthMonitors(ImmutableSet<String> healthMonitors) { + pool.healthMonitors = healthMonitors; + return self(); + } + + /** + * Provides the administrative state for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getAdminStateUp() + */ + public ParameterizedBuilderType adminStateUp(Boolean adminStateUp) { + pool.adminStateUp = adminStateUp; + return self(); + } + } + + /** + * Create builder (inheriting from Builder). + */ + public static class CreateBuilder extends Builder<CreateBuilder> { + /** + * Supply required properties for creating a Pool's CreateBuilder. + * + * @param subnetId the subnet id. + * @param protocol the protocol. + * @param lbMethod the load balancing method. + */ + private CreateBuilder(String subnetId, Protocol protocol, String lbMethod) { + subnetId(subnetId).protocol(protocol).lbMethod(lbMethod); + } + + /** + * Provides the tenantId for this Pool's Builder. Admin-only. + * When keystone is enabled, it is not mandatory to specify tenant_id for resources in create requests, as the + * tenant identifier will be derived from the Authentication token. Please note that the default authorization + * settings only allow administrative users to create resources on behalf of a different tenant. + * + * @return the Builder. + * @see Pool#getTenantId() + */ + public CreateBuilder tenantId(String tenantId) { + pool.tenantId = tenantId; + return self(); + } + + /** + * Provides the subnet id for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getSubnetId() + */ + public CreateBuilder subnetId(String subnetId) { + pool.subnetId = subnetId; + return self(); + } + + /** + * Provides the protocol for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getProtocol() + */ + public CreateBuilder protocol(Protocol protocol) { + pool.protocol = protocol; + return self(); + } + + /** + * Provides the provider for this Pool's Builder. + * + * @return the Builder. + * @see Pool#getProvider() + */ + public CreateBuilder provider(String provider) { + pool.provider = provider; + return self(); + } + + /** + * @return a CreatePool constructed with this Builder. + */ + public CreatePool build() { + return new CreatePool(pool); + } + + @Override + protected CreateBuilder self() { + return this; + } + } + + /** + * Update builder (inheriting from Builder). + */ + public static class UpdateBuilder extends Builder<UpdateBuilder> { + /** + * Supply required properties for creating a Pool's UpdateBuilder. + */ + private UpdateBuilder() { + } + + /** + * @return a UpdatePool constructed with this Builder. + */ + public UpdatePool build() { + return new UpdatePool(pool); + } + + @Override + protected UpdateBuilder self() { + return this; + } + } + + /** + * Create options - extend the domain class, passed to API create calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class CreatePool extends Pool { + /** + * Copy constructor. + * + * @param pool the Pool to copy from. + */ + private CreatePool(Pool pool) { + super(pool); + } + } + + /** + * Update options - extend the domain class, passed to API update calls. + * Essentially the same as the domain class. Ensure validation and safe typing. + */ + public static class UpdatePool extends Pool { + /** + * Copy constructor. + * + * @param pool the Pool to copy from. + */ + private UpdatePool(Pool pool) { + super(pool); + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/PoolStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/PoolStatus.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/PoolStatus.java new file mode 100644 index 0000000..869eb81 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/PoolStatus.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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; + +/** + * A Neutron LBaaS v1 PoolStatus. + * Contains an id and status describing the pool's status. + * + * @see HealthMonitor#getPools() + */ +public class PoolStatus { + + // Mandatory attributes + @Named("pool_id") + protected final String id; + protected final LBaaSStatus status; + // Optional attributes + @Named("status_description") + protected final String statusDescription; + + @ConstructorProperties({ "pool_id", "status", "status_description" }) + protected PoolStatus(String id, LBaaSStatus status, String statusDescription) { + this.id = id; + this.status = status; + this.statusDescription = statusDescription; + } + + /** + * @return the id of the PoolStatus. + */ + @Nullable + public String getId() { + return id; + } + + /** + * @return the status of the PoolStatus. + */ + @Nullable + public LBaaSStatus getStatus() { + return status; + } + + /** + * @return the status description of the PoolStatus. + */ + @Nullable + public String getStatusDescription() { + return statusDescription; + } + + @Override + public int hashCode() { + return Objects.hashCode(id, status, statusDescription); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + PoolStatus that = PoolStatus.class.cast(obj); + return Objects.equal(this.id, that.id) && Objects.equal(this.status, that.status) + && Objects.equal(this.statusDescription, that.statusDescription); + } + + protected Objects.ToStringHelper string() { + return Objects.toStringHelper(this).add("id", id).add("status", status) + .add("statusDescription", statusDescription); + } + + @Override + public String toString() { + return string().toString(); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pools.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pools.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pools.java new file mode 100644 index 0000000..c30bc13 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Pools.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.lbaas.v1; + +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 of Neutron LBaaS v1 Pools. + */ +public class Pools extends PaginatedCollection<Pool> { + public static final Pools EMPTY = new Pools(ImmutableSet.<Pool> of(), ImmutableSet.<Link> of()); + + @ConstructorProperties({ "pools", "pools_links" }) + protected Pools(Iterable<Pool> pools, Iterable<Link> poolsLinks) { + super(pools, poolsLinks); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/ProbeType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/ProbeType.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/ProbeType.java new file mode 100644 index 0000000..fb5d565 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/ProbeType.java @@ -0,0 +1,70 @@ +/* + * 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.lbaas.v1; + +/** + * Enumerates supported types of probe sent by health monitor to verify member state. + */ +public enum ProbeType { + /** + * Health monitor pings the members by using ICMP. + */ + PING("PING"), + /** + * Health monitor connects to the members by using TCP. + */ + TCP("TCP"), + /** + * Health monitor sends an HTTP request to the member. + */ + HTTP("HTTP"), + /** + * Health monitor sends a secure HTTP request to the member. + */ + HTTPS("HTTPS"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private ProbeType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static ProbeType fromValue(String name){ + if (name != null) { + for (ProbeType value : ProbeType.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Protocol.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Protocol.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Protocol.java new file mode 100644 index 0000000..e353863 --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/Protocol.java @@ -0,0 +1,67 @@ +/* + * 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.lbaas.v1; + +/** + * Enumerates supported protocols. + * Protocol must be specified for the front-end (see {@link VIP}) and for the back-end instances (see {@link Pool}). + */ +public enum Protocol { + /** + * Use TCP for routing traffic. + */ + TCP("TCP"), + /** + * Use HTTP for routing traffic. + */ + HTTP("HTTP"), + /** + * Use HTTPS for routing traffic. + */ + HTTPS("HTTPS"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private Protocol(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static Protocol fromValue(String name){ + if (name != null) { + for (Protocol value : Protocol.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistence.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistence.java b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistence.java new file mode 100644 index 0000000..b1c49dd --- /dev/null +++ b/dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/domain/lbaas/v1/SessionPersistence.java @@ -0,0 +1,182 @@ +/* + * 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.lbaas.v1; + +import java.beans.ConstructorProperties; + +import javax.inject.Named; + +import org.jclouds.javax.annotation.Nullable; + +import com.google.common.base.Objects; + +/** + * A Neutron LBaaS v1 SessionPersistence. + * Contains a type and cookie name describing the session persistence. + */ +public class SessionPersistence { + + // Mandatory attributes + protected final Type type; + // Optional attributes + @Named("cookie_name") + protected final String cookieName; + + @ConstructorProperties({ "type", "cookie_name" }) + protected SessionPersistence(Type type, String cookieName) { + this.type = type; + this.cookieName = cookieName; + } + + /** + * @return the type of the SessionPersistence. + */ + @Nullable + public Type getType() { + return type; + } + + /** + * @return the cookie name of the SessionPersistence. + */ + @Nullable + public String getCookieName() { + return cookieName; + } + + @Override + public int hashCode() { + return Objects.hashCode(type, cookieName); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || getClass() != obj.getClass()) + return false; + SessionPersistence that = SessionPersistence.class.cast(obj); + return Objects.equal(this.type, that.type) && Objects.equal(this.cookieName, that.cookieName); + } + + protected Objects.ToStringHelper string() { + return Objects.toStringHelper(this).add("type", type).add("cookieName", cookieName); + } + + @Override + public String toString() { + return string().toString(); + } + + /* + * Methods to get the builder follow. + */ + + /** + * @return the Builder for SessionPersistence. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Builder. + */ + public static class Builder { + protected Type type; + protected String cookieName; + + /** + * Provides the type to the SessionPersistence's Builder. + * + * @return the Builder. + * @see SessionPersistence#getType() + */ + public Builder type(Type type) { + this.type = type; + return this; + } + + /** + * Provides the cookie name to the SessionPersistence's Builder. + * + * @return the Builder. + * @see SessionPersistence#getCookieName() + */ + public Builder cookieName(String cookieName) { + this.cookieName = cookieName; + return this; + } + + /** + * @return a SessionPersistence constructed with this Builder. + */ + public SessionPersistence build() { + return new SessionPersistence(type, cookieName); + } + } + + /** + * Enumerates supported SessionPersistence types. + */ + public static enum Type { + /** + * All connections that originate from the same source IP address are handled by the same member of the pool. + */ + SOURCE_IP("SOURCE_IP"), + /** + * The load balancing function creates a cookie on the first request from a client. Subsequent requests that + * contain the same cookie value are handled by the same member of the pool. + */ + HTTP_COOKIE("HTTP_COOKIE"), + /** + * The load balancing function relies on a cookie established by the back-end application. All requests with the + * same cookie value are handled by the same member of the pool. + */ + APP_COOKIE("APP_COOKIE"), + /** + * Used by jclouds when the service returns an unknown value other than null. + */ + UNRECOGNIZED("unrecognized"); + + private String name; + + private Type(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + /* + * This provides GSON enum support in jclouds. + * */ + public static Type fromValue(String name){ + if (name != null) { + for (Type value : Type.values()) { + if (name.equalsIgnoreCase(value.name)) { + return value; + } + } + return UNRECOGNIZED; + } + return null; + } + } +}
