http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java new file mode 100644 index 0000000..5cc6d67 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java @@ -0,0 +1,536 @@ +/* + * 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.vcloud.config; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Predicates.notNull; +import static com.google.common.collect.Iterables.concat; +import static com.google.common.collect.Iterables.filter; +import static com.google.common.collect.Iterables.getLast; +import static com.google.common.collect.Iterables.transform; +import static com.google.common.collect.Maps.transformValues; +import static com.google.common.collect.Maps.uniqueIndex; +import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; +import static org.jclouds.rest.config.BinderUtils.bindHttpApi; +import static org.jclouds.util.Predicates2.retry; +import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE; +import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED; + +import java.net.URI; +import java.util.Map; +import java.util.Map.Entry; +import java.util.SortedMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler; +import org.jclouds.domain.Location; +import org.jclouds.http.HttpErrorHandler; +import org.jclouds.http.annotation.ClientError; +import org.jclouds.http.annotation.Redirection; +import org.jclouds.http.annotation.ServerError; +import org.jclouds.location.suppliers.ImplicitLocationSupplier; +import org.jclouds.location.suppliers.LocationsSupplier; +import org.jclouds.ovf.Envelope; +import org.jclouds.rest.AuthorizationException; +import org.jclouds.rest.ConfiguresHttpApi; +import org.jclouds.rest.annotations.ApiVersion; +import org.jclouds.rest.config.HttpApiModule; +import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier; +import org.jclouds.vcloud.VCloudApi; +import org.jclouds.vcloud.VCloudToken; +import org.jclouds.vcloud.VCloudVersionsApi; +import org.jclouds.vcloud.compute.functions.FindLocationForResource; +import org.jclouds.vcloud.compute.functions.ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException; +import org.jclouds.vcloud.domain.Catalog; +import org.jclouds.vcloud.domain.CatalogItem; +import org.jclouds.vcloud.domain.Org; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.VAppTemplate; +import org.jclouds.vcloud.domain.VCloudSession; +import org.jclouds.vcloud.domain.VDC; +import org.jclouds.vcloud.domain.network.FenceMode; +import org.jclouds.vcloud.endpoints.Network; +import org.jclouds.vcloud.endpoints.OrgList; +import org.jclouds.vcloud.functions.CatalogItemsInCatalog; +import org.jclouds.vcloud.functions.CatalogItemsInOrg; +import org.jclouds.vcloud.functions.CatalogsInOrg; +import org.jclouds.vcloud.functions.DefaultNetworkNameInTemplate; +import org.jclouds.vcloud.functions.OrgsForLocations; +import org.jclouds.vcloud.functions.OrgsForNames; +import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems; +import org.jclouds.vcloud.functions.VDCsInOrg; +import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse; +import org.jclouds.vcloud.internal.VCloudLoginApi; +import org.jclouds.vcloud.loaders.OVFLoader; +import org.jclouds.vcloud.loaders.VAppTemplateLoader; +import org.jclouds.vcloud.location.DefaultVDC; +import org.jclouds.vcloud.location.OrgAndVDCToLocationSupplier; +import org.jclouds.vcloud.predicates.TaskSuccess; +import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler; + +import com.google.common.base.Function; +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.Lists; +import com.google.inject.Injector; +import com.google.inject.Provides; +import com.google.inject.Scopes; +import com.google.inject.TypeLiteral; + +/** + * Configures the VCloud authentication service connection, including logging and http transport. + */ +@ConfiguresHttpApi +public class VCloudHttpApiModule extends HttpApiModule<VCloudApi> { + + + @Provides + @Singleton + protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, + AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, + new Supplier<VCloudSession>() { + + @Override + public VCloudSession get() { + return login.login(); + } + + @Override + public String toString() { + return Objects.toStringHelper(login).add("method", "login").toString(); + } + }, seconds, TimeUnit.SECONDS); + } + + @Override + protected void configure() { + super.configure(); + bind(new TypeLiteral<Function<Iterable<CatalogItem>, Iterable<VAppTemplate>>>() { + }).to(new TypeLiteral<VAppTemplatesForCatalogItems>() { + }); + bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class); + installDefaultVCloudEndpointsModule(); + bind(new TypeLiteral<Function<ReferenceType, Location>>() { + }).to(new TypeLiteral<FindLocationForResource>() { + }); + bind(new TypeLiteral<Function<Org, Iterable<Catalog>>>() { + }).to(new TypeLiteral<CatalogsInOrg>() { + }); + bind(new TypeLiteral<Function<Org, Iterable<VDC>>>() { + }).to(new TypeLiteral<VDCsInOrg>() { + }); + bind(new TypeLiteral<Function<Iterable<String>, Iterable<Org>>>() { + }).to(new TypeLiteral<OrgsForNames>() { + }); + bind(new TypeLiteral<Function<Iterable<Location>, Iterable<Org>>>() { + }).to(new TypeLiteral<OrgsForLocations>() { + }); + bind(new TypeLiteral<Function<Catalog, Iterable<CatalogItem>>>() { + }).to(new TypeLiteral<CatalogItemsInCatalog>() { + }); + bind(new TypeLiteral<Function<Org, Iterable<CatalogItem>>>() { + }).to(new TypeLiteral<CatalogItemsInOrg>() { + }); + + bindCacheLoaders(); + + bind(new TypeLiteral<Function<VAppTemplate, String>>() { + }).annotatedWith(Network.class).to(new TypeLiteral<DefaultNetworkNameInTemplate>() { + }); + + bind(new TypeLiteral<Function<VAppTemplate, Envelope>>() { + }).to(new TypeLiteral<ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException>() { + }); + bindHttpApi(binder(), VCloudApi.class); + bindHttpApi(binder(), VCloudVersionsApi.class); + bindHttpApi(binder(), VCloudLoginApi.class); + } + + protected void bindCacheLoaders() { + bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() { + }).to(new TypeLiteral<VAppTemplateLoader>() { + }); + + bind(new TypeLiteral<CacheLoader<URI, Envelope>>() { + }).to(new TypeLiteral<OVFLoader>() { + }); + } + + @Provides + @Singleton + @org.jclouds.vcloud.endpoints.VDC + protected Supplier<Map<String, String>> provideVDCtoORG(Supplier<Map<String, Org>> orgNameToOrgSupplier) { + return Suppliers.compose(new Function<Map<String, Org>, Map<String, String>>() { + + @Override + public Map<String, String> apply(Map<String, Org> arg0) { + Builder<String, String> returnVal = ImmutableMap.builder(); + for (Entry<String, Org> orgr : arg0.entrySet()) { + for (String vdc : orgr.getValue().getVDCs().keySet()) { + returnVal.put(vdc, orgr.getKey()); + } + } + return returnVal.build(); + } + }, orgNameToOrgSupplier); + + } + + @Provides + @Singleton + protected Supplier<Map<String, Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds, + AtomicReference<AuthorizationException> authException, OrgMapSupplier supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Provides + @Singleton + @OrgList + protected Supplier<URI> provideOrgListURI(Supplier<VCloudSession> sessionSupplier) { + return Suppliers.compose(new Function<VCloudSession, URI>() { + + @Override + public URI apply(VCloudSession arg0) { + return URI.create(getLast(arg0.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", "org")); + } + + @Override + public String toString() { + return "orgListURI()"; + } + + }, sessionSupplier); + } + + @Singleton + public static class OrgMapSupplier implements Supplier<Map<String, Org>> { + protected final Supplier<VCloudSession> sessionSupplier; + protected final Function<Iterable<String>, Iterable<Org>> organizationsForNames; + + @Inject + protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier, + Function<Iterable<String>, Iterable<Org>> organizationsForNames) { + this.sessionSupplier = sessionSupplier; + this.organizationsForNames = organizationsForNames; + } + + @Override + public Map<String, Org> get() { + return uniqueIndex(organizationsForNames.apply(sessionSupplier.get().getOrgs().keySet()), name); + } + } + + protected void installDefaultVCloudEndpointsModule() { + install(new DefaultVCloudReferencesModule()); + } + + @Singleton + public static class OrgCatalogSupplier implements + Supplier<Map<String, Map<String, Catalog>>> { + protected final Supplier<Map<String, Org>> orgSupplier; + protected final Function<Org, Iterable<Catalog>> allCatalogsInOrg; + + @Inject + protected OrgCatalogSupplier(Supplier<Map<String, Org>> orgSupplier, + Function<Org, Iterable<Catalog>> allCatalogsInOrg) { + this.orgSupplier = orgSupplier; + this.allCatalogsInOrg = allCatalogsInOrg; + } + + @Override + public Map<String, Map<String, Catalog>> get() { + return transformValues(transformValues(orgSupplier.get(), allCatalogsInOrg), + new Function<Iterable<? extends Catalog>, Map<String, Catalog>>() { + + @Override + public Map<String, Catalog> apply(Iterable<? extends Catalog> from) { + return ImmutableMap.copyOf(uniqueIndex(from, name)); + } + + }); + } + } + + @VCloudToken + @Provides + @Singleton + Supplier<String> provideVCloudToken(Supplier<VCloudSession> cache) { + return Suppliers.compose(new Function<VCloudSession, String>() { + + @Override + public String apply(VCloudSession input) { + return checkNotNull(input.getVCloudToken(), "No token present in session"); + } + }, cache); + } + + @Provides + @org.jclouds.vcloud.endpoints.Org + @Singleton + protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds, + AtomicReference<AuthorizationException> authException, OrgNameToOrgSupplier supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Provides + @Singleton + protected Supplier<Map<URI, VDC>> provideURIToVDC( + @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException, + URItoVDC supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Singleton + public static class URItoVDC implements Supplier<Map<URI, VDC>> { + private final Supplier<Map<String, Map<String, VDC>>> orgVDCMap; + + @Inject + URItoVDC(Supplier<Map<String, Map<String, VDC>>> orgVDCMap) { + this.orgVDCMap = orgVDCMap; + } + + @Override + public Map<URI, VDC> get() { + return uniqueIndex(concat(transform(orgVDCMap.get().values(), + new Function<Map<String, VDC>, Iterable<VDC>>() { + + @Override + public Iterable<VDC> apply( + Map<String, VDC> from) { + return from.values(); + } + + })), new Function<VDC, URI>() { + + @Override + public URI apply(VDC from) { + return from.getHref(); + } + + }); + } + + } + + static final Function<ReferenceType, String> name = new Function<ReferenceType, String>() { + + @Override + public String apply(ReferenceType from) { + return from.getName(); + } + + }; + + @Provides + @Singleton + @org.jclouds.vcloud.endpoints.VCloudLogin + protected Supplier<URI> provideAuthenticationURI(final VCloudVersionsApi versionService, + @ApiVersion final String version) { + return new Supplier<URI>() { + + @Override + public URI get() { + SortedMap<String, URI> versions = versionService.getSupportedVersions(); + checkState(versions.size() > 0, "No versions present"); + checkState(versions.containsKey(version), "version " + version + " not present in: " + versions); + return versions.get(version); + } + + public String toString() { + return "login()"; + } + }; + } + + @Singleton + private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> { + private final Supplier<VCloudSession> sessionSupplier; + + @Inject + OrgNameToOrgSupplier(Supplier<VCloudSession> sessionSupplier) { + this.sessionSupplier = sessionSupplier; + } + + @Override + public Map<String, ReferenceType> get() { + return sessionSupplier.get().getOrgs(); + } + + } + + @Provides + @Singleton + protected Supplier<Org> provideOrg(final Supplier<Map<String, Org>> orgSupplier, + @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) { + return Suppliers.compose(new Function<ReferenceType, Org>() { + + @Override + public Org apply(ReferenceType input) { + return orgSupplier.get().get(input.getName()); + + } + }, defaultOrg); + } + + @Provides + @Singleton + protected Predicate<URI> successTester(Injector injector, + @Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) { + return retry(injector.getInstance(TaskSuccess.class), completed); + } + + @Provides + @Singleton + protected Supplier<Map<String, Map<String, Catalog>>> provideOrgCatalogItemMapSupplierCache( + @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException, + OrgCatalogSupplier supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Provides + @Singleton + protected Supplier<Map<String, Map<String, VDC>>> provideOrgVDCSupplierCache( + @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException, + OrgVDCSupplier supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Singleton + public static class OrgVDCSupplier implements Supplier<Map<String, Map<String, VDC>>> { + protected final Supplier<Map<String, Org>> orgSupplier; + private final Function<Org, Iterable<VDC>> allVDCsInOrg; + + @Inject + protected OrgVDCSupplier(Supplier<Map<String, Org>> orgSupplier, + Function<Org, Iterable<VDC>> allVDCsInOrg) { + this.orgSupplier = orgSupplier; + this.allVDCsInOrg = allVDCsInOrg; + } + + @Override + public Map<String, Map<String, VDC>> get() { + return transformValues(transformValues(orgSupplier.get(), allVDCsInOrg), + new Function<Iterable<? extends VDC>, Map<String, VDC>>() { + + @Override + public Map<String, VDC> apply( + Iterable<? extends VDC> from) { + return uniqueIndex(Lists.newArrayList(from), name); + } + + }); + } + } + + @Singleton + public static class OrgCatalogItemSupplier implements + Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> { + protected final Supplier<Map<String, Map<String, Catalog>>> catalogSupplier; + protected final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog; + + @Inject + protected OrgCatalogItemSupplier( + Supplier<Map<String, Map<String, Catalog>>> catalogSupplier, + Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) { + this.catalogSupplier = catalogSupplier; + this.allCatalogItemsInCatalog = allCatalogItemsInCatalog; + } + + @Override + public Map<String, Map<String, Map<String, CatalogItem>>> get() { + return transformValues( + catalogSupplier.get(), + new Function<Map<String, Catalog>, Map<String, Map<String, CatalogItem>>>() { + + @Override + public Map<String, Map<String, CatalogItem>> apply( + Map<String, Catalog> from) { + return transformValues( + from, + new Function<Catalog, Map<String, CatalogItem>>() { + + @Override + public Map<String, CatalogItem> apply(Catalog from) { + return uniqueIndex(filter(allCatalogItemsInCatalog.apply(from), notNull()), name); + } + }); + + } + }); + } + } + + @Provides + @Singleton + protected Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> provideOrgCatalogItemSupplierCache( + @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException, + OrgCatalogItemSupplier supplier) { + return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds, + TimeUnit.SECONDS); + } + + @Provides + @Singleton + protected FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) { + return FenceMode.fromValue(fenceMode); + } + + @Provides + @Singleton + protected LoadingCache<URI, VAppTemplate> vAppTemplates(CacheLoader<URI, VAppTemplate> vAppTemplates) { + return CacheBuilder.newBuilder().build(vAppTemplates); + } + + @Provides + @Singleton + protected LoadingCache<URI, Envelope> envelopes(CacheLoader<URI, Envelope> envelopes) { + return CacheBuilder.newBuilder().build(envelopes); + } + + @Override + protected void bindErrorHandlers() { + bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseVCloudErrorFromHttpResponse.class); + bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseVCloudErrorFromHttpResponse.class); + bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseVCloudErrorFromHttpResponse.class); + } + + @Override + protected void installLocations() { + super.installLocations(); + bind(ImplicitLocationSupplier.class).to(DefaultVDC.class).in(Scopes.SINGLETON); + bind(LocationsSupplier.class).to(OrgAndVDCToLocationSupplier.class).in(Scopes.SINGLETON); + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java new file mode 100644 index 0000000..aadb475 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.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.vcloud.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.base.CaseFormat; + +/** + * The AllocationModel element defines how resources are allocated in a vDC. + */ +public enum AllocationModel { + /** + * Resources are committed to a vDC only when vApps are created in it + */ + ALLOCATION_VAPP, + /** + * Only a percentage of the resources you allocate are committed to the organization vDC. + */ + ALLOCATION_POOL, + /** + * All the resources you allocate are committed as a pool to the organization vDC. vApps in vDCs + * that support this allocation model can specify values for resource and limit. + */ + RESERVATION_POOL, + /** + * The VCloud API returned a model unsupported in the version 1.0 spec. + */ + UNRECOGNIZED; + + public String value() { + switch (this) { + case ALLOCATION_VAPP: + return "AllocationVApp"; + case ALLOCATION_POOL: + return "AllocationPool"; + case RESERVATION_POOL: + return "ReservationPool"; + default: + return "UnrecognizedModel"; + } + } + + @Override + public String toString() { + return value(); + } + + public static AllocationModel fromValue(String model) { + try { + return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(model, "model"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java new file mode 100644 index 0000000..73dd761 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java @@ -0,0 +1,106 @@ +/* + * 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.vcloud.domain; + +/** + * reports storage resource consumption in a vDC. + */ +public class Capacity { + + private final String units; + private final long allocated; + private final long limit; + private final int used; + private final long overhead; + + public Capacity(String units, long allocated, long limit, int used, long overhead) { + this.units = units; + this.limit = limit; + this.allocated = allocated; + this.used = used; + this.overhead = overhead; + } + + public String getUnits() { + return units; + } + + public long getAllocated() { + return allocated; + } + + public long getLimit() { + return limit; + } + + /** + * percentage of the allocation in use. + */ + public int getUsed() { + return used; + } + + /** + * number of Units allocated to vShield Manager virtual machines provisioned from this vDC. + */ + public long getOverhead() { + return overhead; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (allocated ^ (allocated >>> 32)); + result = prime * result + (int) (limit ^ (limit >>> 32)); + result = prime * result + (int) (overhead ^ (overhead >>> 32)); + result = prime * result + ((units == null) ? 0 : units.hashCode()); + result = prime * result + used; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Capacity other = (Capacity) obj; + if (allocated != other.allocated) + return false; + if (limit != other.limit) + return false; + if (overhead != other.overhead) + return false; + if (units == null) { + if (other.units != null) + return false; + } else if (!units.equals(other.units)) + return false; + if (used != other.used) + return false; + return true; + } + + @Override + public String toString() { + return "[allocated=" + allocated + ", limit=" + limit + ", overhead=" + overhead + ", units=" + units + ", used=" + + used + "]"; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java new file mode 100644 index 0000000..5e29851 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java @@ -0,0 +1,66 @@ +/* + * 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.vcloud.domain; + +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.CatalogImpl; + +import com.google.inject.ImplementedBy; + [email protected] +@ImplementedBy(CatalogImpl.class) +public interface Catalog extends ReferenceType, Map<String, ReferenceType> { + /** + * Reference to the org containing this vDC. + * + * @since vcloud api 1.0 + * @return org, or null if this is a version before 1.0 where the org isn't present + */ + ReferenceType getOrg(); + + /** + * optional description + * + * @since vcloud api 0.8 + */ + @Nullable + String getDescription(); + + /** + * readâonly element, true if the catalog is published + * + * @since vcloud api 1.0 + */ + boolean isPublished(); + + /** + * @return true, if the current user cannot modify the catalog + * @since vcloud api 1.0 + */ + boolean isReadOnly(); + + /** + * readâonly container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java new file mode 100644 index 0000000..dc94dbd --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java @@ -0,0 +1,34 @@ +/* + * 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.vcloud.domain; + +import java.util.Map; + +import org.jclouds.vcloud.domain.internal.CatalogItemImpl; + +import com.google.inject.ImplementedBy; + +@ImplementedBy(CatalogItemImpl.class) +public interface CatalogItem extends ReferenceType { + + String getDescription(); + + ReferenceType getEntity(); + + Map<String, String> getProperties(); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/DiskAttachOrDetachParams.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/DiskAttachOrDetachParams.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/DiskAttachOrDetachParams.java new file mode 100644 index 0000000..f3403d9 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/DiskAttachOrDetachParams.java @@ -0,0 +1,173 @@ +/* + * 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.vcloud.domain; + +import java.net.URI; + +/** + * The DiskAttachOrDetachParams element forms the body of a disk attach/detach request + * see http://pubs.vmware.com/vchs/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_56%2Fdoc%2Ftypes%2FDiskAttachOrDetachParamsType.html + */ +public class DiskAttachOrDetachParams { + protected final URI href; + protected final String type; + protected final String id; + protected final String name; + protected final Integer BusNumber; + protected final Integer UnitNumber; + + /** + * "application/vnd.vmware.vcloud.disk+xml" + */ + //TODO: is this the right place? + public static final String DISK_XML = "application/vnd.vmware.vcloud.disk+xml"; + + public DiskAttachOrDetachParams(URI href) { + this.href = href; + this.type = DISK_XML; + this.id = null; + this.name = null; + this.BusNumber = null; + this.UnitNumber = null; + } + + public DiskAttachOrDetachParams(URI href, String name, + String id, Integer BusNumber, Integer UnitNumber) { + this.href = href; + this.type = DISK_XML; + this.id = id; + this.name = name; + this.BusNumber = BusNumber; + this.UnitNumber = UnitNumber; + } + + /** + * get href + * @return href + */ + public URI getHref() { + return href; + } + + /** + * get type + * @return type + */ + public String getType() { + return type; + } + + /** + * get id + * @return id + */ + public String getId() { + return id; + } + + /** + * get name + * @return name + */ + public String getName() { + return name; + } + + /** + * get bus nr + * @return bus nr + */ + public Integer getBusNumber() { + return BusNumber; + } + + /** + * get unit number + * @return unit number + */ + public Integer getUnitNumber() { + return UnitNumber; + } + + @Override + public String toString() { + return "[href=" + getHref() + ", type=" + getType() + ", id=" + getId() + ", name=" + getName() + + ", BusNumber=" + getBusNumber() + ", UnitNumber=" + getUnitNumber() + "]"; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((BusNumber == null) ? 0 : BusNumber.hashCode()); + result = prime * result + ((UnitNumber == null) ? 0 : UnitNumber.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DiskAttachOrDetachParams other = (DiskAttachOrDetachParams)obj; + + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) { + return false; + } + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) { + return false; + } + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) { + return false; + } + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) { + return false; + } + if (BusNumber == null) { + if (other.BusNumber != null) + return false; + } else if (!BusNumber.equals(other.BusNumber)) { + return false; + } + if (UnitNumber == null) { + if (other.UnitNumber != null) + return false; + } else if (!UnitNumber.equals(other.UnitNumber)) { + return false; + } + return true; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java new file mode 100644 index 0000000..b72c8ca --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java @@ -0,0 +1,440 @@ +/* + * 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.vcloud.domain; + +import java.net.URI; + +import org.jclouds.vcloud.VCloudMediaType; + +/** + * The GuestCustomization of a Vm contains customization parameters for the guest operating system + * of the virtual machine. + */ +public class GuestCustomizationSection { + protected final String type; + protected final URI href; + protected String info; + protected Boolean enabled; + protected Boolean changeSid; + protected String virtualMachineId; + protected Boolean joinDomainEnabled; + protected Boolean useOrgSettings; + protected String domainName; + protected String domainUserName; + protected String domainUserPassword; + protected Boolean adminPasswordEnabled; + protected Boolean adminPasswordAuto; + protected String adminPassword; + protected Boolean resetPasswordRequired; + protected String customizationScript; + protected String computerName; + protected final ReferenceType edit; + + public GuestCustomizationSection(URI href) { + this.href = href; + this.type = VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML; + this.info = "Specifies Guest OS Customization Settings"; + this.edit = null; + } + + public GuestCustomizationSection(String type, URI href, String info, Boolean enabled, Boolean changeSid, + String virtualMachineId, Boolean joinDomainEnabled, Boolean useOrgSettings, String domainName, + String domainUserName, String domainUserPassword, Boolean adminPasswordEnabled, Boolean adminPasswordAuto, + String adminPassword, Boolean resetPasswordRequired, String customizationScript, String computerName, + ReferenceType edit) { + this.type = type; + this.href = href; + this.info = info; + this.enabled = enabled; + this.changeSid = changeSid; + this.virtualMachineId = virtualMachineId; + this.joinDomainEnabled = joinDomainEnabled; + this.useOrgSettings = useOrgSettings; + this.domainName = domainName; + this.domainUserName = domainUserName; + this.domainUserPassword = domainUserPassword; + this.adminPasswordEnabled = adminPasswordEnabled; + this.adminPasswordAuto = adminPasswordAuto; + this.adminPassword = adminPassword; + this.resetPasswordRequired = resetPasswordRequired; + this.customizationScript = customizationScript; + this.computerName = computerName; + this.edit = edit; + } + + /** + * + * @return media type of this section + */ + public String getType() { + return type; + } + + /** + * + * @return URL to access this section + */ + public URI getHref() { + return href; + } + + /** + * + * @return + */ + public String getInfo() { + return info; + } + + /** + * + * @return if true, to enable guest customization at power on + */ + public Boolean isEnabled() { + return enabled; + } + + /** + * + * @return if true, customization will run sysprep to change the Windows SID for this virtual + * machine + */ + public Boolean shouldChangeSid() { + return changeSid; + } + + /** + * + * @return unique identifier for this virtual machine + */ + public String getVirtualMachineId() { + return virtualMachineId; + } + + /** + * + * @return if true, this virtual machine can join a Windows domain + */ + public Boolean isJoinDomainEnabled() { + return joinDomainEnabled; + } + + /** + * + * @return if true, this virtual machine uses the containing organizationâs default values for + * Windows domain name, domain user name, and domain user password + */ + public Boolean useOrgSettings() { + return useOrgSettings; + } + + /** + * + * @return if UseOrgSettings is false, specifies the Windows domain to join + */ + public String getDomainName() { + return domainName; + } + + /** + * + * @return if UseOrgSettings is false, specifies the Windows domain user name + */ + public String getDomainUserName() { + return domainUserName; + } + + /** + * + * @return if UseOrgSettings is false, specifies the Windows domain userâs password + */ + public String getDomainUserPassword() { + return domainUserPassword; + } + + /** + * + * @return true if the guest OS allows use of a local administrator password + */ + public Boolean isAdminPasswordEnabled() { + return adminPasswordEnabled; + } + + /** + * + * @return true if the local administrator password should be automatically generated + */ + public Boolean isAdminPasswordAuto() { + return adminPasswordAuto; + } + + /** + * + * @return local administrator password for this virtual machine + */ + public String getAdminPassword() { + return adminPassword; + } + + /** + * + * @return if true, the local administrator must reset his password on first use + */ + public Boolean isResetPasswordRequired() { + return resetPasswordRequired; + } + + /** + * + * @return the customization script to run + */ + public String getCustomizationScript() { + return customizationScript; + } + + /** + * + * @return name of this virtual machine in DNS or Windows domain + */ + public String getComputerName() { + return computerName; + } + + /** + * + * @return edit link + */ + public ReferenceType getEdit() { + return edit; + } + + @Override + public String toString() { + return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", enabled=" + isEnabled() + "]"; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((adminPassword == null) ? 0 : adminPassword.hashCode()); + result = prime * result + ((adminPasswordAuto == null) ? 0 : adminPasswordAuto.hashCode()); + result = prime * result + ((adminPasswordEnabled == null) ? 0 : adminPasswordEnabled.hashCode()); + result = prime * result + ((changeSid == null) ? 0 : changeSid.hashCode()); + result = prime * result + ((computerName == null) ? 0 : computerName.hashCode()); + result = prime * result + ((customizationScript == null) ? 0 : customizationScript.hashCode()); + result = prime * result + ((domainName == null) ? 0 : domainName.hashCode()); + result = prime * result + ((domainUserName == null) ? 0 : domainUserName.hashCode()); + result = prime * result + ((domainUserPassword == null) ? 0 : domainUserPassword.hashCode()); + result = prime * result + ((edit == null) ? 0 : edit.hashCode()); + result = prime * result + ((enabled == null) ? 0 : enabled.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((info == null) ? 0 : info.hashCode()); + result = prime * result + ((joinDomainEnabled == null) ? 0 : joinDomainEnabled.hashCode()); + result = prime * result + ((resetPasswordRequired == null) ? 0 : resetPasswordRequired.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((useOrgSettings == null) ? 0 : useOrgSettings.hashCode()); + result = prime * result + ((virtualMachineId == null) ? 0 : virtualMachineId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + GuestCustomizationSection other = (GuestCustomizationSection) obj; + if (adminPassword == null) { + if (other.adminPassword != null) + return false; + } else if (!adminPassword.equals(other.adminPassword)) + return false; + if (adminPasswordAuto == null) { + if (other.adminPasswordAuto != null) + return false; + } else if (!adminPasswordAuto.equals(other.adminPasswordAuto)) + return false; + if (adminPasswordEnabled == null) { + if (other.adminPasswordEnabled != null) + return false; + } else if (!adminPasswordEnabled.equals(other.adminPasswordEnabled)) + return false; + if (changeSid == null) { + if (other.changeSid != null) + return false; + } else if (!changeSid.equals(other.changeSid)) + return false; + if (computerName == null) { + if (other.computerName != null) + return false; + } else if (!computerName.equals(other.computerName)) + return false; + if (customizationScript == null) { + if (other.customizationScript != null) + return false; + } else if (!customizationScript.equals(other.customizationScript)) + return false; + if (domainName == null) { + if (other.domainName != null) + return false; + } else if (!domainName.equals(other.domainName)) + return false; + if (domainUserName == null) { + if (other.domainUserName != null) + return false; + } else if (!domainUserName.equals(other.domainUserName)) + return false; + if (domainUserPassword == null) { + if (other.domainUserPassword != null) + return false; + } else if (!domainUserPassword.equals(other.domainUserPassword)) + return false; + if (edit == null) { + if (other.edit != null) + return false; + } else if (!edit.equals(other.edit)) + return false; + if (enabled == null) { + if (other.enabled != null) + return false; + } else if (!enabled.equals(other.enabled)) + return false; + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) + return false; + if (info == null) { + if (other.info != null) + return false; + } else if (!info.equals(other.info)) + return false; + if (joinDomainEnabled == null) { + if (other.joinDomainEnabled != null) + return false; + } else if (!joinDomainEnabled.equals(other.joinDomainEnabled)) + return false; + if (resetPasswordRequired == null) { + if (other.resetPasswordRequired != null) + return false; + } else if (!resetPasswordRequired.equals(other.resetPasswordRequired)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + if (useOrgSettings == null) { + if (other.useOrgSettings != null) + return false; + } else if (!useOrgSettings.equals(other.useOrgSettings)) + return false; + if (virtualMachineId == null) { + if (other.virtualMachineId != null) + return false; + } else if (!virtualMachineId.equals(other.virtualMachineId)) + return false; + return true; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Boolean getChangeSid() { + return changeSid; + } + + public void setChangeSid(Boolean changeSid) { + this.changeSid = changeSid; + } + + public Boolean getJoinDomainEnabled() { + return joinDomainEnabled; + } + + public void setJoinDomainEnabled(Boolean joinDomainEnabled) { + this.joinDomainEnabled = joinDomainEnabled; + } + + public Boolean shouldUseOrgSettings() { + return useOrgSettings; + } + + public void setUseOrgSettings(Boolean useOrgSettings) { + this.useOrgSettings = useOrgSettings; + } + + public Boolean getAdminPasswordEnabled() { + return adminPasswordEnabled; + } + + public void setAdminPasswordEnabled(Boolean adminPasswordEnabled) { + this.adminPasswordEnabled = adminPasswordEnabled; + } + + public Boolean getAdminPasswordAuto() { + return adminPasswordAuto; + } + + public void setAdminPasswordAuto(Boolean adminPasswordAuto) { + this.adminPasswordAuto = adminPasswordAuto; + } + + public Boolean getResetPasswordRequired() { + return resetPasswordRequired; + } + + public void setResetPasswordRequired(Boolean resetPasswordRequired) { + this.resetPasswordRequired = resetPasswordRequired; + } + + public void setInfo(String info) { + this.info = info; + } + + public void setVirtualMachineId(String virtualMachineId) { + this.virtualMachineId = virtualMachineId; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public void setDomainUserName(String domainUserName) { + this.domainUserName = domainUserName; + } + + public void setDomainUserPassword(String domainUserPassword) { + this.domainUserPassword = domainUserPassword; + } + + public void setAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + } + + public void setCustomizationScript(String customizationScript) { + this.customizationScript = customizationScript; + } + + public void setComputerName(String computerName) { + this.computerName = computerName; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java new file mode 100644 index 0000000..4b024df --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java @@ -0,0 +1,96 @@ +/* + * 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.vcloud.domain; + +import java.util.Set; + +import org.jclouds.cim.ResourceAllocationSettingData; +import org.jclouds.cim.VirtualSystemSettingData; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Sets; + +/** + * The InstantiateVAppTemplateParams element forms the body of an instantiateVappTemplate request. + */ +public class InstantiateVAppTemplateParams { + + protected final String info; + protected final VirtualSystemSettingData virtualSystem; + protected final Set<ResourceAllocationSettingData> resourceAllocations = Sets.newLinkedHashSet(); + + public InstantiateVAppTemplateParams(String info, VirtualSystemSettingData virtualSystem, Iterable<ResourceAllocationSettingData> resourceAllocations) { + this.info = info; + this.virtualSystem = virtualSystem; + Iterables.addAll(this.resourceAllocations, resourceAllocations); + } + + public String getInfo() { + return info; + } + + public VirtualSystemSettingData getSystem() { + return virtualSystem; + } + + public Set<ResourceAllocationSettingData> getResourceAllocationSettingDatas() { + return resourceAllocations; + } + + @Override + public String toString() { + return "[info=" + getInfo() + ", virtualSystem=" + getSystem() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((info == null) ? 0 : info.hashCode()); + result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode()); + result = prime * result + ((virtualSystem == null) ? 0 : virtualSystem.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + InstantiateVAppTemplateParams other = (InstantiateVAppTemplateParams) obj; + if (info == null) { + if (other.info != null) + return false; + } else if (!info.equals(other.info)) + return false; + if (resourceAllocations == null) { + if (other.resourceAllocations != null) + return false; + } else if (!resourceAllocations.equals(other.resourceAllocations)) + return false; + if (virtualSystem == null) { + if (other.virtualSystem != null) + return false; + } else if (!virtualSystem.equals(other.virtualSystem)) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java new file mode 100644 index 0000000..34aa342 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java @@ -0,0 +1,231 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.network.IpAddressAllocationMode; + +/** + * describes a single network connection. + */ +public class NetworkConnection { + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + + private String network; + private int networkConnectionIndex; + private String ipAddress; + private String externalIpAddress; + private boolean connected; + private String MACAddress; + private IpAddressAllocationMode ipAddressAllocationMode; + + public Builder network(String network) { + this.network = network; + return this; + } + + public Builder networkConnectionIndex(int networkConnectionIndex) { + this.networkConnectionIndex = networkConnectionIndex; + return this; + } + + public Builder ipAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + public Builder externalIpAddress(String externalIpAddress) { + this.externalIpAddress = externalIpAddress; + return this; + } + + public Builder connected(boolean connected) { + this.connected = connected; + return this; + } + + public Builder MACAddress(String MACAddress) { + this.MACAddress = MACAddress; + return this; + } + + public Builder ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) { + this.ipAddressAllocationMode = ipAddressAllocationMode; + return this; + } + + public NetworkConnection build() { + return new NetworkConnection(network, networkConnectionIndex, ipAddress, externalIpAddress, connected, + MACAddress, ipAddressAllocationMode); + } + + public static Builder fromNetworkConnection(NetworkConnection in) { + return new Builder().network(in.getNetwork()).networkConnectionIndex(in.getNetworkConnectionIndex()) + .ipAddress(in.getIpAddress()).externalIpAddress(in.getExternalIpAddress()).connected(in.isConnected()) + .MACAddress(in.getMACAddress()).ipAddressAllocationMode(in.getIpAddressAllocationMode()); + } + } + + private final String network; + private final int networkConnectionIndex; + @Nullable + private final String ipAddress; + @Nullable + private final String externalIpAddress; + private final boolean connected; + @Nullable + private final String MACAddress; + private final IpAddressAllocationMode ipAddressAllocationMode; + + public NetworkConnection(String network, int networkConnectionIndex, @Nullable String ipAddress, + @Nullable String externalIpAddress, boolean connected, @Nullable String MACAddress, + IpAddressAllocationMode ipAddressAllocationMode) { + this.network = network; + this.networkConnectionIndex = networkConnectionIndex; + this.ipAddress = ipAddress; + this.externalIpAddress = externalIpAddress; + this.connected = connected; + this.MACAddress = MACAddress; + this.ipAddressAllocationMode = ipAddressAllocationMode; + } + + /** + * @return The name of the network to which this connection connects. + */ + public String getNetwork() { + return network; + } + + /** + * @return The value in the rasd:AddressOnParent element of the device supporting this + * connection. + */ + public int getNetworkConnectionIndex() { + return networkConnectionIndex; + } + + /** + * @return IP address of this connection + */ + @Nullable + public String getIpAddress() { + return ipAddress; + } + + /** + * @return If the network that the NIC is connected to has NAT or port mapping, the external + * address is populated in this element. + */ + @Nullable + public String getExternalIpAddress() { + return externalIpAddress; + } + + /** + * @return If the vApp is deployed, specifies the current state of its connection. If the vApp is + * undeployed, specifies whether this connection should be connected at deployment time. + */ + public boolean isConnected() { + return connected; + } + + /** + * @return MAC address of this connection + */ + @Nullable + public String getMACAddress() { + return MACAddress; + } + + /** + * @return specifies how an IP address is allocated to this connection + */ + public IpAddressAllocationMode getIpAddressAllocationMode() { + return ipAddressAllocationMode; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((MACAddress == null) ? 0 : MACAddress.hashCode()); + result = prime * result + (connected ? 1231 : 1237); + result = prime * result + ((externalIpAddress == null) ? 0 : externalIpAddress.hashCode()); + result = prime * result + ((ipAddress == null) ? 0 : ipAddress.hashCode()); + result = prime * result + ((ipAddressAllocationMode == null) ? 0 : ipAddressAllocationMode.hashCode()); + result = prime * result + ((network == null) ? 0 : network.hashCode()); + result = prime * result + networkConnectionIndex; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + NetworkConnection other = (NetworkConnection) obj; + if (MACAddress == null) { + if (other.MACAddress != null) + return false; + } else if (!MACAddress.equals(other.MACAddress)) + return false; + if (connected != other.connected) + return false; + if (externalIpAddress == null) { + if (other.externalIpAddress != null) + return false; + } else if (!externalIpAddress.equals(other.externalIpAddress)) + return false; + if (ipAddress == null) { + if (other.ipAddress != null) + return false; + } else if (!ipAddress.equals(other.ipAddress)) + return false; + if (ipAddressAllocationMode == null) { + if (other.ipAddressAllocationMode != null) + return false; + } else if (!ipAddressAllocationMode.equals(other.ipAddressAllocationMode)) + return false; + if (network == null) { + if (other.network != null) + return false; + } else if (!network.equals(other.network)) + return false; + if (networkConnectionIndex != other.networkConnectionIndex) + return false; + return true; + } + + public Builder toBuilder() { + return Builder.fromNetworkConnection(this); + } + + @Override + public String toString() { + return "[network=" + network + ", connected=" + connected + ", ipAddress=" + ipAddress + ", externalIpAddress=" + + externalIpAddress + ", networkConnectionIndex=" + networkConnectionIndex + ", ipAddressAllocationMode=" + + ipAddressAllocationMode + ", MACAddress=" + MACAddress + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java new file mode 100644 index 0000000..c6f5f37 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java @@ -0,0 +1,218 @@ +/* + * 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.vcloud.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Set; + +import com.google.common.collect.ImmutableSet; + +/** + * The NetworkConnectionSection element specifies how a Vm is connected to a vApp network. It + * extends the ovf:NetworkConnection element. + * <p/> + * NOTE The OVF NetworkSection element and the vCloud API NetworkConnectionSection element specify + * many of the same parameters for a network connection. If both are present in a Vm body, the + * values specified in the NetworkConnectionSection override those specified in the NetworkSection. + */ +public class NetworkConnectionSection { + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + protected String type; + protected URI href; + protected String info; + protected Integer primaryNetworkConnectionIndex; + protected Set<NetworkConnection> connections = ImmutableSet.of(); + protected ReferenceType edit; + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder href(URI href) { + this.href = href; + return this; + } + + public Builder info(String info) { + this.info = info; + return this; + } + + public Builder primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) { + this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex; + return this; + } + + public Builder connections(Iterable<NetworkConnection> connections) { + this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections")); + return this; + } + + public Builder edit(ReferenceType edit) { + this.edit = edit; + return this; + } + + public NetworkConnectionSection build() { + return new NetworkConnectionSection(type, href, info, primaryNetworkConnectionIndex, connections, edit); + } + + public static Builder fromNetworkConnectionSection(NetworkConnectionSection in) { + return new Builder().type(in.getType()).href(in.getHref()).info(in.getInfo()) + .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).connections(in.getConnections()) + .edit(in.getEdit()); + } + } + + protected final String type; + protected final URI href; + protected final String info; + protected final Integer primaryNetworkConnectionIndex; + protected final Set<NetworkConnection> connections; + protected final ReferenceType edit; + + public NetworkConnectionSection(String type, URI href, String info, Integer primaryNetworkConnectionIndex, + Iterable<NetworkConnection> connections, ReferenceType edit) { + this.type = type; + this.href = href; + this.info = info; + this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex; + this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections")); + this.edit = edit; + } + + /** + * + * @return media type of this section + */ + public String getType() { + return type; + } + + /** + * + * @return URL to access this section + */ + public URI getHref() { + return href; + } + + /** + * + * @return + */ + public String getInfo() { + return info; + } + + /** + * + * @return The value of the rasd:AddressOnParent element of the device (NIC) supporting the + * primary network connection to the containing virtual machine. + */ + public Integer getPrimaryNetworkConnectionIndex() { + return primaryNetworkConnectionIndex; + } + + /** + * + */ + public Set<NetworkConnection> getConnections() { + return connections; + } + + /** + * + */ + public ReferenceType getEdit() { + return edit; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((connections == null) ? 0 : connections.hashCode()); + result = prime * result + ((edit == null) ? 0 : edit.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((info == null) ? 0 : info.hashCode()); + result = prime * result + + ((primaryNetworkConnectionIndex == null) ? 0 : primaryNetworkConnectionIndex.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + NetworkConnectionSection other = (NetworkConnectionSection) obj; + if (connections == null) { + if (other.connections != null) + return false; + } else if (!connections.equals(other.connections)) + return false; + if (edit == null) { + if (other.edit != null) + return false; + } else if (!edit.equals(other.edit)) + return false; + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) + return false; + if (info == null) { + if (other.info != null) + return false; + } else if (!info.equals(other.info)) + return false; + if (primaryNetworkConnectionIndex == null) { + if (other.primaryNetworkConnectionIndex != null) + return false; + } else if (!primaryNetworkConnectionIndex.equals(other.primaryNetworkConnectionIndex)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } + + public Builder toBuilder() { + return Builder.fromNetworkConnectionSection(this); + } + + @Override + public String toString() { + return "[href=" + href + ", connections=" + connections + ", primaryNetworkConnectionIndex=" + + primaryNetworkConnectionIndex + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java new file mode 100644 index 0000000..7f4ede9 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.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.vcloud.domain; + +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.OrgImpl; + +import com.google.inject.ImplementedBy; + +/** + * A vCloud organization is a high-level abstraction that provides a unit of administration for + * objects and resources. As viewed by a user, an organization (represented by an Org element) can + * contain Catalog, Network, and vDC elements. If there are any queued, running, or recently + * completed tasks owned by a member of the organization, it also contains a TasksList element. As + * viewed by an administrator, an organization also contains users, groups, and other information + */ +@ImplementedBy(OrgImpl.class) +public interface Org extends ReferenceType { + /** + * optional description + * + * @since vcloud api 0.8 + */ + @Nullable + String getDescription(); + + /** + * full name of the organization + * + * @since vcloud api 1.0 + */ + @Nullable + String getFullName(); + + /** + * @since vcloud api 0.8 + */ + Map<String, ReferenceType> getCatalogs(); + + /** + * @since vcloud api 0.8 + */ + Map<String, ReferenceType> getVDCs(); + + /** + * If there are any queued, running, or recently completed tasks owned by a member of the + * organization, it also contains a TasksList. + * + * @since vcloud api 0.8 + */ + @Nullable + ReferenceType getTasksList(); + + /** + * @since vcloud api 1.0 + */ + Map<String, ReferenceType> getNetworks(); + + /** + * readâonly container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java new file mode 100644 index 0000000..d36343d --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.net.URI; + +import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl; + +import com.google.inject.ImplementedBy; + +/** + * Many container elements are populated with references to contained objects. Each reference + * consists of a hyperlink, an optional media type, and a name. + */ +@ImplementedBy(ReferenceTypeImpl.class) +public interface ReferenceType extends Comparable<ReferenceType> { + /** + * @return hyperlink to the referenced object + */ + URI getHref(); + + /** + * @return name of the referenced object. + * + */ + String getName(); + + /** + * @return object type, expressed as the media type of the XML representing of the object + * @see VCloudMediaType + */ + String getType(); + + /** + * @return relationship to the referenced object. + */ + String getRelationship(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java new file mode 100644 index 0000000..748099b --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java @@ -0,0 +1,244 @@ +/* + * 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.vcloud.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Objects such as vAppTemplate, vApp, and Vm have a status attribute whose value indicates the + * state of the object. Status for an object, such as a vAppTemplate or vApp, whose Children (Vm + * objects) each have a status of their own, is computed from the status of the Children. + * + * <h2>NOTE</h2> + * <p/> + * The deployment status of an object is indicated by the value of its deployed attribute. + * + * @since vcloud api 0.8 + */ +public enum Status { + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} could not be created. + * + * @since vcloud api 1.0 + */ + ERROR, + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is unresolved. + * + * @since vcloud api 0.8 + */ + UNRESOLVED, + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is resolved. + * + * @since vcloud api 0.8 + */ + RESOLVED, + /** + * The object is deployed. + * <p/> + * note that the documentation does not reference use of this. + * + * @since vcloud api 1.0 + */ + DEPLOYED, + /** + * The {@link VApp} or {@link Vm} is suspended. + * + * @since vcloud api 0.8 + */ + SUSPENDED, + /** + * The {@link VApp} or {@link Vm} is powered on + * + * @since vcloud api 0.8 + */ + ON, + /** + * The {@link VApp} or {@link Vm} waiting for user input. + * + * @since vcloud api 1.0 + */ + WAITING_FOR_INPUT, + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unknown state. + * + * @since vcloud api 1.0 + */ + UNKNOWN, + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unrecognized state. + * + * @since vcloud api 1.0 + */ + UNRECOGNIZED, + /** + * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is off. + * + * @since vcloud api 0.8 + */ + OFF, + /** + * The {@link VApp} or {@link Vm} is in an inconsistent state. + * + * @since vcloud api 1.0 + */ + INCONSISTENT, + /** + * The {@link VAppTemplate} or {@link VApp} have children do not all have the same status. + * + * @since vcloud api 1.0 + */ + MIXED, + /** + * The {@link VAppTemplate} Upload initiated, OVF descriptor pending + * + * @since vcloud api 1.0 + */ + PENDING_DESCRIPTOR, + /** + * The {@link VAppTemplate} Upload initiated, copying contents + * + * @since vcloud api 1.0 + */ + COPYING, + /** + * The {@link VAppTemplate} Upload initiated, disk contents pending + * + * @since vcloud api 1.0 + */ + PENDING_CONTENTS, + /** + * The {@link VAppTemplate} Upload has been quarantined + * + * @since vcloud api 1.0 + */ + QUARANTINED, + /** + * The {@link VAppTemplate} Upload quarantine period has expired + * + * @since vcloud api 1.0 + */ + QUARANTINE_EXPIRED, + /** + * The {@link VAppTemplate} rejected + * + * @since vcloud api 1.0 + */ + REJECTED, + /** + * The {@link VAppTemplate} transfer timeout + * + * @since vcloud api 1.0 + */ + TRANSFER_TIMEOUT; + + public String value() { + switch (this) { + case UNRESOLVED: + return "0"; + case RESOLVED: + return "1"; + case DEPLOYED: + return "2"; + case SUSPENDED: + return "3"; + case ON: + return "4"; + case WAITING_FOR_INPUT: + return "5"; + case UNKNOWN: + return "6"; + case UNRECOGNIZED: + return "7"; + case OFF: + return "8"; + case INCONSISTENT: + return "9"; + case MIXED: + return "10"; + case PENDING_DESCRIPTOR: + return "11"; + case COPYING: + return "12"; + case PENDING_CONTENTS: + return "13"; + case QUARANTINED: + return "14"; + case QUARANTINE_EXPIRED: + return "15"; + case REJECTED: + return "16"; + case TRANSFER_TIMEOUT: + return "17"; + default: + return "7"; + } + } + + public static Status fromValue(String status) { + try { + return fromValue(Integer.parseInt(checkNotNull(status, "status"))); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + + public static Status fromValue(int v) { + switch (v) { + case 0: + return UNRESOLVED; + case 1: + return RESOLVED; + case 2: + return DEPLOYED; + case 3: + return SUSPENDED; + case 4: + return ON; + case 5: + return WAITING_FOR_INPUT; + case 6: + return UNKNOWN; + case 7: + return UNRECOGNIZED; + case 8: + return OFF; + case 9: + return INCONSISTENT; + case 10: + return MIXED; + case 11: + return PENDING_DESCRIPTOR; + case 12: + return COPYING; + case 13: + return PENDING_CONTENTS; + case 14: + return QUARANTINED; + case 15: + return QUARANTINE_EXPIRED; + case 16: + return REJECTED; + case 17: + return TRANSFER_TIMEOUT; + default: + return UNRECOGNIZED; + } + } + +}
