From 78152717170c6a125a973c1d8734e44149e116a4 Mon Sep 17 00:00:00 2001 From: danikov Date: Fri, 9 Mar 2012 01:56:03 +0000 Subject: [PATCH] adminOrg base (domain objects, clients, etc.) --- .../v1_5/VCloudDirectorAsyncClient.java | 7 + .../director/v1_5/VCloudDirectorClient.java | 7 + .../vcloud/director/v1_5/domain/AdminOrg.java | 311 ++++++++++ .../v1_5/domain/CustomOrgLdapSettings.java | 537 ++++++++++++++++++ .../director/v1_5/domain/EntityType.java | 46 ++ .../vcloud/director/v1_5/domain/Networks.java | 171 ++++++ .../vcloud/director/v1_5/domain/Org.java | 52 +- .../v1_5/domain/OrgEmailSettings.java | 385 +++++++++++++ .../v1_5/domain/OrgGeneralSettings.java | 311 ++++++++++ .../v1_5/domain/OrgLdapGroupAttributes.java | 294 ++++++++++ .../director/v1_5/domain/OrgLdapSettings.java | 250 ++++++++ .../v1_5/domain/OrgLdapUserAttributes.java | 415 ++++++++++++++ .../v1_5/domain/OrgLeaseSettings.java | 249 ++++++++ .../domain/OrgPasswordPolicySettings.java | 237 ++++++++ .../director/v1_5/domain/OrgSettings.java | 345 +++++++++++ .../domain/OrgVAppTemplateLeaseSettings.java | 219 +++++++ .../director/v1_5/domain/ResourceType.java | 53 ++ .../v1_5/domain/SmtpServerSettings.java | 232 ++++++++ .../vcloud/director/v1_5/domain/Vdcs.java | 171 ++++++ .../v1_5/features/AdminOrgAsyncClient.java | 63 ++ .../v1_5/features/AdminOrgClient.java | 66 +++ .../features/AdminOrgClientExpectTest.java | 72 +++ .../v1_5/features/AdminOrgClientLiveTest.java | 108 ++++ 23 files changed, 4598 insertions(+), 3 deletions(-) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomOrgLdapSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Networks.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgEmailSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapGroupAttributes.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapUserAttributes.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLeaseSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgPasswordPolicySettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgVAppTemplateLeaseSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SmtpServerSettings.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdcs.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java create mode 100644 labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java index 7c9108ddc2..9e5fc4bf91 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java @@ -28,6 +28,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; @@ -120,4 +121,10 @@ public interface VCloudDirectorAsyncClient { */ @Delegate GroupAsyncClient getGroupClient(); + + /** + * @return asynchronous access to {@link AdminOrg} features + */ + @Delegate + AdminOrgAsyncClient getAdminOrgClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java index aa922a4239..fc4858cec4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java @@ -31,6 +31,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient; +import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; import org.jclouds.vcloud.director.v1_5.features.GroupClient; import org.jclouds.vcloud.director.v1_5.features.MediaClient; @@ -123,4 +124,10 @@ public interface VCloudDirectorClient { */ @Delegate GroupClient getGroupClient(); + + /** + * @return synchronous access to {@link AdminOrg} features + */ + @Delegate + AdminOrgClient getAdminOrgClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java new file mode 100644 index 0000000000..a940c0cfca --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java @@ -0,0 +1,311 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * The AdminOrg represents an administrative view of an organization. + * It includes all members of the Org element, and adds several + * elements that can be viewed and modified only by system administrators. + * + * + *

Java class for AdminOrg complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="AdminOrg">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}OrgType">
+ *       <sequence>
+ *         <element name="Settings" type="{http://www.vmware.com/vcloud/v1.5}OrgSettingsType"/>
+ *         <element name="Users" type="{http://www.vmware.com/vcloud/v1.5}UsersListType" minOccurs="0"/>
+ *         <element name="Groups" type="{http://www.vmware.com/vcloud/v1.5}GroupsListType" minOccurs="0"/>
+ *         <element name="Catalogs" type="{http://www.vmware.com/vcloud/v1.5}CatalogsListType" minOccurs="0"/>
+ *         <element name="Vdcs" type="{http://www.vmware.com/vcloud/v1.5}VdcsType" minOccurs="0"/>
+ *         <element name="Networks" type="{http://www.vmware.com/vcloud/v1.5}NetworksType" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "AdminOrg") +@XmlType(propOrder = { + "settings", + "users", + "groups", + "catalogs", + "vdcs", + "networks" +}) +public class AdminOrg extends Org { + public static Builder builder() { + return new ConcreteBuilder(); + } + + public static Builder newBuilder() { + return new ConcreteBuilder(); + } + + public Builder toNewBuilder() { + return new ConcreteBuilder().fromAdminOrg(this); + } + + public static abstract class Builder> extends Org.NewBuilder { + + private OrgSettings settings; + private UsersList users; + private GroupsList groups; + private CatalogsList catalogs; + private Vdcs vdcs; + private Networks networks; + + protected abstract T self(); + + /** + * @see AdminOrg#getSettings() + */ + public T settings(OrgSettings settings) { + this.settings = settings; + return self(); + } + + /** + * @see AdminOrg#getUsers() + */ + public T users(UsersList users) { + this.users = users; + return self(); + } + + /** + * @see AdminOrg#getGroups() + */ + public T groups(GroupsList groups) { + this.groups = groups; + return self(); + } + + /** + * @see AdminOrg#getCatalogs() + */ + public T catalogs(CatalogsList catalogs) { + this.catalogs = catalogs; + return self(); + } + + /** + * @see AdminOrg#getVdcs() + */ + public T vdcs(Vdcs vdcs) { + this.vdcs = vdcs; + return self(); + } + + /** + * @see AdminOrg#getNetworks() + */ + public T networks(Networks networks) { + this.networks = networks; + return self(); + } + + public AdminOrg build() { + return new AdminOrg(settings, users, groups, catalogs, vdcs, networks); + } + + public T fromAdminOrg(AdminOrg in) { + return fromOrg(in) + .settings(in.getSettings()) + .users(in.getUsers()) + .groups(in.getGroups()) + .catalogs(in.getCatalogs()) + .vdcs(in.getVdcs()) + .networks(in.getNetworks()); + } + } + + private static class ConcreteBuilder extends Builder { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + @Deprecated + public Org.Builder toBuilder() { + throw new UnsupportedOperationException("Use toNewBuilder() instead"); + } + + protected AdminOrg() { + // For JAXB + } + + protected AdminOrg(OrgSettings settings, UsersList users, GroupsList groups, + CatalogsList catalogs, Vdcs vdcs, Networks networks) { + this.settings = settings; + this.users = users; + this.groups = groups; + this.catalogs = catalogs; + this.vdcs = vdcs; + this.networks = networks; + } + + @XmlElement(name = "Settings", required = true) + protected OrgSettings settings; + @XmlElement(name = "Users") + protected UsersList users; + @XmlElement(name = "Groups") + protected GroupsList groups; + @XmlElement(name = "Catalogs") + protected CatalogsList catalogs; + @XmlElement(name = "Vdcs") + protected Vdcs vdcs; + @XmlElement(name = "Networks") + protected Networks networks; + + /** + * Gets the value of the settings property. + * + * @return + * possible object is + * {@link OrgSettings } + * + */ + public OrgSettings getSettings() { + return settings; + } + + /** + * Gets the value of the users property. + * + * @return + * possible object is + * {@link UsersList } + * + */ + public UsersList getUsers() { + return users; + } + + /** + * Gets the value of the groups property. + * + * @return + * possible object is + * {@link GroupsList } + * + */ + public GroupsList getGroups() { + return groups; + } + + /** + * Gets the value of the catalogs property. + * + * @return + * possible object is + * {@link CatalogsList } + * + */ + public CatalogsList getCatalogs() { + return catalogs; + } + + /** + * Gets the value of the vdcs property. + * + * @return + * possible object is + * {@link Vdcs } + * + */ + public Vdcs getVdcs() { + return vdcs; + } + + /** + * Gets the value of the networks property. + * + * @return + * possible object is + * {@link Networks } + * + */ + public Networks getNetworks() { + return networks; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + AdminOrg that = AdminOrg.class.cast(o); + return super.equals(that) && + equal(settings, that.settings) && + equal(users, that.users) && + equal(groups, that.groups) && + equal(catalogs, that.catalogs) && + equal(vdcs, that.vdcs) && + equal(networks, that.networks); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + settings, + users, + groups, + catalogs, + vdcs, + networks); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("settings", settings) + .add("users", users) + .add("groups", groups) + .add("catalogs", catalogs) + .add("vdcs", vdcs) + .add("networks", networks); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomOrgLdapSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomOrgLdapSettings.java new file mode 100644 index 0000000000..3196ddf932 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CustomOrgLdapSettings.java @@ -0,0 +1,537 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Used when OrgLdapMode=CUSTOM to define connection details for + * the organization's LDAP service. + * + * + *

Java class for CustomOrgLdapSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CustomOrgLdapSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="HostName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Port" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="IsSsl" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="IsSslAcceptAll" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="Realm" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="SearchBase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="UserName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="AuthenticationMechanism" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="GroupSearchBase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="IsGroupSearchBaseEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="ConnectorType" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="UserAttributes" type="{http://www.vmware.com/vcloud/v1.5}OrgLdapUserAttributesType"/>
+ *         <element name="GroupAttributes" type="{http://www.vmware.com/vcloud/v1.5}OrgLdapGroupAttributesType"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CustomOrgLdapSettings", propOrder = { + "hostName", + "port", + "isSsl", + "isSslAcceptAll", + "realm", + "searchBase", + "userName", + "password", + "authenticationMechanism", + "groupSearchBase", + "isGroupSearchBaseEnabled", + "connectorType", + "userAttributes", + "groupAttributes" +}) +public class CustomOrgLdapSettings { + public static Builder builder() { + return new ConcreteBuilder(); + } + + public Builder toBuilder() { + return new ConcreteBuilder().fromCustomOrgLdapSettings(this); + } + + public static abstract class Builder> { + protected abstract T self(); + + private String hostName; + private int port; + private Boolean isSsl; + private Boolean isSslAcceptAll; + private String realm; + private String searchBase; + private String userName; + private String password; + private String authenticationMechanism; + private String groupSearchBase; + private boolean isGroupSearchBaseEnabled; + private String connectorType; + private OrgLdapUserAttributes userAttributes; + private OrgLdapGroupAttributes groupAttributes; + + /** + * @see CustomOrgLdapSettings#getHostName() + */ + public T hostName(String hostName) { + this.hostName = hostName; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getPort() + */ + public T port(int port) { + this.port = port; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getIsSsl() + */ + public T isSsl(Boolean isSsl) { + this.isSsl = isSsl; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getIsSslAcceptAll() + */ + public T isSslAcceptAll(Boolean isSslAcceptAll) { + this.isSslAcceptAll = isSslAcceptAll; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getRealm() + */ + public T realm(String realm) { + this.realm = realm; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getSearchBase() + */ + public T searchBase(String searchBase) { + this.searchBase = searchBase; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getUserName() + */ + public T userName(String userName) { + this.userName = userName; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getPassword() + */ + public T password(String password) { + this.password = password; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getAuthenticationMechanism() + */ + public T authenticationMechanism(String authenticationMechanism) { + this.authenticationMechanism = authenticationMechanism; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getGroupSearchBase() + */ + public T groupSearchBase(String groupSearchBase) { + this.groupSearchBase = groupSearchBase; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getIsGroupSearchBaseEnabled() + */ + public T isGroupSearchBaseEnabled(boolean isGroupSearchBaseEnabled) { + this.isGroupSearchBaseEnabled = isGroupSearchBaseEnabled; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getConnectorType() + */ + public T connectorType(String connectorType) { + this.connectorType = connectorType; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getUserAttributes() + */ + public T userAttributes(OrgLdapUserAttributes userAttributes) { + this.userAttributes = userAttributes; + return self(); + } + + /** + * @see CustomOrgLdapSettings#getGroupAttributes() + */ + public T groupAttributes(OrgLdapGroupAttributes groupAttributes) { + this.groupAttributes = groupAttributes; + return self(); + } + + + public CustomOrgLdapSettings build() { + return new CustomOrgLdapSettings(hostName, port, isSsl, isSslAcceptAll, + realm, searchBase, userName, password, authenticationMechanism, + groupSearchBase, isGroupSearchBaseEnabled, connectorType, + userAttributes, groupAttributes); + } + + + public T fromCustomOrgLdapSettings(CustomOrgLdapSettings in) { + return hostName(in.getHostName()) + .port(in.getPort()) + .isSsl(in.isSsl()) + .isSslAcceptAll(in.isSslAcceptAll()) + .realm(in.getRealm()) + .searchBase(in.getSearchBase()) + .userName(in.getUserName()) + .password(in.getPassword()) + .authenticationMechanism(in.getAuthenticationMechanism()) + .groupSearchBase(in.getGroupSearchBase()) + .isGroupSearchBaseEnabled(in.isGroupSearchBaseEnabled()) + .connectorType(in.getConnectorType()) + .userAttributes(in.getUserAttributes()) + .groupAttributes(in.getGroupAttributes()); + } + + } + + public static class ConcreteBuilder extends Builder { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + protected CustomOrgLdapSettings() { + // For JAXB + } + + private CustomOrgLdapSettings(String hostName, int port, Boolean isSsl, + Boolean isSslAcceptAll, String realm, String searchBase, String userName, + String password, String authenticationMechanism, String groupSearchBase, + boolean isGroupSearchBaseEnabled, String connectorType, + OrgLdapUserAttributes userAttributes, OrgLdapGroupAttributes groupAttributes) { + this.hostName = hostName; + this.port = port; + this.isSsl = isSsl; + this.password = password; + this.authenticationMechanism = authenticationMechanism; + + } + + + + @XmlElement(name = "HostName", required = true) + protected String hostName; + @XmlElement(name = "Port") + protected int port; + @XmlElement(name = "IsSsl") + protected Boolean isSsl; + @XmlElement(name = "IsSslAcceptAll") + protected Boolean isSslAcceptAll; + @XmlElement(name = "Realm") + protected String realm; + @XmlElement(name = "SearchBase") + protected String searchBase; + @XmlElement(name = "UserName") + protected String userName; + @XmlElement(name = "Password") + protected String password; + @XmlElement(name = "AuthenticationMechanism", required = true) + protected String authenticationMechanism; + @XmlElement(name = "GroupSearchBase") + protected String groupSearchBase; + @XmlElement(name = "IsGroupSearchBaseEnabled") + protected boolean isGroupSearchBaseEnabled; + @XmlElement(name = "ConnectorType", required = true) + protected String connectorType; + @XmlElement(name = "UserAttributes", required = true) + protected OrgLdapUserAttributes userAttributes; + @XmlElement(name = "GroupAttributes", required = true) + protected OrgLdapGroupAttributes groupAttributes; + + /** + * Gets the value of the hostName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHostName() { + return hostName; + } + + /** + * Gets the value of the port property. + * + */ + public int getPort() { + return port; + } + + /** + * Gets the value of the isSsl property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSsl() { + return isSsl; + } + + + /** + * Gets the value of the isSslAcceptAll property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSslAcceptAll() { + return isSslAcceptAll; + } + + /** + * Gets the value of the realm property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRealm() { + return realm; + } + + /** + * Gets the value of the searchBase property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSearchBase() { + return searchBase; + } + + /** + * Gets the value of the userName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUserName() { + return userName; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + /** + * Gets the value of the authenticationMechanism property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAuthenticationMechanism() { + return authenticationMechanism; + } + + /** + * Gets the value of the groupSearchBase property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGroupSearchBase() { + return groupSearchBase; + } + + /** + * Gets the value of the isGroupSearchBaseEnabled property. + * + */ + public boolean isGroupSearchBaseEnabled() { + return isGroupSearchBaseEnabled; + } + + /** + * Gets the value of the connectorType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConnectorType() { + return connectorType; + } + + /** + * Gets the value of the userAttributes property. + * + * @return + * possible object is + * {@link OrgLdapUserAttributes } + * + */ + public OrgLdapUserAttributes getUserAttributes() { + return userAttributes; + } + + /** + * Gets the value of the groupAttributes property. + * + * @return + * possible object is + * {@link OrgLdapGroupAttributes } + * + */ + public OrgLdapGroupAttributes getGroupAttributes() { + return groupAttributes; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CustomOrgLdapSettings that = CustomOrgLdapSettings.class.cast(o); + return super.equals(that) && + equal(hostName, that.hostName) && + equal(port, that.port) && + equal(isSsl, that.isSsl) && + equal(isSslAcceptAll, that.isSslAcceptAll) && + equal(realm, that.realm) && + equal(searchBase, that.searchBase) && + equal(userName, that.userName) && + equal(password, that.password) && + equal(authenticationMechanism, that.authenticationMechanism) && + equal(groupSearchBase, that.groupSearchBase) && + equal(isGroupSearchBaseEnabled, that.isGroupSearchBaseEnabled) && + equal(connectorType, that.connectorType) && + equal(userAttributes, that.userAttributes) && + equal(groupAttributes, that.groupAttributes); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + hostName, + port, + isSsl, + isSslAcceptAll, + realm, + searchBase, + userName, + password, + authenticationMechanism, + groupSearchBase, + isGroupSearchBaseEnabled, + connectorType, + userAttributes, + groupAttributes); + } + + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("") + .add("hostName", hostName) + .add("port", port) + .add("isSsl", isSsl) + .add("isSslAcceptAll", isSslAcceptAll) + .add("realm", realm) + .add("searchBase", searchBase) + .add("userName", userName) + .add("password", password) + .add("authenticationMechanism", authenticationMechanism) + .add("groupSearchBase", groupSearchBase) + .add("isGroupSearchBaseEnabled", isGroupSearchBaseEnabled) + .add("connectorType", connectorType) + .add("userAttributes", userAttributes) + .add("groupAttributes", groupAttributes); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java index 3645f5e4d1..b9a0bc1fc9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java @@ -44,6 +44,52 @@ import com.google.common.collect.Sets; * @author Adam Lowe */ public abstract class EntityType> extends ResourceType { + + public static abstract class NewBuilder> extends ResourceType.NewBuilder { + + protected String description; + protected TasksInProgress tasksInProgress; + protected String name; + protected String id; + + /** + * @see EntityType#getName() + */ + public T name(String name) { + this.name = name; + return self(); + } + + /** + * @see EntityType#getDescription() + */ + public T description(String description) { + this.description = description; + return self(); + } + + /** + * @see EntityType#getId() + */ + public T id(String id) { + this.id = id; + return self(); + } + + /** + * @see EntityType#getTasksInProgress() + */ + public T tasksInProgress(TasksInProgress tasksInProgress) { + this.tasksInProgress = tasksInProgress; + return self(); + } + + public T fromEntityType(EntityType in) { + return fromResourceType(in) + .description(in.getDescription()).tasksInProgress(in.getTasksInProgress()) + .id(in.getId()).name(in.getName()); + } + } public static abstract class Builder> extends ResourceType.Builder { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Networks.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Networks.java new file mode 100644 index 0000000000..01323bf708 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Networks.java @@ -0,0 +1,171 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.ImmutableList; + + +/** + * + * Container for ReferenceType elements that reference ExternalNetwork objects. + * This element is created by the server and is read only. + * + * + *

Java class for Networks complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Networks">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Network" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Networks", propOrder = { + "network" +}) +public class Networks { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNetworks(this); + } + + public static class Builder { + + private List networks; + + /** + * @see Networks#getNetwork() + */ + public Builder networks(List networks) { + this.networks = ImmutableList.copyOf(networks); + return this; + } + + /** + * @see Networks#getNetwork() + */ + public Builder network(Reference network) { + this.networks.add(checkNotNull(network, "network")); + return this; + } + + public Networks build() { + return new Networks(networks); + } + + + public Builder fromNetworks(Networks in) { + return networks(in.getNetwork()); + } + } + + private Networks() { + // For JAXB + } + + private Networks(List networks) { + this.networks = networks; + } + + @XmlElement(name = "Network") + protected List networks; + + /** + * Gets the value of the network property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the network property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNetwork().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ReferenceType } + * + * + */ + public List getNetwork() { + if (networks == null) { + networks = new ArrayList(); + } + return this.networks; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Networks that = Networks.class.cast(o); + return equal(networks, that.networks); + } + + @Override + public int hashCode() { + return Objects.hashCode(networks); + } + + @Override + public String toString() { + return string().toString(); + } + + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("networks", networks); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java index 7e643bd648..69b9c48852 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java @@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.net.URI; import java.util.Set; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -48,8 +49,53 @@ public class Org extends EntityType { public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG; - @SuppressWarnings("unchecked") - public static Builder builder() { + public static NewBuilder builder() { + return new ConcreteBuilder(); + } + + public NewBuilder toNewBuilder() { + return new ConcreteBuilder().fromOrg(this); + } + + public static abstract class NewBuilder> extends EntityType.NewBuilder { + + private String fullName; + private Boolean isEnabled; + + /** + * @see Org#getFullName() + */ + public T fullName(String fullName) { + this.fullName = fullName; + return self(); + } + + /** + * @see Org#isEnabled() + */ + public T isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return self(); + } + + @Override + public Org build() { + return new Org(href, type, links, description, tasksInProgress, id, name, fullName, isEnabled); + } + + public T fromOrg(Org in) { + return fromEntityType(in).fullName(in.getFullName()); + } + } + + private static class ConcreteBuilder extends NewBuilder { + @Override + protected ConcreteBuilder self() { + return this; + } + } + + public static Builder oldBuilder() { return new Builder(); } @@ -182,7 +228,7 @@ public class Org extends EntityType { } } - private Org() { + protected Org() { // for JAXB } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgEmailSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgEmailSettings.java new file mode 100644 index 0000000000..64e528a3eb --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgEmailSettings.java @@ -0,0 +1,385 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.ImmutableList; + + +/** + * + * Defines the email settings for an organization. + * + * + *

Java class for OrgEmailSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgEmailSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="IsDefaultSmtpServer" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="IsDefaultOrgEmail" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="FromEmailAddress" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="DefaultSubjectPrefix" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="IsAlertEmailToAllAdmins" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="AlertEmailTo" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="SmtpServerSettings" type="{http://www.vmware.com/vcloud/v1.5}SmtpServerSettingsType" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "OrgEmailSettings") +@XmlType(propOrder = { + "isDefaultSmtpServer", + "isDefaultOrgEmail", + "fromEmailAddress", + "defaultSubjectPrefix", + "isAlertEmailToAllAdmins", + "alertEmailTo", + "smtpServerSettings" +}) +public class OrgEmailSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgEmailSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private boolean isDefaultSmtpServer; + private boolean isDefaultOrgEmail; + private String fromEmailAddress; + private String defaultSubjectPrefix; + private boolean isAlertEmailToAllAdmins; + private List alertEmailTo; + private SmtpServerSettings smtpServerSettings; + + /** + * @see OrgEmailSettings#getIsDefaultSmtpServer() + */ + public Builder isDefaultSmtpServer(boolean isDefaultSmtpServer) { + this.isDefaultSmtpServer = isDefaultSmtpServer; + return this; + } + + /** + * @see OrgEmailSettings#getIsDefaultOrgEmail() + */ + public Builder isDefaultOrgEmail(boolean isDefaultOrgEmail) { + this.isDefaultOrgEmail = isDefaultOrgEmail; + return this; + } + + /** + * @see OrgEmailSettings#getFromEmailAddress() + */ + public Builder fromEmailAddress(String fromEmailAddress) { + this.fromEmailAddress = fromEmailAddress; + return this; + } + + /** + * @see OrgEmailSettings#getDefaultSubjectPrefix() + */ + public Builder defaultSubjectPrefix(String defaultSubjectPrefix) { + this.defaultSubjectPrefix = defaultSubjectPrefix; + return this; + } + + /** + * @see OrgEmailSettings#getIsAlertEmailToAllAdmins() + */ + public Builder isAlertEmailToAllAdmins(boolean isAlertEmailToAllAdmins) { + this.isAlertEmailToAllAdmins = isAlertEmailToAllAdmins; + return this; + } + + /** + * @see OrgEmailSettings#getAlertEmailTo() + */ + public Builder alertEmailsTo(List alertEmailsTo) { + this.alertEmailTo = ImmutableList.copyOf(alertEmailsTo); + return this; + } + + /** + * @see OrgEmailSettings#getAlertEmailTo() + */ + public Builder alertEmailTo(String alertEmailTo) { + this.alertEmailTo.add(checkNotNull(alertEmailTo, "alertEmailTo")); + return this; + } + + /** + * @see OrgEmailSettings#getSmtpServerSettings() + */ + public Builder smtpServerSettings(SmtpServerSettings smtpServerSettings) { + this.smtpServerSettings = smtpServerSettings; + return this; + } + + public OrgEmailSettings build() { + return new OrgEmailSettings(isDefaultSmtpServer, isDefaultOrgEmail, fromEmailAddress, defaultSubjectPrefix, + isAlertEmailToAllAdmins, alertEmailTo, smtpServerSettings); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgEmailSettings(OrgEmailSettings in) { + return fromResourceType(in) + .isDefaultSmtpServer(in.isDefaultSmtpServer()) + .isDefaultOrgEmail(in.isDefaultOrgEmail()) + .fromEmailAddress(in.getFromEmailAddress()) + .defaultSubjectPrefix(in.getDefaultSubjectPrefix()) + .isAlertEmailToAllAdmins(in.isAlertEmailToAllAdmins()) + .alertEmailsTo(in.getAlertEmailsTo()) + .smtpServerSettings(in.getSmtpServerSettings()); + } + } + + private OrgEmailSettings() { + // For JAXB + } + + private OrgEmailSettings(boolean isDefaultSmtpServer, boolean isDefaultOrgEmail, + String fromEmailAddress, String defaultSubjectPrefix, boolean isAlertEmailToAllAdmins, + List alertEmailTo, SmtpServerSettings smtpServerSettings) { + this.isDefaultSmtpServer = isDefaultSmtpServer; + this.isDefaultOrgEmail = isDefaultOrgEmail; + this.fromEmailAddress = fromEmailAddress; + this.defaultSubjectPrefix = defaultSubjectPrefix; + this.isAlertEmailToAllAdmins = isAlertEmailToAllAdmins; + this.alertEmailsTo = alertEmailTo; + this.smtpServerSettings = smtpServerSettings; + } + + @XmlElement(name = "IsDefaultSmtpServer") + protected boolean isDefaultSmtpServer; + @XmlElement(name = "IsDefaultOrgEmail") + protected boolean isDefaultOrgEmail; + @XmlElement(name = "FromEmailAddress", required = true) + protected String fromEmailAddress; + @XmlElement(name = "DefaultSubjectPrefix", required = true) + protected String defaultSubjectPrefix; + @XmlElement(name = "IsAlertEmailToAllAdmins") + protected boolean isAlertEmailToAllAdmins; + @XmlElement(name = "AlertEmailTo") + protected List alertEmailsTo; + @XmlElement(name = "SmtpServerSettings") + protected SmtpServerSettings smtpServerSettings; + + /** + * Gets the value of the isDefaultSmtpServer property. + * + */ + public boolean isDefaultSmtpServer() { + return isDefaultSmtpServer; + } + + /** + * Gets the value of the isDefaultOrgEmail property. + * + */ + public boolean isDefaultOrgEmail() { + return isDefaultOrgEmail; + } + + /** + * Gets the value of the fromEmailAddress property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFromEmailAddress() { + return fromEmailAddress; + } + + /** + * Gets the value of the defaultSubjectPrefix property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDefaultSubjectPrefix() { + return defaultSubjectPrefix; + } + + /** + * Gets the value of the isAlertEmailToAllAdmins property. + * + */ + public boolean isAlertEmailToAllAdmins() { + return isAlertEmailToAllAdmins; + } + + /** + * Gets the value of the alertEmailTo property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the alertEmailTo property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAlertEmailTo().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getAlertEmailsTo() { + if (alertEmailsTo == null) { + alertEmailsTo = new ArrayList(); + } + return this.alertEmailsTo; + } + + /** + * Gets the value of the smtpServerSettings property. + * + * @return + * possible object is + * {@link SmtpServerSettings } + * + */ + public SmtpServerSettings getSmtpServerSettings() { + return smtpServerSettings; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgEmailSettings that = OrgEmailSettings.class.cast(o); + return super.equals(that) && + equal(isDefaultSmtpServer, that.isDefaultSmtpServer) && + equal(isDefaultOrgEmail, that.isDefaultOrgEmail) && + equal(fromEmailAddress, that.fromEmailAddress) && + equal(defaultSubjectPrefix, that.defaultSubjectPrefix) && + equal(isAlertEmailToAllAdmins, that.isAlertEmailToAllAdmins) && + equal(alertEmailsTo, that.alertEmailsTo) && + equal(smtpServerSettings, that.smtpServerSettings); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + isDefaultSmtpServer, + isDefaultOrgEmail, + fromEmailAddress, + defaultSubjectPrefix, + isAlertEmailToAllAdmins, + alertEmailsTo, + smtpServerSettings); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("isDefaultSmtpServer", isDefaultSmtpServer) + .add("isDefaultOrgEmail", isDefaultOrgEmail) + .add("fromEmailAddress", fromEmailAddress) + .add("defaultSubjectPrefix", defaultSubjectPrefix) + .add("isAlertEmailToAllAdmins", isAlertEmailToAllAdmins) + .add("alertEmailsTo", alertEmailsTo) + .add("smtpServerSettings", smtpServerSettings); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java new file mode 100644 index 0000000000..67eec98430 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgGeneralSettings.java @@ -0,0 +1,311 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Defines general org settings. + * + * + *

Java class for OrgGeneralSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgGeneralSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="CanPublishCatalogs" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="DeployedVMQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="StoredVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="UseServerBootSequence" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="DelayAfterPowerOnSeconds" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "OrgGeneralSettings") +@XmlType(propOrder = { + "canPublishCatalogs", + "deployedVMQuota", + "storedVmQuota", + "useServerBootSequence", + "delayAfterPowerOnSeconds" +}) +public class OrgGeneralSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgGeneralSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private Boolean canPublishCatalogs; + private Integer deployedVMQuota; + private Integer storedVmQuota; + private Boolean useServerBootSequence; + private Integer delayAfterPowerOnSeconds; + + /** + * @see OrgGeneralSettings#getCanPublishCatalogs() + */ + public Builder canPublishCatalogs(Boolean canPublishCatalogs) { + this.canPublishCatalogs = canPublishCatalogs; + return this; + } + + /** + * @see OrgGeneralSettings#getDeployedVMQuota() + */ + public Builder deployedVMQuota(Integer deployedVMQuota) { + this.deployedVMQuota = deployedVMQuota; + return this; + } + + /** + * @see OrgGeneralSettings#getStoredVmQuota() + */ + public Builder storedVmQuota(Integer storedVmQuota) { + this.storedVmQuota = storedVmQuota; + return this; + } + + /** + * @see OrgGeneralSettings#getUseServerBootSequence() + */ + public Builder useServerBootSequence(Boolean useServerBootSequence) { + this.useServerBootSequence = useServerBootSequence; + return this; + } + + /** + * @see OrgGeneralSettings#getDelayAfterPowerOnSeconds() + */ + public Builder delayAfterPowerOnSeconds(Integer delayAfterPowerOnSeconds) { + this.delayAfterPowerOnSeconds = delayAfterPowerOnSeconds; + return this; + } + + + public OrgGeneralSettings build() { + return new OrgGeneralSettings(href, type, links, + canPublishCatalogs, deployedVMQuota, + storedVmQuota, useServerBootSequence, delayAfterPowerOnSeconds); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgGeneralSettings(OrgGeneralSettings in) { + return fromResourceType(in) + .canPublishCatalogs(in.canPublishCatalogs()) + .deployedVMQuota(in.getDeployedVMQuota()) + .storedVmQuota(in.getStoredVmQuota()) + .useServerBootSequence(in.useServerBootSequence()) + .delayAfterPowerOnSeconds(in.getDelayAfterPowerOnSeconds()); + } + } + + @SuppressWarnings("unused") + private OrgGeneralSettings() { + // For JAXB + } + + public OrgGeneralSettings(URI href, String type, Set links, + Boolean canPublishCatalogs, Integer deployedVMQuota, + Integer storedVmQuota, Boolean useServerBootSequence, Integer delayAfterPowerOnSeconds) { + super(href, type, links); + this.canPublishCatalogs = canPublishCatalogs; + this.deployedVMQuota = deployedVMQuota; + this.storedVmQuota = storedVmQuota; + this.useServerBootSequence = useServerBootSequence; + this.delayAfterPowerOnSeconds = delayAfterPowerOnSeconds; + } + + @XmlElement(name = "CanPublishCatalogs") + protected Boolean canPublishCatalogs; + @XmlElement(name = "DeployedVMQuota") + protected Integer deployedVMQuota; + @XmlElement(name = "StoredVmQuota") + protected Integer storedVmQuota; + @XmlElement(name = "UseServerBootSequence") + protected Boolean useServerBootSequence; + @XmlElement(name = "DelayAfterPowerOnSeconds") + protected Integer delayAfterPowerOnSeconds; + + /** + * Gets the value of the canPublishCatalogs property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean canPublishCatalogs() { + return canPublishCatalogs; + } + + /** + * Gets the value of the deployedVMQuota property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getDeployedVMQuota() { + return deployedVMQuota; + } + + /** + * Gets the value of the storedVmQuota property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getStoredVmQuota() { + return storedVmQuota; + } + + /** + * Gets the value of the useServerBootSequence property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean useServerBootSequence() { + return useServerBootSequence; + } + + /** + * Gets the value of the delayAfterPowerOnSeconds property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getDelayAfterPowerOnSeconds() { + return delayAfterPowerOnSeconds; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgGeneralSettings that = OrgGeneralSettings.class.cast(o); + return super.equals(that) && + equal(canPublishCatalogs, that.canPublishCatalogs) && + equal(deployedVMQuota, that.deployedVMQuota) && + equal(storedVmQuota, that.storedVmQuota) && + equal(useServerBootSequence, that.useServerBootSequence) && + equal(delayAfterPowerOnSeconds, that.delayAfterPowerOnSeconds); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + canPublishCatalogs, + deployedVMQuota, + storedVmQuota, + useServerBootSequence, + delayAfterPowerOnSeconds); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("canPublishCatalogs", canPublishCatalogs) + .add("deployedVMQuota", deployedVMQuota) + .add("storedVmQuota", storedVmQuota) + .add("useServerBootSequence", useServerBootSequence) + .add("delayAfterPowerOnSeconds", delayAfterPowerOnSeconds); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapGroupAttributes.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapGroupAttributes.java new file mode 100644 index 0000000000..93384b4ac6 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapGroupAttributes.java @@ -0,0 +1,294 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Defines how a group is imported from LDAP. + * + * + *

Java class for OrgLdapGroupAttributes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgLdapGroupAttributes">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="ObjectClass" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ObjectIdentifier" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="GroupName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Membership" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="MembershipIdentifier" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="BackLinkIdentifier" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OrgLdapGroupAttributes", propOrder = { + "objectClass", + "objectIdentifier", + "groupName", + "membership", + "membershipIdentifier", + "backLinkIdentifier" +}) +public class OrgLdapGroupAttributes { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgLdapGroupAttributes(this); + } + + public static class Builder { + + private String objectClass; + private String objectIdentifier; + private String groupName; + private String membership; + private String membershipIdentifier; + private String backLinkIdentifier; + + /** + * @see OrgLdapGroupAttributes#getObjectClass() + */ + public Builder objectClass(String objectClass) { + this.objectClass = objectClass; + return this; + } + + /** + * @see OrgLdapGroupAttributes#getObjectIdentifier() + */ + public Builder objectIdentifier(String objectIdentifier) { + this.objectIdentifier = objectIdentifier; + return this; + } + + /** + * @see OrgLdapGroupAttributes#getGroupName() + */ + public Builder groupName(String groupName) { + this.groupName = groupName; + return this; + } + + /** + * @see OrgLdapGroupAttributes#getMembership() + */ + public Builder membership(String membership) { + this.membership = membership; + return this; + } + + /** + * @see OrgLdapGroupAttributes#getMembershipIdentifier() + */ + public Builder membershipIdentifier(String membershipIdentifier) { + this.membershipIdentifier = membershipIdentifier; + return this; + } + + /** + * @see OrgLdapGroupAttributes#getBackLinkIdentifier() + */ + public Builder backLinkIdentifier(String backLinkIdentifier) { + this.backLinkIdentifier = backLinkIdentifier; + return this; + } + + + public OrgLdapGroupAttributes build() { + return new OrgLdapGroupAttributes(objectClass, objectIdentifier, groupName, + membership, membershipIdentifier, backLinkIdentifier); + } + + public Builder fromOrgLdapGroupAttributes(OrgLdapGroupAttributes in) { + return objectClass(in.getObjectClass()) + .objectIdentifier(in.getObjectIdentifier()) + .groupName(in.getGroupName()) + .membership(in.getMembership()) + .membershipIdentifier(in.getMembershipIdentifier()) + .backLinkIdentifier(in.getBackLinkIdentifier()); + } + } + + @SuppressWarnings("unused") + private OrgLdapGroupAttributes() { + // For JAXB + } + + public OrgLdapGroupAttributes(String objectClass, String objectIdentifier, + String groupName, String membership, String membershipIdentifier, + String backLinkIdentifier) { + this.objectClass = objectClass; + this.objectIdentifier = objectIdentifier; + this.groupName = groupName; + this.membership = membership; + this.membershipIdentifier = membershipIdentifier; + this.backLinkIdentifier = backLinkIdentifier; + } + + @XmlElement(name = "ObjectClass", required = true) + protected String objectClass; + @XmlElement(name = "ObjectIdentifier", required = true) + protected String objectIdentifier; + @XmlElement(name = "GroupName", required = true) + protected String groupName; + @XmlElement(name = "Membership", required = true) + protected String membership; + @XmlElement(name = "MembershipIdentifier", required = true) + protected String membershipIdentifier; + @XmlElement(name = "BackLinkIdentifier") + protected String backLinkIdentifier; + + /** + * Gets the value of the objectClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObjectClass() { + return objectClass; + } + + /** + * Gets the value of the objectIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObjectIdentifier() { + return objectIdentifier; + } + + /** + * Gets the value of the groupName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGroupName() { + return groupName; + } + + /** + * Gets the value of the membership property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMembership() { + return membership; + } + + /** + * Gets the value of the membershipIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMembershipIdentifier() { + return membershipIdentifier; + } + + /** + * Gets the value of the backLinkIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBackLinkIdentifier() { + return backLinkIdentifier; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgLdapGroupAttributes that = OrgLdapGroupAttributes.class.cast(o); + return equal(objectClass, that.objectClass) && + equal(objectIdentifier, that.objectIdentifier) && + equal(groupName, that.groupName) && + equal(membership, that.membership) && + equal(membershipIdentifier, that.membershipIdentifier) && + equal(backLinkIdentifier, that.backLinkIdentifier); + } + + @Override + public int hashCode() { + return Objects.hashCode(objectClass, + objectIdentifier, + groupName, + membership, + membershipIdentifier, + backLinkIdentifier); + } + + @Override + public String toString() { + return string().toString(); + } + + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("objectClass", objectClass) + .add("objectIdentifier", objectIdentifier) + .add("groupName", groupName) + .add("membership", membership) + .add("membershipIdentifier", membershipIdentifier) + .add("backLinkIdentifier", backLinkIdentifier); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapSettings.java new file mode 100644 index 0000000000..667ec88a20 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapSettings.java @@ -0,0 +1,250 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Base settings for LDAP connection + * + * + *

Java class for OrgLdapSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgLdapSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="OrgLdapMode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CustomUsersOu" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CustomOrgLdapSettings" type="{http://www.vmware.com/vcloud/v1.5}CustomOrgLdapSettings" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OrgLdapSettings", propOrder = { + "orgLdapMode", + "customUsersOu", + "customOrgLdapSettings" +}) +public class OrgLdapSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgLdapSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private String orgLdapMode; + private String customUsersOu; + private CustomOrgLdapSettings customOrgLdapSettings; + + /** + * @see OrgLdapSettings#getOrgLdapMode() + */ + public Builder orgLdapMode(String orgLdapMode) { + this.orgLdapMode = orgLdapMode; + return this; + } + + /** + * @see OrgLdapSettings#getCustomUsersOu() + */ + public Builder customUsersOu(String customUsersOu) { + this.customUsersOu = customUsersOu; + return this; + } + + /** + * @see OrgLdapSettings#getCustomOrgLdapSettings() + */ + public Builder customOrgLdapSettings(CustomOrgLdapSettings customOrgLdapSettings) { + this.customOrgLdapSettings = customOrgLdapSettings; + return this; + } + + public OrgLdapSettings build() { + OrgLdapSettings orgLdapSettings = new OrgLdapSettings(href, type, links, + orgLdapMode, customUsersOu, customOrgLdapSettings); + return orgLdapSettings; + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgLdapSettings(OrgLdapSettings in) { + return fromResourceType(in) + .orgLdapMode(in.getOrgLdapMode()) + .customUsersOu(in.getCustomUsersOu()) + .customOrgLdapSettings(in.getCustomOrgLdapSettings()); + } + } + + @SuppressWarnings("unused") + private OrgLdapSettings() { + // For JAXB + } + + public OrgLdapSettings(URI href, String type, Set links, + String orgLdapMode, String customUsersOu, CustomOrgLdapSettings customOrgLdapSettings) { + super(href, type, links); + this.orgLdapMode = orgLdapMode; + this.customUsersOu = customUsersOu; + this.customOrgLdapSettings = customOrgLdapSettings; + } + + + + @XmlElement(name = "OrgLdapMode") + protected String orgLdapMode; + @XmlElement(name = "CustomUsersOu") + protected String customUsersOu; + @XmlElement(name = "CustomOrgLdapSettings") + protected CustomOrgLdapSettings customOrgLdapSettings; + + /** + * Gets the value of the orgLdapMode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrgLdapMode() { + return orgLdapMode; + } + + /** + * Gets the value of the customUsersOu property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomUsersOu() { + return customUsersOu; + } + + /** + * Gets the value of the customOrgLdapSettings property. + * + * @return + * possible object is + * {@link CustomOrgLdapSettings } + * + */ + public CustomOrgLdapSettings getCustomOrgLdapSettings() { + return customOrgLdapSettings; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgLdapSettings that = OrgLdapSettings.class.cast(o); + return super.equals(that) && + equal(orgLdapMode, that.orgLdapMode) && + equal(customUsersOu, that.customUsersOu) && + equal(customOrgLdapSettings, that.customOrgLdapSettings); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + orgLdapMode, + customUsersOu, + customOrgLdapSettings); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("orgLdapMode", orgLdapMode) + .add("customUsersOu", customUsersOu) + .add("customOrgLdapSettings", customOrgLdapSettings); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapUserAttributes.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapUserAttributes.java new file mode 100644 index 0000000000..7216f2df15 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLdapUserAttributes.java @@ -0,0 +1,415 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Defines how LDAP attributes are used when importing a user. + * + * + *

Java class for OrgLdapUserAttributes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgLdapUserAttributes">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="ObjectClass" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ObjectIdentifier" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="UserName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Email" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="FullName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="GivenName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Surname" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Telephone" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="GroupMembershipIdentifier" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="GroupBackLinkIdentifier" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OrgLdapUserAttributes", propOrder = { + "objectClass", + "objectIdentifier", + "userName", + "email", + "fullName", + "givenName", + "surname", + "telephone", + "groupMembershipIdentifier", + "groupBackLinkIdentifier" +}) +public class OrgLdapUserAttributes { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgLdapUserAttributes(this); + } + + public static class Builder { + + private String objectClass; + private String objectIdentifier; + private String userName; + private String email; + private String fullName; + private String givenName; + private String surname; + private String telephone; + private String groupMembershipIdentifier; + private String groupBackLinkIdentifier; + + /** + * @see OrgLdapUserAttributes#getObjectClass() + */ + public Builder objectClass(String objectClass) { + this.objectClass = objectClass; + return this; + } + + /** + * @see OrgLdapUserAttributes#getObjectIdentifier() + */ + public Builder objectIdentifier(String objectIdentifier) { + this.objectIdentifier = objectIdentifier; + return this; + } + + /** + * @see OrgLdapUserAttributes#getUserName() + */ + public Builder userName(String userName) { + this.userName = userName; + return this; + } + + /** + * @see OrgLdapUserAttributes#getEmail() + */ + public Builder email(String email) { + this.email = email; + return this; + } + + /** + * @see OrgLdapUserAttributes#getFullName() + */ + public Builder fullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * @see OrgLdapUserAttributes#getGivenName() + */ + public Builder givenName(String givenName) { + this.givenName = givenName; + return this; + } + + /** + * @see OrgLdapUserAttributes#getSurname() + */ + public Builder surname(String surname) { + this.surname = surname; + return this; + } + + /** + * @see OrgLdapUserAttributes#getTelephone() + */ + public Builder telephone(String telephone) { + this.telephone = telephone; + return this; + } + + /** + * @see OrgLdapUserAttributes#getGroupMembershipIdentifier() + */ + public Builder groupMembershipIdentifier(String groupMembershipIdentifier) { + this.groupMembershipIdentifier = groupMembershipIdentifier; + return this; + } + + /** + * @see OrgLdapUserAttributes#getGroupBackLinkIdentifier() + */ + public Builder groupBackLinkIdentifier(String groupBackLinkIdentifier) { + this.groupBackLinkIdentifier = groupBackLinkIdentifier; + return this; + } + + + public OrgLdapUserAttributes build() { + return new OrgLdapUserAttributes(objectClass, objectIdentifier, userName, email, + fullName, givenName, surname, telephone, groupMembershipIdentifier, groupBackLinkIdentifier); + } + + public Builder fromOrgLdapUserAttributes(OrgLdapUserAttributes in) { + return objectClass(in.getObjectClass()) + .objectIdentifier(in.getObjectIdentifier()) + .userName(in.getUserName()) + .email(in.getEmail()) + .fullName(in.getFullName()) + .givenName(in.getGivenName()) + .surname(in.getSurname()) + .telephone(in.getTelephone()) + .groupMembershipIdentifier(in.getGroupMembershipIdentifier()) + .groupBackLinkIdentifier(in.getGroupBackLinkIdentifier()); + } + } + + @SuppressWarnings("unused") + private OrgLdapUserAttributes() { + // For JAXB + } + + public OrgLdapUserAttributes(String objectClass, String objectIdentifier, + String userName, String email, String fullName, String givenName, + String surname, String telephone, String groupMembershipIdentifier, + String groupBackLinkIdentifier) { + this.objectClass = objectClass; + this.objectIdentifier = objectIdentifier; + this.userName = userName; + this.email = email; + this.fullName = fullName; + this.givenName = givenName; + this.surname = surname; + this.telephone = telephone; + this.groupMembershipIdentifier = groupMembershipIdentifier; + this.groupBackLinkIdentifier = groupBackLinkIdentifier; + } + + @XmlElement(name = "ObjectClass", required = true) + protected String objectClass; + @XmlElement(name = "ObjectIdentifier", required = true) + protected String objectIdentifier; + @XmlElement(name = "UserName", required = true) + protected String userName; + @XmlElement(name = "Email", required = true) + protected String email; + @XmlElement(name = "FullName", required = true) + protected String fullName; + @XmlElement(name = "GivenName", required = true) + protected String givenName; + @XmlElement(name = "Surname", required = true) + protected String surname; + @XmlElement(name = "Telephone", required = true) + protected String telephone; + @XmlElement(name = "GroupMembershipIdentifier", required = true) + protected String groupMembershipIdentifier; + @XmlElement(name = "GroupBackLinkIdentifier") + protected String groupBackLinkIdentifier; + + /** + * Gets the value of the objectClass property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObjectClass() { + return objectClass; + } + + /** + * Gets the value of the objectIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObjectIdentifier() { + return objectIdentifier; + } + + /** + * Gets the value of the userName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUserName() { + return userName; + } + + /** + * Gets the value of the email property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Gets the value of the fullName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFullName() { + return fullName; + } + + /** + * Gets the value of the givenName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGivenName() { + return givenName; + } + + /** + * Gets the value of the surname property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSurname() { + return surname; + } + + /** + * Gets the value of the telephone property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelephone() { + return telephone; + } + + /** + * Gets the value of the groupMembershipIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGroupMembershipIdentifier() { + return groupMembershipIdentifier; + } + + /** + * Gets the value of the groupBackLinkIdentifier property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGroupBackLinkIdentifier() { + return groupBackLinkIdentifier; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgLdapUserAttributes that = OrgLdapUserAttributes.class.cast(o); + return equal(objectClass, that.objectClass) && + equal(objectIdentifier, that.objectIdentifier) && + equal(userName, that.userName) && + equal(email, that.email) && + equal(fullName, that.fullName) && + equal(givenName, that.givenName) && + equal(surname, that.surname) && + equal(telephone, that.telephone) && + equal(groupMembershipIdentifier, that.groupMembershipIdentifier) && + equal(groupBackLinkIdentifier, that.groupBackLinkIdentifier); + } + + @Override + public int hashCode() { + return Objects.hashCode(objectClass, + objectIdentifier, + userName, + email, + fullName, + givenName, + surname, + telephone, + groupMembershipIdentifier, + groupBackLinkIdentifier); + } + + @Override + public String toString() { + return string().toString(); + } + + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("objectClass", objectClass) + .add("objectIdentifier", objectIdentifier) + .add("userName", userName) + .add("email", email) + .add("fullName", fullName) + .add("givenName", givenName) + .add("surname", surname) + .add("telephone", telephone) + .add("groupMembershipIdentifier", groupMembershipIdentifier) + .add("groupBackLinkIdentifier", groupBackLinkIdentifier); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLeaseSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLeaseSettings.java new file mode 100644 index 0000000000..26e9ace80e --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgLeaseSettings.java @@ -0,0 +1,249 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Defines default lease durations and policies for an organization. + * + * + *

Java class for OrgLeaseSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgLeaseSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="DeleteOnStorageLeaseExpiration" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="DeploymentLeaseSeconds" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="StorageLeaseSeconds" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "OrgLeaseSettings", propOrder = { + "deleteOnStorageLeaseExpiration", + "deploymentLeaseSeconds", + "storageLeaseSeconds" +}) +public class OrgLeaseSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgLeaseSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private Boolean deleteOnStorageLeaseExpiration; + private Integer deploymentLeaseSeconds; + private Integer storageLeaseSeconds; + + /** + * @see OrgLeaseSettings#getDeleteOnStorageLeaseExpiration() + */ + public Builder deleteOnStorageLeaseExpiration(Boolean deleteOnStorageLeaseExpiration) { + this.deleteOnStorageLeaseExpiration = deleteOnStorageLeaseExpiration; + return this; + } + + /** + * @see OrgLeaseSettings#getDeploymentLeaseSeconds() + */ + public Builder deploymentLeaseSeconds(Integer deploymentLeaseSeconds) { + this.deploymentLeaseSeconds = deploymentLeaseSeconds; + return this; + } + + /** + * @see OrgLeaseSettings#getStorageLeaseSeconds() + */ + public Builder storageLeaseSeconds(Integer storageLeaseSeconds) { + this.storageLeaseSeconds = storageLeaseSeconds; + return this; + } + + + public OrgLeaseSettings build() { + return new OrgLeaseSettings(href, type, links, deleteOnStorageLeaseExpiration, + deploymentLeaseSeconds, storageLeaseSeconds); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgLeaseSettings(OrgLeaseSettings in) { + return fromResourceType(in) + .deleteOnStorageLeaseExpiration(in.deleteOnStorageLeaseExpiration()) + .deploymentLeaseSeconds(in.getDeploymentLeaseSeconds()) + .storageLeaseSeconds(in.getStorageLeaseSeconds()); + } + } + + @SuppressWarnings("unused") + private OrgLeaseSettings() { + // For JAXB + } + + public OrgLeaseSettings(URI href, String type, Set links, + Boolean deleteOnStorageLeaseExpiration, + Integer deploymentLeaseSeconds, Integer storageLeaseSeconds) { + super(href, type, links); + this.deleteOnStorageLeaseExpiration = deleteOnStorageLeaseExpiration; + this.deploymentLeaseSeconds = deploymentLeaseSeconds; + this.storageLeaseSeconds = storageLeaseSeconds; + } + + @XmlElement(name = "DeleteOnStorageLeaseExpiration") + protected Boolean deleteOnStorageLeaseExpiration; + @XmlElement(name = "DeploymentLeaseSeconds") + protected Integer deploymentLeaseSeconds; + @XmlElement(name = "StorageLeaseSeconds") + protected Integer storageLeaseSeconds; + + /** + * Gets the value of the deleteOnStorageLeaseExpiration property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean deleteOnStorageLeaseExpiration() { + return deleteOnStorageLeaseExpiration; + } + + /** + * Gets the value of the deploymentLeaseSeconds property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getDeploymentLeaseSeconds() { + return deploymentLeaseSeconds; + } + + /** + * Gets the value of the storageLeaseSeconds property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getStorageLeaseSeconds() { + return storageLeaseSeconds; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgLeaseSettings that = OrgLeaseSettings.class.cast(o); + return super.equals(that) && + equal(deleteOnStorageLeaseExpiration, that.deleteOnStorageLeaseExpiration) && + equal(deploymentLeaseSeconds, that.deploymentLeaseSeconds) && + equal(storageLeaseSeconds, that.storageLeaseSeconds); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + deleteOnStorageLeaseExpiration, + deploymentLeaseSeconds, + storageLeaseSeconds); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("deleteOnStorageLeaseExpiration", deleteOnStorageLeaseExpiration) + .add("deploymentLeaseSeconds", deploymentLeaseSeconds) + .add("storageLeaseSeconds", storageLeaseSeconds); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgPasswordPolicySettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgPasswordPolicySettings.java new file mode 100644 index 0000000000..d766f513ae --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgPasswordPolicySettings.java @@ -0,0 +1,237 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * 1.5 + * + *

Java class for OrgPasswordPolicySettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgPasswordPolicySettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="AccountLockoutEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="InvalidLoginsBeforeLockout" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="AccountLockoutIntervalMinutes" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "OrgPasswordPolicySettings") +@XmlType(propOrder = { + "accountLockoutEnabled", + "invalidLoginsBeforeLockout", + "accountLockoutIntervalMinutes" +}) +public class OrgPasswordPolicySettings extends ResourceType { + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgPasswordPolicySettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private boolean accountLockoutEnabled; + private int invalidLoginsBeforeLockout; + private int accountLockoutIntervalMinutes; + + /** + * @see OrgPasswordPolicySettings#getAccountLockoutEnabled() + */ + public Builder accountLockoutEnabled(boolean accountLockoutEnabled) { + this.accountLockoutEnabled = accountLockoutEnabled; + return this; + } + + /** + * @see OrgPasswordPolicySettings#getInvalidLoginsBeforeLockout() + */ + public Builder invalidLoginsBeforeLockout(int invalidLoginsBeforeLockout) { + this.invalidLoginsBeforeLockout = invalidLoginsBeforeLockout; + return this; + } + + /** + * @see OrgPasswordPolicySettings#getAccountLockoutIntervalMinutes() + */ + public Builder accountLockoutIntervalMinutes(int accountLockoutIntervalMinutes) { + this.accountLockoutIntervalMinutes = accountLockoutIntervalMinutes; + return this; + } + + public OrgPasswordPolicySettings build() { + return new OrgPasswordPolicySettings(href, type, links, accountLockoutEnabled, invalidLoginsBeforeLockout, + accountLockoutIntervalMinutes); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgPasswordPolicySettings(OrgPasswordPolicySettings in) { + return fromResourceType(in) + .accountLockoutEnabled(in.isAccountLockoutEnabled()) + .invalidLoginsBeforeLockout(in.getInvalidLoginsBeforeLockout()) + .accountLockoutIntervalMinutes(in.getAccountLockoutIntervalMinutes()); + } + } + + @SuppressWarnings("unused") + private OrgPasswordPolicySettings() { + // For JAXB + } + + public OrgPasswordPolicySettings(URI href, String type, Set links, + boolean accountLockoutEnabled, int invalidLoginsBeforeLockout, + int accountLockoutIntervalMinutes) { + super(href, type, links); + this.accountLockoutEnabled = accountLockoutEnabled; + this.invalidLoginsBeforeLockout = invalidLoginsBeforeLockout; + this.accountLockoutIntervalMinutes = accountLockoutIntervalMinutes; + } + + @XmlElement(name = "AccountLockoutEnabled") + protected boolean accountLockoutEnabled; + @XmlElement(name = "InvalidLoginsBeforeLockout") + protected int invalidLoginsBeforeLockout; + @XmlElement(name = "AccountLockoutIntervalMinutes") + protected int accountLockoutIntervalMinutes; + + /** + * Gets the value of the accountLockoutEnabled property. + * + */ + public boolean isAccountLockoutEnabled() { + return accountLockoutEnabled; + } + + /** + * Gets the value of the invalidLoginsBeforeLockout property. + * + */ + public int getInvalidLoginsBeforeLockout() { + return invalidLoginsBeforeLockout; + } + + /** + * Gets the value of the accountLockoutIntervalMinutes property. + * + */ + public int getAccountLockoutIntervalMinutes() { + return accountLockoutIntervalMinutes; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgPasswordPolicySettings that = OrgPasswordPolicySettings.class.cast(o); + return super.equals(that) && + equal(accountLockoutEnabled, that.accountLockoutEnabled) && + equal(invalidLoginsBeforeLockout, that.invalidLoginsBeforeLockout) && + equal(accountLockoutIntervalMinutes, that.accountLockoutIntervalMinutes); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + accountLockoutEnabled, + invalidLoginsBeforeLockout, + accountLockoutIntervalMinutes); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("accountLockoutEnabled", accountLockoutEnabled) + .add("invalidLoginsBeforeLockout", invalidLoginsBeforeLockout) + .add("accountLockoutIntervalMinutes", accountLockoutIntervalMinutes); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java new file mode 100644 index 0000000000..8a6e88fd4c --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgSettings.java @@ -0,0 +1,345 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Describes various settings for some organization. + * This type establishes quotas and policies for the organization. + * It also contains elements that specify the details of + * how the organization connects to LDAP and email services. + * + * + *

Java class for OrgSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="OrgGeneralSettings" type="{http://www.vmware.com/vcloud/v1.5}OrgGeneralSettingsType" minOccurs="0"/>
+ *         <element name="VAppLeaseSettings" type="{http://www.vmware.com/vcloud/v1.5}OrgLeaseSettingsType" minOccurs="0"/>
+ *         <element name="VAppTemplateLeaseSettings" type="{http://www.vmware.com/vcloud/v1.5}OrgVAppTemplateLeaseSettingsType" minOccurs="0"/>
+ *         <element name="OrgLdapSettings" type="{http://www.vmware.com/vcloud/v1.5}OrgLdapSettingsType" minOccurs="0"/>
+ *         <element name="OrgEmailSettings" type="{http://www.vmware.com/vcloud/v1.5}OrgEmailSettingsType" minOccurs="0"/>
+ *         <element name="OrgPasswordPolicySettings" type="{http://www.vmware.com/vcloud/v1.5}OrgPasswordPolicySettingsType" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "OrgSettings") +@XmlType(propOrder = { + "orgGeneralSettings", + "vAppLeaseSettings", + "vAppTemplateLeaseSettings", + "orgLdapSettings", + "orgEmailSettings", + "orgPasswordPolicySettings" +}) +public class OrgSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private OrgGeneralSettings orgGeneralSettings; + private OrgLeaseSettings vAppLeaseSettings; + private OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings; + private OrgLdapSettings orgLdapSettings; + private OrgEmailSettings orgEmailSettings; + private OrgPasswordPolicySettings orgPasswordPolicySettings; + + /** + * @see OrgSettings#getOrgGeneralSettings() + */ + public Builder orgGeneralSettings(OrgGeneralSettings orgGeneralSettings) { + this.orgGeneralSettings = orgGeneralSettings; + return this; + } + + /** + * @see OrgSettings#getVAppLeaseSettings() + */ + public Builder vAppLeaseSettings(OrgLeaseSettings vAppLeaseSettings) { + this.vAppLeaseSettings = vAppLeaseSettings; + return this; + } + + /** + * @see OrgSettings#getVAppTemplateLeaseSettings() + */ + public Builder vAppTemplateLeaseSettings(OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings) { + this.vAppTemplateLeaseSettings = vAppTemplateLeaseSettings; + return this; + } + + /** + * @see OrgSettings#getOrgLdapSettings() + */ + public Builder orgLdapSettings(OrgLdapSettings orgLdapSettings) { + this.orgLdapSettings = orgLdapSettings; + return this; + } + + /** + * @see OrgSettings#getOrgEmailSettings() + */ + public Builder orgEmailSettings(OrgEmailSettings orgEmailSettings) { + this.orgEmailSettings = orgEmailSettings; + return this; + } + + /** + * @see OrgSettings#getOrgPasswordPolicySettings() + */ + public Builder orgPasswordPolicySettings(OrgPasswordPolicySettings orgPasswordPolicySettings) { + this.orgPasswordPolicySettings = orgPasswordPolicySettings; + return this; + } + + public OrgSettings build() { + return new OrgSettings(href, type, links, orgGeneralSettings, vAppLeaseSettings, + vAppTemplateLeaseSettings, orgLdapSettings, orgEmailSettings, orgPasswordPolicySettings); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgSettings(OrgSettings in) { + return fromResourceType(in) + .orgGeneralSettings(in.getOrgGeneralSettings()) + .vAppLeaseSettings(in.getVAppLeaseSettings()) + .vAppTemplateLeaseSettings(in.getVAppTemplateLeaseSettings()) + .orgLdapSettings(in.getOrgLdapSettings()) + .orgEmailSettings(in.getOrgEmailSettings()) + .orgPasswordPolicySettings(in.getOrgPasswordPolicySettings()); + } + } + + @SuppressWarnings("unused") + private OrgSettings() { + // For JAXB + } + + public OrgSettings(URI href, String type, Set links, + OrgGeneralSettings orgGeneralSettings, + OrgLeaseSettings vAppLeaseSettings, + OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings, + OrgLdapSettings orgLdapSettings, OrgEmailSettings orgEmailSettings, + OrgPasswordPolicySettings orgPasswordPolicySettings) { + super(href, type, links); + this.orgGeneralSettings = orgGeneralSettings; + this.vAppLeaseSettings = vAppLeaseSettings; + this.vAppTemplateLeaseSettings = vAppTemplateLeaseSettings; + this.orgLdapSettings = orgLdapSettings; + this.orgPasswordPolicySettings = orgPasswordPolicySettings; + } + + @XmlElement(name = "OrgGeneralSettings") + protected OrgGeneralSettings orgGeneralSettings; + @XmlElement(name = "VAppLeaseSettings") + protected OrgLeaseSettings vAppLeaseSettings; + @XmlElement(name = "VAppTemplateLeaseSettings") + protected OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings; + @XmlElement(name = "OrgLdapSettings") + protected OrgLdapSettings orgLdapSettings; + @XmlElement(name = "OrgEmailSettings") + protected OrgEmailSettings orgEmailSettings; + @XmlElement(name = "OrgPasswordPolicySettings") + protected OrgPasswordPolicySettings orgPasswordPolicySettings; + + /** + * Gets the value of the orgGeneralSettings property. + * + * @return + * possible object is + * {@link OrgGeneralSettings } + * + */ + public OrgGeneralSettings getOrgGeneralSettings() { + return orgGeneralSettings; + } + + /** + * Gets the value of the vAppLeaseSettings property. + * + * @return + * possible object is + * {@link OrgLeaseSettings } + * + */ + public OrgLeaseSettings getVAppLeaseSettings() { + return vAppLeaseSettings; + } + + /** + * Gets the value of the vAppTemplateLeaseSettings property. + * + * @return + * possible object is + * {@link OrgVAppTemplateLeaseSettings } + * + */ + public OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings() { + return vAppTemplateLeaseSettings; + } + + /** + * Gets the value of the orgLdapSettings property. + * + * @return + * possible object is + * {@link OrgLdapSettings } + * + */ + public OrgLdapSettings getOrgLdapSettings() { + return orgLdapSettings; + } + + /** + * Gets the value of the orgEmailSettings property. + * + * @return + * possible object is + * {@link OrgEmailSettings } + * + */ + public OrgEmailSettings getOrgEmailSettings() { + return orgEmailSettings; + } + + /** + * Gets the value of the orgPasswordPolicySettings property. + * + * @return + * possible object is + * {@link OrgPasswordPolicySettings } + * + */ + public OrgPasswordPolicySettings getOrgPasswordPolicySettings() { + return orgPasswordPolicySettings; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgSettings that = OrgSettings.class.cast(o); + return super.equals(that) && + equal(orgGeneralSettings, that.orgGeneralSettings) && + equal(vAppLeaseSettings, that.vAppLeaseSettings) && + equal(vAppTemplateLeaseSettings, that.vAppTemplateLeaseSettings) && + equal(orgLdapSettings, that.orgLdapSettings) && + equal(orgEmailSettings, that.orgEmailSettings) && + equal(orgPasswordPolicySettings, that.orgPasswordPolicySettings); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + orgGeneralSettings, + vAppLeaseSettings, + vAppTemplateLeaseSettings, + orgLdapSettings, + orgEmailSettings, + orgPasswordPolicySettings); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("orgGeneralSettings", orgGeneralSettings) + .add("vAppLeaseSettings", vAppLeaseSettings) + .add("vAppTemplateLeaseSettings", vAppTemplateLeaseSettings) + .add("orgLdapSettings", orgLdapSettings) + .add("orgEmailSettings", orgEmailSettings) + .add("orgPasswordPolicySettings", orgPasswordPolicySettings); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgVAppTemplateLeaseSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgVAppTemplateLeaseSettings.java new file mode 100644 index 0000000000..11831a2b9f --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgVAppTemplateLeaseSettings.java @@ -0,0 +1,219 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Defines default lease policies for vAppTemplate on organization level. + * + * + *

Java class for OrgVAppTemplateLeaseSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="OrgVAppTemplateLeaseSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="DeleteOnStorageLeaseExpiration" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *         <element name="StorageLeaseSeconds" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "OrgVAppTemplateLeaseSettings") +@XmlType(propOrder = { + "deleteOnStorageLeaseExpiration", + "storageLeaseSeconds" +}) +public class OrgVAppTemplateLeaseSettings extends ResourceType { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOrgVAppTemplateLeaseSettings(this); + } + + public static class Builder extends ResourceType.Builder { + + private Boolean deleteOnStorageLeaseExpiration; + private Integer storageLeaseSeconds; + + /** + * @see OrgVAppTemplateLeaseSettings#getDeleteOnStorageLeaseExpiration() + */ + public Builder deleteOnStorageLeaseExpiration(Boolean deleteOnStorageLeaseExpiration) { + this.deleteOnStorageLeaseExpiration = deleteOnStorageLeaseExpiration; + return this; + } + + /** + * @see OrgVAppTemplateLeaseSettings#getStorageLeaseSeconds() + */ + public Builder storageLeaseSeconds(Integer storageLeaseSeconds) { + this.storageLeaseSeconds = storageLeaseSeconds; + return this; + } + + + public OrgVAppTemplateLeaseSettings build() { + return new OrgVAppTemplateLeaseSettings(href, type, links, deleteOnStorageLeaseExpiration, storageLeaseSeconds); + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOrgVAppTemplateLeaseSettings(OrgVAppTemplateLeaseSettings in) { + return fromResourceType(in) + .deleteOnStorageLeaseExpiration(in.deleteOnStorageLeaseExpiration()) + .storageLeaseSeconds(in.getStorageLeaseSeconds()); + } + } + + @SuppressWarnings("unused") + private OrgVAppTemplateLeaseSettings() { + // For JAXB and builder use + } + + public OrgVAppTemplateLeaseSettings(URI href, String type, Set links, + Boolean deleteOnStorageLeaseExpiration, Integer storageLeaseSeconds) { + super(href, type, links); + this.deleteOnStorageLeaseExpiration = deleteOnStorageLeaseExpiration; + this.storageLeaseSeconds = storageLeaseSeconds; + } + + @XmlElement(name = "DeleteOnStorageLeaseExpiration") + protected Boolean deleteOnStorageLeaseExpiration; + @XmlElement(name = "StorageLeaseSeconds") + protected Integer storageLeaseSeconds; + + /** + * Gets the value of the deleteOnStorageLeaseExpiration property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean deleteOnStorageLeaseExpiration() { + return deleteOnStorageLeaseExpiration; + } + + /** + * Gets the value of the storageLeaseSeconds property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getStorageLeaseSeconds() { + return storageLeaseSeconds; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + OrgVAppTemplateLeaseSettings that = OrgVAppTemplateLeaseSettings.class.cast(o); + return super.equals(that) && + equal(deleteOnStorageLeaseExpiration, that.deleteOnStorageLeaseExpiration) && + equal(storageLeaseSeconds, that.storageLeaseSeconds); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + deleteOnStorageLeaseExpiration, + storageLeaseSeconds); + } + + @Override + public ToStringHelper string() { + return super.string() + .add("deleteOnStorageLeaseExpiration", deleteOnStorageLeaseExpiration) + .add("storageLeaseSeconds", storageLeaseSeconds); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java index 3574c29f12..69100b0e2a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java @@ -24,9 +24,12 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.net.URI; import java.util.Collections; import java.util.Set; + import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import org.jclouds.vcloud.director.v1_5.domain.EntityType.NewBuilder; + import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableSet; @@ -44,7 +47,57 @@ import com.google.common.collect.Sets; * @author Adrian Cole */ public abstract class ResourceType> implements URISupplier { + + public NewBuilder toNewBuilder() { + throw new UnsupportedOperationException("New builder not yet implemented for this class"); + } + + public static abstract class NewBuilder> { + protected abstract T self(); + + protected URI href; + protected String type; + protected Set links = Sets.newLinkedHashSet(); + /** + * @see ResourceType#getHref() + */ + public T href(URI href) { + this.href = href; + return self(); + } + + /** + * @see ResourceType#getType() + */ + public T type(String type) { + this.type = type; + return self(); + } + + /** + * @see ResourceType#getLinks() + */ + public T links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return self(); + } + + /** + * @see ResourceType#getLinks() + */ + public T link(Link link) { + this.links.add(checkNotNull(link, "link")); + return self(); + } + + public abstract ResourceType build(); + + protected T fromResourceType(ResourceType in) { + return href(in.getHref()).type(in.getType()).links(in.getLinks()); + } + } + public abstract Builder toBuilder(); public static abstract class Builder> { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SmtpServerSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SmtpServerSettings.java new file mode 100644 index 0000000000..9c79022acf --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SmtpServerSettings.java @@ -0,0 +1,232 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + + +/** + * + * Specifies connection details for the organization s SMTP server. + * If IsDefaultSmtpServer (in OrgEmailSettings) is false, the SmtpServerSettings + * element is taken into account. + * + * + *

Java class for SmtpServerSettings complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SmtpServerSettings">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="IsUseAuthentication" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ *         <element name="Host" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Username" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SmtpServerSettings", propOrder = { + "isUseAuthentication", + "host", + "username", + "password" +}) +public class SmtpServerSettings { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromSmtpServerSettings(this); + } + + public static class Builder { + + private boolean useAuthentication; + private String host; + private String username; + private String password; + + /** + * @see SmtpServerSettings#getIsUseAuthentication() + */ + public Builder useAuthentication(boolean useAuthentication) { + this.useAuthentication = useAuthentication; + return this; + } + + /** + * @see SmtpServerSettings#getHost() + */ + public Builder host(String host) { + this.host = host; + return this; + } + + /** + * @see SmtpServerSettings#getUsername() + */ + public Builder username(String username) { + this.username = username; + return this; + } + + /** + * @see SmtpServerSettings#getPassword() + */ + public Builder password(String password) { + this.password = password; + return this; + } + + + public SmtpServerSettings build() { + return new SmtpServerSettings(useAuthentication, host, username, password); + } + + + public Builder fromSmtpServerSettings(SmtpServerSettings in) { + return useAuthentication(in.useAuthentication()) + .host(in.getHost()) + .username(in.getUsername()) + .password(in.getPassword()); + } + } + + @SuppressWarnings("unused") + private SmtpServerSettings() { + // For JAXB + } + + public SmtpServerSettings(boolean useAuthentication, String host, + String username, String password) { + this.useAuthentication = useAuthentication; + this.host = host; + this.username = username; + } + + @XmlElement(name = "IsUseAuthentication") + protected boolean useAuthentication; + @XmlElement(name = "Host", required = true) + protected String host; + @XmlElement(name = "Username", required = true) + protected String username; + @XmlElement(name = "Password") + protected String password; + + /** + * Gets the value of the isUseAuthentication property. + * + */ + public boolean useAuthentication() { + return useAuthentication; + } + + /** + * Gets the value of the host property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHost() { + return host; + } + + /** + * Gets the value of the username property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsername() { + return username; + } + + /** + * Gets the value of the password property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPassword() { + return password; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + SmtpServerSettings that = SmtpServerSettings.class.cast(o); + return super.equals(that) && + equal(useAuthentication, that.useAuthentication) && + equal(host, that.host) && + equal(username, that.username) && + equal(password, that.password); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), + useAuthentication, + host, + username, + password); + } + + @Override + public String toString() { + return string().toString(); + } + + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("isUseAuthentication", useAuthentication) + .add("host", host) + .add("username", username) + .add("password", password); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdcs.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdcs.java new file mode 100644 index 0000000000..84aed81a7e --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdcs.java @@ -0,0 +1,171 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.ImmutableList; + + +/** + * + * Represents a list of references to virtual data centers. + * + * + *

Java class for Vdcs complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Vdcs">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Vdc" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "Vdcs") +@XmlType(propOrder = { + "vdcs" +}) +public class Vdcs { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromVdcs(this); + } + + public static class Builder { + + private List vdcs; + + /** + * @see Vdcs#getVdc() + */ + public Builder vdcs(List vdcs) { + this.vdcs = ImmutableList.copyOf(vdcs); + return this; + } + + /** + * @see Vdcs#getVdc() + */ + public Builder vdc(Reference vdc) { + this.vdcs.add(checkNotNull(vdc, "vdc")); + return this; + } + + public Vdcs build() { + return new Vdcs(vdcs); + } + + public Builder fromVdcs(Vdcs in) { + return vdcs(in.getVdcs()); + } + } + + private Vdcs() { + // For JAXB and builder use + } + + private Vdcs(List vdcs) { + this.vdcs = vdcs; + } + + + @XmlElement(name = "Vdc") + protected List vdcs; + + /** + * Gets the value of the vdc property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the vdc property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getVdc().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ReferenceType } + * + * + */ + public List getVdcs() { + if (vdcs == null) { + vdcs = new ArrayList(); + } + return this.vdcs; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Vdcs that = Vdcs.class.cast(o); + return equal(vdcs, that.vdcs); + } + + @Override + public int hashCode() { + return Objects.hashCode(vdcs); + } + + @Override + public String toString() { + return string().toString(); + } + + public ToStringHelper string() { + return Objects.toStringHelper("") + .add("vdcs", vdcs); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java new file mode 100644 index 0000000000..c88edee6e4 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java @@ -0,0 +1,63 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.features; + +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; + +/** + * @see GroupClient + * @author danikov + */ +@RequestFilters(AddVCloudAuthorizationToRequest.class) +public interface AdminOrgAsyncClient { + +// GET /admin/org/{id} + +// POST /admin/org/{id}/catalogs + +// POST /admin/org/{id}/groups + +// GET /admin/org/{id}/settings + +// PUT /admin/org/{id}/settings + +// GET /admin/org/{id}/settings/email + +// PUT /admin/org/{id}/settings/email + +// GET /admin/org/{id}/settings/general + +// PUT /admin/org/{id}/settings/general + +// GET /admin/org/{id}/settings/ldap + +// GET /admin/org/{id}/settings/passwordPolicy + +// PUT /admin/org/{id}/settings/passwordPolicy + +// GET /admin/org/{id}/settings/vAppLeaseSettings + +// PUT /admin/org/{id}/settings/vAppLeaseSettings + +// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings + +// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java new file mode 100644 index 0000000000..b584713fbf --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java @@ -0,0 +1,66 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.features; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.concurrent.Timeout; + +/** + * Provides synchronous access to {@link Group} objects. + * + * @see GroupAsyncClient + * @author danikov + */ +@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) +public interface AdminOrgClient { + +// GET /admin/org/{id} + +// POST /admin/org/{id}/catalogs + +// POST /admin/org/{id}/groups + +// GET /admin/org/{id}/settings + +// PUT /admin/org/{id}/settings + +// GET /admin/org/{id}/settings/email + +// PUT /admin/org/{id}/settings/email + +// GET /admin/org/{id}/settings/general + +// PUT /admin/org/{id}/settings/general + +// GET /admin/org/{id}/settings/ldap + +// GET /admin/org/{id}/settings/passwordPolicy + +// PUT /admin/org/{id}/settings/passwordPolicy + +// GET /admin/org/{id}/settings/vAppLeaseSettings + +// PUT /admin/org/{id}/settings/vAppLeaseSettings + +// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings + +// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings + +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java new file mode 100644 index 0000000000..e6f295ea15 --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.features; + +import java.net.URI; + +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.testng.annotations.Test; + +/** + * Test the {@link GroupClient} by observing its side effects. + * + * @author danikov + */ +@Test(groups = { "unit", "user", "org"}, singleThreaded = true, testName = "AdminOrgClientExpectTest") +public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { + + private Reference orgRef = Reference.builder() + .type("application/vnd.vmware.admin.???+xml") + .name("???") + .href(URI.create(endpoint + "/admin/org/???")) + .build(); + +// GET /admin/org/{id} + +// POST /admin/org/{id}/catalogs + +// POST /admin/org/{id}/groups + +// GET /admin/org/{id}/settings + +// PUT /admin/org/{id}/settings + +// GET /admin/org/{id}/settings/email + +// PUT /admin/org/{id}/settings/email + +// GET /admin/org/{id}/settings/general + +// PUT /admin/org/{id}/settings/general + +// GET /admin/org/{id}/settings/ldap + +// GET /admin/org/{id}/settings/passwordPolicy + +// PUT /admin/org/{id}/settings/passwordPolicy + +// GET /admin/org/{id}/settings/vAppLeaseSettings + +// PUT /admin/org/{id}/settings/vAppLeaseSettings + +// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings + +// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java new file mode 100644 index 0000000000..dbd5c6a28c --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java @@ -0,0 +1,108 @@ +/* + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.director.v1_5.features; + +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; +import static org.testng.Assert.assertNotNull; + +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_DEL; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.fail; +import static com.google.common.base.Objects.equal; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE; +import static org.testng.Assert.assertTrue; + + +import java.net.URI; + +import org.jclouds.vcloud.director.v1_5.domain.Checks; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; +import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; +import org.jclouds.vcloud.director.v1_5.domain.Error; +import org.jclouds.vcloud.director.v1_5.domain.Group; +import org.jclouds.vcloud.director.v1_5.domain.Owner; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * Tests live behavior of {@link AdminGroupClient}. + * + * @author danikov + */ +@Test(groups = { "live", "admin", "org" }, singleThreaded = true, testName = "AdminOrgClientLiveTest") +public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { + + public static final String GROUP = "admin org"; + + /* + * Convenience references to API clients. + */ + + private AdminOrgClient orgClient; + + /* + * Shared state between dependant tests. + */ + private ReferenceType orgRef; + private AdminOrg org; + + @BeforeClass(inheritGroups = true) + public void setupRequiredClients() { + orgClient = context.getApi().getAdminOrgClient(); + orgRef = Reference.builder() + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/???")) + .build(); + } + +// GET /admin/org/{id} + +// POST /admin/org/{id}/catalogs + +// POST /admin/org/{id}/groups + +// GET /admin/org/{id}/settings + +// PUT /admin/org/{id}/settings + +// GET /admin/org/{id}/settings/email + +// PUT /admin/org/{id}/settings/email + +// GET /admin/org/{id}/settings/general + +// PUT /admin/org/{id}/settings/general + +// GET /admin/org/{id}/settings/ldap + +// GET /admin/org/{id}/settings/passwordPolicy + +// PUT /admin/org/{id}/settings/passwordPolicy + +// GET /admin/org/{id}/settings/vAppLeaseSettings + +// PUT /admin/org/{id}/settings/vAppLeaseSettings + +// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings + +// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings +}