Repository: jclouds-labs Updated Branches: refs/heads/2.0.x 69ef87654 -> 809946cb6
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollection.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollection.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollection.java new file mode 100644 index 0000000..f8876cc --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollection.java @@ -0,0 +1,103 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableSet; +import org.jclouds.collect.IterableWithMarker; +import org.jclouds.dimensiondata.cloudcontrol.options.PaginationOptions; +import org.jclouds.javax.annotation.Nullable; + +import java.util.Iterator; + +/** + * Base class for a paginated collection in DimensionData CloudController. + */ +public class PaginatedCollection<T> extends IterableWithMarker<T> { + + private final Iterable<T> resources; + + /** + * The page number requested by the user or the default page (1) if none supplied. + */ + private final int pageNumber; + + /** + * The number of result records in this page. + */ + private final int pageCount; + + /** + * The total number of result records matching request criteria. + */ + private final int totalCount; + + /** + * The page size used; either specified in the request or the default for the API function being requested. + */ + private final int pageSize; + + protected PaginatedCollection(@Nullable Iterable<T> resources, int pageNumber, int pageCount, int totalCount, + int pageSize) { + this.resources = resources != null ? resources : ImmutableSet.<T>of(); + this.pageNumber = pageNumber; + this.pageCount = pageCount; + this.totalCount = totalCount; + this.pageSize = pageSize; + } + + public Iterable<T> getResources() { + return resources; + } + + public int getPageNumber() { + return pageNumber; + } + + public int getPageCount() { + return pageCount; + } + + public int getTotalCount() { + return totalCount; + } + + public int getPageSize() { + return pageSize; + } + + @Override + public Iterator<T> iterator() { + return resources.iterator(); + } + + @Override + public Optional<Object> nextMarker() { + if (totalCount < pageSize) + return Optional.absent(); + + if ((float) pageNumber < ((float) totalCount / (float) pageSize)) { + return Optional.of(toPaginationOptions(pageNumber + 1)); + } + return Optional.absent(); + } + + private Object toPaginationOptions(Integer pageNumber) { + return PaginationOptions.Builder.pageNumber(pageNumber); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Placement.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Placement.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Placement.java new file mode 100644 index 0000000..78f471a --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Placement.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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class Placement { + + public static Builder builder() { + return new AutoValue_Placement.Builder(); + } + + Placement() { + } // For AutoValue only! + + public abstract String position(); + + @SerializedNames({ "position" }) + public static Placement create(String position) { + return builder().position(position).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder position(String position); + + public abstract Placement build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Progress.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Progress.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Progress.java new file mode 100644 index 0000000..7385926 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Progress.java @@ -0,0 +1,91 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import java.util.Date; + +@AutoValue +public abstract class Progress { + + @AutoValue + public abstract static class Step { + + Step() { + } // For AutoValue only! + + public abstract String name(); + + public abstract int number(); + + @SerializedNames({ "name", "number" }) + public static Step create(String name, int number) { + return new AutoValue_Progress_Step(name, number); + } + } + + Progress() { + } + + public abstract String action(); + + public abstract String requestTime(); + + public abstract String userName(); + + @Nullable + public abstract Integer numberOfSteps(); + + @Nullable + public abstract Date updateTime(); + + @Nullable + public abstract Step step(); + + @SerializedNames({ "action", "requestTime", "userName", "numberOfSteps", "updateTime", "step" }) + public static Progress create(String action, String requestTime, String userName, Integer numberOfSteps, + Date updateTime, Step step) { + return builder().action(action).requestTime(requestTime).userName(userName).numberOfSteps(numberOfSteps) + .updateTime(updateTime).step(step).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder action(String action); + + public abstract Builder requestTime(String requestTime); + + public abstract Builder userName(String userName); + + public abstract Builder numberOfSteps(Integer numberOfSteps); + + public abstract Builder updateTime(Date updateTime); + + public abstract Builder step(Step step); + + public abstract Progress build(); + } + + public static Builder builder() { + return new AutoValue_Progress.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Property.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Property.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Property.java new file mode 100644 index 0000000..2bfc10b --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Property.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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class Property { + + Property() { + } // For AutoValue only! + + public abstract String name(); + + @Nullable + public abstract String value(); + + @SerializedNames({ "name", "value" }) + public static Property create(String name, String value) { + return new AutoValue_Property(name, value); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlock.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlock.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlock.java new file mode 100644 index 0000000..2ee9c78 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlock.java @@ -0,0 +1,76 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.json.SerializedNames; + +import java.util.Date; + +@AutoValue +public abstract class PublicIpBlock { + + PublicIpBlock() { + } + + public static Builder builder() { + return new AutoValue_PublicIpBlock.Builder(); + } + + public abstract String id(); + + public abstract String datacenterId(); + + public abstract String state(); + + public abstract Date createTime(); + + public abstract String baseIp(); + + public abstract int size(); + + public abstract String networkDomainId(); + + @SerializedNames({ "id", "datacenterId", "state", "createTime", "baseIp", "size", "networkDomainId" }) + public static PublicIpBlock create(String id, String datacenterId, String state, Date createTime, String baseIp, + int size, String networkDomainId) { + return builder().id(id).datacenterId(datacenterId).state(state).createTime(createTime).baseIp(baseIp).size(size) + .networkDomainId(networkDomainId).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder id(String id); + + public abstract Builder datacenterId(String datacenterId); + + public abstract Builder state(String state); + + public abstract Builder createTime(Date createTime); + + public abstract Builder baseIp(String ipv4GatewayAddress); + + public abstract Builder size(int size); + + public abstract Builder networkDomainId(String networkDomainId); + + public abstract PublicIpBlock build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlocks.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlocks.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlocks.java new file mode 100644 index 0000000..9ecd00e --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/PublicIpBlocks.java @@ -0,0 +1,32 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import java.beans.ConstructorProperties; +import java.util.List; + +/** + * A collection of publicIpBlock + */ +public class PublicIpBlocks extends PaginatedCollection<PublicIpBlock> { + + @ConstructorProperties({ "publicIpBlock", "pageNumber", "pageCount", "totalCount", "pageSize" }) + public PublicIpBlocks(List<PublicIpBlock> content, Integer pageNumber, Integer pageCount, Integer totalCount, + Integer pageSize) { + super(content, pageNumber, pageCount, totalCount, pageSize); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Response.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Response.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Response.java new file mode 100644 index 0000000..d3cea10 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Response.java @@ -0,0 +1,94 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import com.google.common.collect.ImmutableList; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import java.util.List; + +@AutoValue +public abstract class Response { + + Response() { + } + + public abstract String operation(); + + public abstract String responseCode(); + + public abstract String message(); + + @Nullable + public abstract List<Property> info(); + + @Nullable + public abstract List<String> warning(); + + @Nullable + public abstract List<String> error(); + + public abstract String requestId(); + + @SerializedNames({ "operation", "responseCode", "message", "info", "warning", "error", "requestId" }) + public static Response create(String operation, String responseCode, String message, List<Property> info, + List<String> warning, List<String> error, String requestId) { + return builder().operation(operation).responseCode(responseCode).message(message).info(info).warning(warning) + .error(error).requestId(requestId).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + public abstract Builder operation(String operation); + + public abstract Builder responseCode(String responseCode); + + public abstract Builder message(String message); + + public abstract Builder info(List<Property> info); + + public abstract Builder warning(List<String> warning); + + public abstract Builder error(List<String> error); + + public abstract Builder requestId(String requestId); + + abstract Response autoBuild(); + + abstract List<String> warning(); + + abstract List<String> error(); + + abstract List<Property> info(); + + public Response build() { + warning(warning() != null ? ImmutableList.copyOf(warning()) : null); + error(error() != null ? ImmutableList.copyOf(error()) : null); + info(info() != null ? ImmutableList.copyOf(info()) : null); + return autoBuild(); + } + } + + public static Builder builder() { + return new AutoValue_Response.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/RoleType.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/RoleType.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/RoleType.java new file mode 100644 index 0000000..cad05ad --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/RoleType.java @@ -0,0 +1,49 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class RoleType { + public abstract String name(); + + RoleType() { + } + + public static Builder builder() { + return new AutoValue_RoleType.Builder(); + } + + @SerializedNames({ "role" }) + public static RoleType create(String name) { + return builder().name(name).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + public abstract Builder name(String name); + + public abstract RoleType build(); + } + +} + http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Roles.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Roles.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Roles.java new file mode 100644 index 0000000..0471922 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Roles.java @@ -0,0 +1,59 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import com.google.common.collect.ImmutableList; +import org.jclouds.json.SerializedNames; + +import java.util.List; + +@AutoValue +public abstract class Roles { + public abstract List<RoleType> role(); + + Roles() { + } + + public static Builder builder() { + return new AutoValue_Roles.Builder(); + } + + @SerializedNames({ "role" }) + public static Roles create(List<RoleType> role) { + return builder().role(role).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + + public abstract Builder role(List<RoleType> role); + + abstract Roles autoBuild(); + + abstract List<RoleType> role(); + + public Roles build() { + role(role() != null ? ImmutableList.copyOf(role()) : ImmutableList.<RoleType>of()); + return autoBuild(); + } + } + +} + http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Server.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Server.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Server.java new file mode 100644 index 0000000..96760d9 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Server.java @@ -0,0 +1,166 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableList; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import java.util.Date; +import java.util.List; + +import static com.google.common.base.Preconditions.checkNotNull; + +@AutoValue +public abstract class Server { + + public enum State { + NORMAL, PENDING_DELETE, DELETED, UNRECOGNIZED; + + @Override + public String toString() { + return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); + } + + public static State fromValue(String state) { + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + } + + Server() { + } + + public static Builder builder() { + return new AutoValue_Server.Builder(); + } + + public abstract String id(); + + public abstract String name(); + + @Nullable + public abstract String description(); + + public abstract String datacenterId(); + + public abstract State state(); + + public abstract String sourceImageId(); + + public abstract Date createTime(); + + public abstract Boolean started(); + + public abstract Boolean deployed(); + + public abstract OperatingSystem operatingSystem(); + + public abstract CPU cpu(); + + public abstract int memoryGb(); + + @Nullable + public abstract List<Disk> disks(); + + @Nullable + public abstract NetworkInfo networkInfo(); + + @Nullable + public abstract List<Object> softwareLabels(); + + @Nullable + public abstract VMwareTools vmwareTools(); + + @Nullable + public abstract Progress progress(); + + @Nullable + public abstract VirtualHardware virtualHardware(); + + @SerializedNames({ "id", "name", "description", "datacenterId", "state", "sourceImageId", "createTime", "started", + "deployed", "operatingSystem", "cpu", "memoryGb", "disk", "networkInfo", "softwareLabel", "vmwareTools", + "progress", "virtualHardware" }) + public static Server create(String id, String name, String description, String datacenterId, State state, + String sourceImageId, Date createTime, Boolean started, Boolean deployed, OperatingSystem operatingSystem, + CPU cpu, int memoryGb, List<Disk> disks, NetworkInfo networkInfo, List<Object> softwareLabels, + VMwareTools vmwareTools, Progress progress, VirtualHardware virtualHardware) { + return builder().id(id).name(name).datacenterId(datacenterId).description(description).state(state) + .sourceImageId(sourceImageId).createTime(createTime).started(started).deployed(deployed) + .operatingSystem(operatingSystem).cpu(cpu).memoryGb(memoryGb).disks(disks).networkInfo(networkInfo) + .softwareLabels(softwareLabels).vmwareTools(vmwareTools).progress(progress).virtualHardware(virtualHardware) + .build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder id(String id); + + public abstract Builder name(String name); + + public abstract Builder description(String description); + + public abstract Builder datacenterId(String datacenterId); + + public abstract Builder state(State state); + + public abstract Builder sourceImageId(String sourceImageId); + + public abstract Builder createTime(Date createTime); + + public abstract Builder started(Boolean started); + + public abstract Builder deployed(Boolean deployed); + + public abstract Builder operatingSystem(OperatingSystem operatingSystem); + + public abstract Builder cpu(CPU cpu); + + public abstract Builder memoryGb(int memoryGb); + + public abstract Builder disks(List<Disk> disks); + + public abstract Builder networkInfo(NetworkInfo networkInfo); + + public abstract Builder softwareLabels(List<Object> softwareLabels); + + public abstract Builder vmwareTools(VMwareTools vmwareTools); + + public abstract Builder progress(Progress progress); + + public abstract Builder virtualHardware(VirtualHardware virtualHardware); + + abstract Server autoBuild(); + + abstract List<Disk> disks(); + + abstract List<Object> softwareLabels(); + + public Server build() { + disks(disks() != null ? ImmutableList.copyOf(disks()) : null); + softwareLabels(softwareLabels() != null ? ImmutableList.copyOf(softwareLabels()) : null); + return autoBuild(); + } + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Servers.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Servers.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Servers.java new file mode 100644 index 0000000..23cf792 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Servers.java @@ -0,0 +1,31 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import java.beans.ConstructorProperties; +import java.util.List; + +/** + * A collection of Server + */ +public class Servers extends PaginatedCollection<Server> { + + @ConstructorProperties({ "server", "pageNumber", "pageCount", "totalCount", "pageSize" }) + public Servers(List<Server> content, Integer pageNumber, Integer pageCount, Integer totalCount, Integer pageSize) { + super(content, pageNumber, pageCount, totalCount, pageSize); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Status.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Status.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Status.java new file mode 100644 index 0000000..4027943 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Status.java @@ -0,0 +1,84 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import com.google.common.collect.ImmutableList; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +import java.util.List; + +/** + * + */ +@AutoValue +public abstract class Status { + + public enum ResultType { + ERROR, SUCCESS, WARNING + } + + Status() { + } + + public abstract ResultType result(); + + public abstract String resultDetail(); + + public abstract String resultCode(); + + public abstract String operation(); + + @Nullable + public abstract List<AdditionalInformationType> additionalInformation(); + + @SerializedNames({ "result", "resultDetail", "resultCode", "additionalInformation" }) + public static Status create(ResultType result, String resultDetail, String resultCode, + List<AdditionalInformationType> additionalInformation, String operation) { + return builder().result(result).resultDetail(resultDetail).resultCode(resultCode) + .additionalInformation(additionalInformation).operation(operation).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder result(ResultType result); + + public abstract Builder resultDetail(String result); + + public abstract Builder resultCode(String resultCode); + + public abstract Builder additionalInformation(List<AdditionalInformationType> additionalInformation); + + public abstract Builder operation(String operation); + + abstract Status autoBuild(); + + abstract List<AdditionalInformationType> additionalInformation(); + + public Status build() { + additionalInformation(additionalInformation() != null ? ImmutableList.copyOf(additionalInformation()) : null); + return autoBuild(); + } + } + + public static Builder builder() { + return new AutoValue_Status.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tag.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tag.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tag.java new file mode 100644 index 0000000..741db87 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tag.java @@ -0,0 +1,82 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class Tag { + + Tag() { + } + + public abstract String assetType(); + + public abstract String assetId(); + + public abstract String datacenterId(); + + public abstract String tagKeyId(); + + public abstract String tagKeyName(); + + @Nullable + public abstract String value(); + + public abstract boolean valueRequired(); + + public abstract boolean displayOnReport(); + + @SerializedNames({ "assetType", "assetId", "datacenterId", "tagKeyId", "tagKeyName", "value", "valueRequired", + "displayOnReport" }) + public static Tag create(String assetType, String assetId, String datacenterId, String tagKeyId, String tagKeyName, + String value, Boolean valueRequired, Boolean displayOnReport) { + return builder().assetType(assetType).assetId(assetId).datacenterId(datacenterId).tagKeyId(tagKeyId) + .tagKeyName(tagKeyName).value(value).valueRequired(valueRequired).displayOnReport(displayOnReport).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder assetType(String assetType); + + public abstract Builder assetId(String assetId); + + public abstract Builder datacenterId(String datacenterId); + + public abstract Builder tagKeyId(String tagKeyId); + + public abstract Builder tagKeyName(String tagKeyName); + + public abstract Builder value(String value); + + public abstract Builder valueRequired(boolean valueRequired); + + public abstract Builder displayOnReport(boolean displayOnReport); + + public abstract Tag build(); + + } + + public static Builder builder() { + return new AutoValue_Tag.Builder(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagInfo.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagInfo.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagInfo.java new file mode 100644 index 0000000..db89c75 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagInfo.java @@ -0,0 +1,53 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class TagInfo { + + TagInfo() { + } + + public abstract String tagKeyId(); + + @Nullable + public abstract String value(); + + @SerializedNames({ "tagKeyId", "value" }) + public static TagInfo create(String tagKeyId, String value) { + return builder().tagKeyId(tagKeyId).value(value).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder tagKeyId(String tagKeyId); + + public abstract Builder value(String value); + + public abstract TagInfo build(); + } + + public static Builder builder() { + return new AutoValue_TagInfo.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKey.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKey.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKey.java new file mode 100644 index 0000000..afc1a3f --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKey.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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class TagKey { + + TagKey() { + } + + public abstract String id(); + + public abstract String name(); + + @Nullable + public abstract String description(); + + public abstract boolean valueRequired(); + + public abstract boolean displayOnReport(); + + @SerializedNames({ "id", "name", "description", "valueRequired", "displayOnReport" }) + public static TagKey create(String id, String name, String description, boolean valueRequired, + boolean displayOnReport) { + return builder().id(id).name(name).description(description).valueRequired(valueRequired) + .displayOnReport(displayOnReport).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder id(String id); + + public abstract Builder name(String tagKeyName); + + public abstract Builder description(String description); + + public abstract Builder valueRequired(boolean valueRequired); + + public abstract Builder displayOnReport(boolean displayOnReport); + + public abstract TagKey build(); + + } + + public static Builder builder() { + return new AutoValue_TagKey.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKeys.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKeys.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKeys.java new file mode 100644 index 0000000..d125396 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/TagKeys.java @@ -0,0 +1,28 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import java.beans.ConstructorProperties; +import java.util.List; + +public class TagKeys extends PaginatedCollection<TagKey> { + + @ConstructorProperties({ "tagKey", "pageNumber", "pageCount", "totalCount", "pageSize" }) + public TagKeys(List<TagKey> content, Integer pageNumber, Integer pageCount, Integer totalCount, Integer pageSize) { + super(content, pageNumber, pageCount, totalCount, pageSize); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tags.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tags.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tags.java new file mode 100644 index 0000000..140080d --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Tags.java @@ -0,0 +1,28 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import java.beans.ConstructorProperties; +import java.util.List; + +public class Tags extends PaginatedCollection<Tag> { + + @ConstructorProperties({ "tag", "pageNumber", "pageCount", "totalCount", "pageSize" }) + public Tags(List<Tag> content, Integer pageNumber, Integer pageCount, Integer totalCount, Integer pageSize) { + super(content, pageNumber, pageCount, totalCount, pageSize); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VMwareTools.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VMwareTools.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VMwareTools.java new file mode 100644 index 0000000..99306c1 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VMwareTools.java @@ -0,0 +1,59 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class VMwareTools { + + VMwareTools() { + } + + @Nullable + public abstract String versionStatus(); + + @Nullable + public abstract String runningStatus(); + + @Nullable + public abstract Integer apiVersion(); + + @SerializedNames({ "versionStatus", "runningStatus", "apiVersion" }) + public static VMwareTools create(String versionStatus, String runningStatus, Integer apiVersion) { + return builder().versionStatus(versionStatus).runningStatus(runningStatus).apiVersion(apiVersion).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder versionStatus(String versionStatus); + + public abstract Builder runningStatus(String runningStatus); + + public abstract Builder apiVersion(Integer apiVersion); + + public abstract VMwareTools build(); + } + + public static Builder builder() { + return new AutoValue_VMwareTools.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VirtualHardware.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VirtualHardware.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VirtualHardware.java new file mode 100644 index 0000000..a6bfd34 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/VirtualHardware.java @@ -0,0 +1,51 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.json.SerializedNames; + +@AutoValue +public abstract class VirtualHardware { + + VirtualHardware() { + } + + public abstract String version(); + + public abstract boolean upToDate(); + + @SerializedNames({ "version", "upToDate" }) + public static VirtualHardware create(String version, boolean upToDate) { + return builder().version(version).upToDate(upToDate).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder version(String version); + + public abstract Builder upToDate(boolean upToDate); + + public abstract VirtualHardware build(); + } + + public static Builder builder() { + return new AutoValue_VirtualHardware.Builder(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlan.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlan.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlan.java new file mode 100644 index 0000000..7a62543 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlan.java @@ -0,0 +1,95 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import com.google.auto.value.AutoValue; +import org.jclouds.json.SerializedNames; + +import java.util.Date; + +@AutoValue +public abstract class Vlan { + + Vlan() { + } + + public static Builder builder() { + return new AutoValue_Vlan.Builder(); + } + + public abstract String id(); + + public abstract String name(); + + public abstract String description(); + + public abstract String datacenterId(); + + public abstract String state(); + + public abstract Date createTime(); + + public abstract String ipv4GatewayAddress(); + + public abstract String ipv6GatewayAddress(); + + public abstract NetworkDomain networkDomain(); + + public abstract IpRange privateIpv4Range(); + + public abstract IpRange ipv6Range(); + + @SerializedNames({ "id", "name", "description", "datacenterId", "state", "createTime", "ipv4GatewayAddress", + "ipv6GatewayAddress", "networkDomain", "privateIpv4Range", "ipv6Range" }) + public static Vlan create(String id, String name, String description, String datacenterId, String state, + Date createTime, String ipv4GatewayAddress, String ipv6GatewayAddress, NetworkDomain networkDomain, + IpRange privateIpv4Range, IpRange ipv6Range) { + return builder().id(id).name(name).description(description).datacenterId(datacenterId).state(state) + .createTime(createTime).ipv4GatewayAddress(ipv4GatewayAddress).ipv6GatewayAddress(ipv6GatewayAddress) + .networkDomain(networkDomain).privateIpv4Range(privateIpv4Range).ipv6Range(ipv6Range).build(); + } + + public abstract Builder toBuilder(); + + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder id(String id); + + public abstract Builder name(String name); + + public abstract Builder description(String description); + + public abstract Builder datacenterId(String datacenterId); + + public abstract Builder state(String state); + + public abstract Builder createTime(Date createTime); + + public abstract Builder ipv4GatewayAddress(String ipv4GatewayAddress); + + public abstract Builder ipv6GatewayAddress(String ipv6GatewayAddress); + + public abstract Builder networkDomain(NetworkDomain networkDomain); + + public abstract Builder privateIpv4Range(IpRange privateIpv4Range); + + public abstract Builder ipv6Range(IpRange ipv6Range); + + public abstract Vlan build(); + } + +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlans.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlans.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlans.java new file mode 100644 index 0000000..3300207 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/domain/Vlans.java @@ -0,0 +1,31 @@ +/* + * 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.dimensiondata.cloudcontrol.domain; + +import java.beans.ConstructorProperties; +import java.util.List; + +/** + * A collection of Vlans + */ +public class Vlans extends PaginatedCollection<Vlan> { + + @ConstructorProperties({ "vlan", "pageNumber", "pageCount", "totalCount", "pageSize" }) + public Vlans(List<Vlan> content, Integer pageNumber, Integer pageCount, Integer totalCount, Integer pageSize) { + super(content, pageNumber, pageCount, totalCount, pageSize); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/options/PaginationOptions.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/options/PaginationOptions.java b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/options/PaginationOptions.java new file mode 100644 index 0000000..06bd478 --- /dev/null +++ b/dimensiondata/src/main/java/org/jclouds/dimensiondata/cloudcontrol/options/PaginationOptions.java @@ -0,0 +1,69 @@ +/* + * 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.dimensiondata.cloudcontrol.options; + +import org.jclouds.http.options.BaseHttpRequestOptions; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; + +public class PaginationOptions extends BaseHttpRequestOptions { + + public PaginationOptions pageNumber(int pageNumber) { + this.queryParameters.put("pageNumber", Integer.toString(pageNumber)); + return this; + } + + public PaginationOptions orderBy(String orderBy) { + this.queryParameters.put("orderBy", checkNotNull(orderBy, "orderBy")); + return this; + } + + public PaginationOptions pageSize(int pageSize) { + checkState(pageSize >= 0, "pageSize must be >= 0"); + checkState(pageSize <= 10000, "limit must be <= 10000"); + queryParameters.put("pageSize", Integer.toString(pageSize)); + return this; + } + + public static class Builder { + + /** + * @see PaginationOptions#pageNumber(int) + */ + public static PaginationOptions pageNumber(Integer pageNumber) { + PaginationOptions options = new PaginationOptions(); + return options.pageNumber(pageNumber); + } + + /** + * @see PaginationOptions#pageSize(int) + */ + public static PaginationOptions pageSize(int pageSize) { + PaginationOptions options = new PaginationOptions(); + return options.pageSize(pageSize); + } + + /** + * @see PaginationOptions#orderBy(String) + */ + public static PaginationOptions orderBy(String orderBy) { + PaginationOptions options = new PaginationOptions(); + return options.orderBy(orderBy); + } + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/dimensiondata/src/test/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollectionTest.java ---------------------------------------------------------------------- diff --git a/dimensiondata/src/test/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollectionTest.java b/dimensiondata/src/test/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollectionTest.java new file mode 100644 index 0000000..e2a2c85 --- /dev/null +++ b/dimensiondata/src/test/java/org/jclouds/dimensiondata/cloudcontrol/domain/PaginatedCollectionTest.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.dimensiondata.cloudcontrol.domain; + +import com.google.common.collect.Multimap; +import org.assertj.core.api.Assertions; +import org.jclouds.dimensiondata.cloudcontrol.options.PaginationOptions; +import org.testng.Assert; +import org.testng.annotations.Test; + +@Test(groups = "unit", testName = "PaginatedCollectionTest") +public class PaginatedCollectionTest { + + public void testHasNextPage() { + int pageNumber = 1; + int pageCount = 0; + int totalCount = 7; + int pageSize = 5; + final PaginatedCollection<Tags> collection = new PaginatedCollection<Tags>(null, pageNumber, pageCount, + totalCount, pageSize); + final Multimap<String, String> queryParameters = ((PaginationOptions) collection.nextMarker().get()) + .buildQueryParameters(); + final String nextPageNumber = queryParameters.get("pageNumber").iterator().next(); + Assertions.assertThat(nextPageNumber).isEqualTo("2"); + } + + public void testAllResultsViewed() { + int pageNumber = 2; + int pageCount = 0; + int totalCount = 10; + int pageSize = 5; + final PaginatedCollection<Tags> collection = new PaginatedCollection<Tags>(null, pageNumber, pageCount, + totalCount, pageSize); + Assert.assertFalse(collection.nextMarker().isPresent()); + } +} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/809946cb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 663e679..7801776 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,7 @@ <module>cloudsigma2-sjc</module> <module>cloudsigma2-wdc</module> <module>cloudsigma2-zrh</module> + <module>dimensiondata</module> <module>jdbc</module> <module>h2-jdbc</module> <module>joyent-cloudapi</module>
