fixed some merge glitches

This commit is contained in:
Adrian Cole 2012-03-11 21:06:06 -07:00
commit adc275673d
35 changed files with 1902 additions and 222 deletions

View File

@ -129,14 +129,31 @@ public class VCloudDirectorMediaType {
public static final String ADMIN_CATALOG = "application/vnd.vmware.admin.catalog+xml"; public static final String ADMIN_CATALOG = "application/vnd.vmware.admin.catalog+xml";
public static final String ADMIN_ORGANIZATION = "application/vnd.vmware.admin.organization+xml"; public static final String ADMIN_ORG = "application/vnd.vmware.admin.organization+xml";
public static final String PUBLISH_CATALOG_PARAMS = "application/vnd.vmware.admin.publishCatalogParams+xml"; public static final String PUBLISH_CATALOG_PARAMS = "application/vnd.vmware.admin.publishCatalogParams+xml";
public static final String GROUP = "application/vnd.vmware.admin.group+xml"; public static final String GROUP = "application/vnd.vmware.admin.group+xml";
public static final String ORG_VAPP_TEMPLATE_LEASE_SETTINGS = "application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml";
public static final String ORG_LEASE_SETTINGS = "application/vnd.vmware.admin.vAppLeaseSettings+xml";
public static final String ORG_PASSWORD_POLICY_SETTINGS = "application/vnd.vmware.admin.organizationPasswordPolicySettings+xml";
public static final String ORG_LDAP_SETTINGS = "application/vnd.vmware.admin.organizationLdapSettings+xml";
public static final String ORG_GENERAL_SETTINGS = "application/vnd.vmware.admin.organizationGeneralSettings+xml";
public static final String ORG_EMAIL_SETTINGS = "application/vnd.vmware.admin.organizationEmailSettings+xml";
public static final String ORG_SETTINGS = "application/vnd.vmware.admin.orgSettings+xml";
public static final String ADMIN_NETWORK = "application/vnd.vmware.admin.network+xml";
public static final String ADMIN_ORG_NETWORK = "application/vnd.vmware.admin.orgNetwork+xml";
/** /**
*
* All acceptable media types. * All acceptable media types.
* *
* This list must be updated whenever a new media type constant is added. * This list must be updated whenever a new media type constant is added.
@ -148,11 +165,14 @@ public class VCloudDirectorMediaType {
MEDIA, OWNER, VDC, ADMIN_USER, V_APP, V_APP_TEMPLATE, MEDIA, OWNER, VDC, ADMIN_USER, V_APP, V_APP_TEMPLATE,
CAPTURE_VAPP_PARAMS, CLONE_V_APP_PARAMS, CLONE_V_APP_TEMPLATE_PARAMS, CAPTURE_VAPP_PARAMS, CLONE_V_APP_PARAMS, CLONE_V_APP_TEMPLATE_PARAMS,
COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS, COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS,
UPLOAD_VAPP_TEMPLATE_PARAMS, ADMIN_CATALOG, ADMIN_ORGANIZATION, UPLOAD_VAPP_TEMPLATE_PARAMS, ADMIN_CATALOG, ADMIN_ORG,
QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS, QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,
CONTROL_ACCESS, VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION, CONTROL_ACCESS, VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION,
NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION, NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION,
CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE, CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE,
PUBLISH_CATALOG_PARAMS, GROUP PUBLISH_CATALOG_PARAMS, GROUP, ORG_VAPP_TEMPLATE_LEASE_SETTINGS,
ORG_LEASE_SETTINGS, ORG_PASSWORD_POLICY_SETTINGS, ORG_LDAP_SETTINGS,
ORG_GENERAL_SETTINGS, ORG_EMAIL_SETTINGS, ORG_SETTINGS, ADMIN_NETWORK,
ADMIN_ORG_NETWORK
); );
} }

View File

@ -21,6 +21,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; 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.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -145,7 +148,8 @@ public class AdminOrg extends Org {
} }
public AdminOrg build() { public AdminOrg build() {
return new AdminOrg(settings, users, groups, catalogs, vdcs, networks); return new AdminOrg(href, type, links, description, tasks, id,
name, fullName, isEnabled, settings, users, groups, catalogs, vdcs, networks);
} }
public T fromAdminOrg(AdminOrg in) { public T fromAdminOrg(AdminOrg in) {
@ -175,8 +179,11 @@ public class AdminOrg extends Org {
// For JAXB // For JAXB
} }
protected AdminOrg(OrgSettings settings, UsersList users, GroupsList groups, protected AdminOrg(URI href, String type, Set<Link> links, String description,
Set<Task> tasks, String id, String name, String fullName,
Boolean enabled, OrgSettings settings, UsersList users, GroupsList groups,
CatalogsList catalogs, Vdcs vdcs, Networks networks) { CatalogsList catalogs, Vdcs vdcs, Networks networks) {
super(href, type, links, description, tasks, id, name, fullName, enabled);
this.settings = settings; this.settings = settings;
this.users = users; this.users = users;
this.groups = groups; this.groups = groups;

View File

@ -67,6 +67,14 @@ public class CatalogsList {
this.catalogReferences = checkNotNull(catalogReferences, "catalogReferences"); this.catalogReferences = checkNotNull(catalogReferences, "catalogReferences");
return this; return this;
} }
/**
* @see CatalogsList#getCatalogItems()
*/
public Builder catalog(Reference catalog) {
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
return this;
}
public CatalogsList build() { public CatalogsList build() {
return new CatalogsList(catalogReferences); return new CatalogsList(catalogReferences);
@ -81,7 +89,7 @@ public class CatalogsList {
// for JAXB // for JAXB
} }
private CatalogsList(Set<Reference> tasks) { private CatalogsList(Set<Reference> catalogReferences) {
this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences")); this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences"));
} }

View File

@ -21,6 +21,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -86,6 +89,36 @@ import com.google.common.base.Objects.ToStringHelper;
"groupAttributes" "groupAttributes"
}) })
public class CustomOrgLdapSettings { public class CustomOrgLdapSettings {
public static final class AuthenticationMechanism {
public static final String SIMPLE = "simple";
public static final String KERBEROS = "kerberos";
public static final String MD5DIGEST = "md5digest";
public static final String NTLM = "ntlm";
/**
* All acceptable {@link CustomOrgLdapSettings#getAuthenticationMechanism()} values.
* <p/>
* This list must be updated whenever a new authentication mechanism is added.
*/
public static final List<String> ALL = Arrays.asList(
SIMPLE, KERBEROS, MD5DIGEST, NTLM
);
}
public static final class ConnectorType {
public static final String ACTIVE_DIRECTORY = "ACTIVE_DIRECTORY";
public static final String OPEN_LDAP = "OPEN_LDAP";
/**
* All acceptable {@link OrgLdapSettings#getLdapMode()} values.
* <p/>
* This list must be updated whenever a new mode is added.
*/
public static final List<String> ALL = Arrays.asList(
ACTIVE_DIRECTORY, OPEN_LDAP
);
}
public static Builder<?> builder() { public static Builder<?> builder() {
return new ConcreteBuilder(); return new ConcreteBuilder();
} }

View File

@ -62,7 +62,7 @@ import com.google.common.collect.ImmutableList;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "GroupsList") @XmlRootElement(name = "GroupsList")
@XmlType(propOrder = { @XmlType(propOrder = {
"groupReference" "groups"
}) })
public class GroupsList { public class GroupsList {
public static Builder builder() { public static Builder builder() {

View File

@ -33,6 +33,7 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/** /**
@ -62,7 +63,7 @@ import com.google.common.collect.ImmutableList;
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Networks", propOrder = { @XmlType(name = "Networks", propOrder = {
"network" "networks"
}) })
public class Networks { public class Networks {
public static Builder builder() { public static Builder builder() {
@ -75,7 +76,7 @@ public class Networks {
public static class Builder { public static class Builder {
private List<Reference> networks; private List<Reference> networks = Lists.newArrayList();
/** /**
* @see Networks#getNetwork() * @see Networks#getNetwork()

View File

@ -59,8 +59,8 @@ public class Org extends EntityType<Org> {
public static abstract class NewBuilder<T extends NewBuilder<T>> extends EntityType.NewBuilder<T> { public static abstract class NewBuilder<T extends NewBuilder<T>> extends EntityType.NewBuilder<T> {
private String fullName; protected String fullName;
private Boolean isEnabled; protected Boolean isEnabled;
/** /**
* @see Org#getFullName() * @see Org#getFullName()
@ -232,8 +232,10 @@ public class Org extends EntityType<Org> {
// for JAXB // for JAXB
} }
public Org(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name, String fullName, Boolean enabled) { public Org(URI href, String type, Set<Link> links, String description,
super(href, type, links, description, tasks, id, name); Set<Task> tasksInProgress, String id, String name,
String fullName, Boolean enabled) {
super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName; this.fullName = fullName;
isEnabled = enabled; isEnabled = enabled;
} }

View File

@ -76,7 +76,7 @@ import com.google.common.collect.ImmutableList;
"fromEmailAddress", "fromEmailAddress",
"defaultSubjectPrefix", "defaultSubjectPrefix",
"isAlertEmailToAllAdmins", "isAlertEmailToAllAdmins",
"alertEmailTo", "alertEmailsTo",
"smtpServerSettings" "smtpServerSettings"
}) })
public class OrgEmailSettings extends ResourceType<OrgEmailSettings> { public class OrgEmailSettings extends ResourceType<OrgEmailSettings> {
@ -142,7 +142,7 @@ public class OrgEmailSettings extends ResourceType<OrgEmailSettings> {
* @see OrgEmailSettings#getAlertEmailTo() * @see OrgEmailSettings#getAlertEmailTo()
*/ */
public Builder alertEmailsTo(List<String> alertEmailsTo) { public Builder alertEmailsTo(List<String> alertEmailsTo) {
this.alertEmailTo = ImmutableList.copyOf(alertEmailsTo); this.alertEmailTo = alertEmailsTo == null ? null : ImmutableList.copyOf(alertEmailsTo);
return this; return this;
} }
@ -163,7 +163,8 @@ public class OrgEmailSettings extends ResourceType<OrgEmailSettings> {
} }
public OrgEmailSettings build() { public OrgEmailSettings build() {
return new OrgEmailSettings(isDefaultSmtpServer, isDefaultOrgEmail, fromEmailAddress, defaultSubjectPrefix, return new OrgEmailSettings(href, type, links, isDefaultSmtpServer,
isDefaultOrgEmail, fromEmailAddress, defaultSubjectPrefix,
isAlertEmailToAllAdmins, alertEmailTo, smtpServerSettings); isAlertEmailToAllAdmins, alertEmailTo, smtpServerSettings);
} }
@ -225,9 +226,11 @@ public class OrgEmailSettings extends ResourceType<OrgEmailSettings> {
// For JAXB // For JAXB
} }
private OrgEmailSettings(boolean isDefaultSmtpServer, boolean isDefaultOrgEmail, private OrgEmailSettings(URI href, String type, Set<Link> links,
boolean isDefaultSmtpServer, boolean isDefaultOrgEmail,
String fromEmailAddress, String defaultSubjectPrefix, boolean isAlertEmailToAllAdmins, String fromEmailAddress, String defaultSubjectPrefix, boolean isAlertEmailToAllAdmins,
List<String> alertEmailTo, SmtpServerSettings smtpServerSettings) { List<String> alertEmailTo, SmtpServerSettings smtpServerSettings) {
super(href, type, links);
this.isDefaultSmtpServer = isDefaultSmtpServer; this.isDefaultSmtpServer = isDefaultSmtpServer;
this.isDefaultOrgEmail = isDefaultOrgEmail; this.isDefaultOrgEmail = isDefaultOrgEmail;
this.fromEmailAddress = fromEmailAddress; this.fromEmailAddress = fromEmailAddress;
@ -323,9 +326,6 @@ public class OrgEmailSettings extends ResourceType<OrgEmailSettings> {
* *
*/ */
public List<String> getAlertEmailsTo() { public List<String> getAlertEmailsTo() {
if (alertEmailsTo == null) {
alertEmailsTo = new ArrayList<String>();
}
return this.alertEmailsTo; return this.alertEmailsTo;
} }

View File

@ -63,7 +63,7 @@ import com.google.common.base.Objects.ToStringHelper;
* *
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "OrgGeneralSettings") @XmlRootElement(name = "GeneralOrgSettings")
@XmlType(propOrder = { @XmlType(propOrder = {
"canPublishCatalogs", "canPublishCatalogs",
"deployedVMQuota", "deployedVMQuota",

View File

@ -22,11 +22,14 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import java.net.URI; import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -60,12 +63,28 @@ import com.google.common.base.Objects.ToStringHelper;
* *
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OrgLdapSettings", propOrder = { @XmlRootElement(name = "OrgLdapSettings")
"orgLdapMode", @XmlType(propOrder = {
"ldapMode",
"customUsersOu", "customUsersOu",
"customOrgLdapSettings" "customOrgLdapSettings"
}) })
public class OrgLdapSettings extends ResourceType<OrgLdapSettings> { public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
public static final class LdapMode {
public static final String NONE = "NONE";
public static final String SYSTEM = "SYSTEM";
public static final String CUSTOM = "CUSTOM";
/**
* All acceptable {@link OrgLdapSettings#getLdapMode()} values.
* <p/>
* This list must be updated whenever a new mode is added.
*/
public static final List<String> ALL = Arrays.asList(
NONE, SYSTEM, CUSTOM
);
}
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -76,15 +95,15 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
public static class Builder extends ResourceType.Builder<OrgLdapSettings> { public static class Builder extends ResourceType.Builder<OrgLdapSettings> {
private String orgLdapMode; private String ldapMode;
private String customUsersOu; private String customUsersOu;
private CustomOrgLdapSettings customOrgLdapSettings; private CustomOrgLdapSettings customOrgLdapSettings;
/** /**
* @see OrgLdapSettings#getOrgLdapMode() * @see OrgLdapSettings#getLdapMode()
*/ */
public Builder orgLdapMode(String orgLdapMode) { public Builder ldapMode(String ldapMode) {
this.orgLdapMode = orgLdapMode; this.ldapMode = ldapMode;
return this; return this;
} }
@ -106,7 +125,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
public OrgLdapSettings build() { public OrgLdapSettings build() {
OrgLdapSettings orgLdapSettings = new OrgLdapSettings(href, type, links, OrgLdapSettings orgLdapSettings = new OrgLdapSettings(href, type, links,
orgLdapMode, customUsersOu, customOrgLdapSettings); ldapMode, customUsersOu, customOrgLdapSettings);
return orgLdapSettings; return orgLdapSettings;
} }
@ -154,7 +173,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
} }
public Builder fromOrgLdapSettings(OrgLdapSettings in) { public Builder fromOrgLdapSettings(OrgLdapSettings in) {
return fromResourceType(in) return fromResourceType(in)
.orgLdapMode(in.getOrgLdapMode()) .ldapMode(in.getLdapMode())
.customUsersOu(in.getCustomUsersOu()) .customUsersOu(in.getCustomUsersOu())
.customOrgLdapSettings(in.getCustomOrgLdapSettings()); .customOrgLdapSettings(in.getCustomOrgLdapSettings());
} }
@ -166,9 +185,9 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
} }
public OrgLdapSettings(URI href, String type, Set<Link> links, public OrgLdapSettings(URI href, String type, Set<Link> links,
String orgLdapMode, String customUsersOu, CustomOrgLdapSettings customOrgLdapSettings) { String ldapMode, String customUsersOu, CustomOrgLdapSettings customOrgLdapSettings) {
super(href, type, links); super(href, type, links);
this.orgLdapMode = orgLdapMode; this.ldapMode = ldapMode;
this.customUsersOu = customUsersOu; this.customUsersOu = customUsersOu;
this.customOrgLdapSettings = customOrgLdapSettings; this.customOrgLdapSettings = customOrgLdapSettings;
} }
@ -176,7 +195,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
@XmlElement(name = "OrgLdapMode") @XmlElement(name = "OrgLdapMode")
protected String orgLdapMode; protected String ldapMode;
@XmlElement(name = "CustomUsersOu") @XmlElement(name = "CustomUsersOu")
protected String customUsersOu; protected String customUsersOu;
@XmlElement(name = "CustomOrgLdapSettings") @XmlElement(name = "CustomOrgLdapSettings")
@ -190,8 +209,8 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
* {@link String } * {@link String }
* *
*/ */
public String getOrgLdapMode() { public String getLdapMode() {
return orgLdapMode; return ldapMode;
} }
/** /**
@ -226,7 +245,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
return false; return false;
OrgLdapSettings that = OrgLdapSettings.class.cast(o); OrgLdapSettings that = OrgLdapSettings.class.cast(o);
return super.equals(that) && return super.equals(that) &&
equal(orgLdapMode, that.orgLdapMode) && equal(ldapMode, that.ldapMode) &&
equal(customUsersOu, that.customUsersOu) && equal(customUsersOu, that.customUsersOu) &&
equal(customOrgLdapSettings, that.customOrgLdapSettings); equal(customOrgLdapSettings, that.customOrgLdapSettings);
} }
@ -234,7 +253,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), return Objects.hashCode(super.hashCode(),
orgLdapMode, ldapMode,
customUsersOu, customUsersOu,
customOrgLdapSettings); customOrgLdapSettings);
} }
@ -242,7 +261,7 @@ public class OrgLdapSettings extends ResourceType<OrgLdapSettings> {
@Override @Override
public ToStringHelper string() { public ToStringHelper string() {
return super.string() return super.string()
.add("orgLdapMode", orgLdapMode) .add("orgLdapMode", ldapMode)
.add("customUsersOu", customUsersOu) .add("customUsersOu", customUsersOu)
.add("customOrgLdapSettings", customOrgLdapSettings); .add("customOrgLdapSettings", customOrgLdapSettings);
} }

View File

@ -27,6 +27,7 @@ import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -60,7 +61,8 @@ import com.google.common.base.Objects.ToStringHelper;
* *
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OrgLeaseSettings", propOrder = { @XmlRootElement(name = "VAppLeaseSettings")
@XmlType(propOrder = {
"deleteOnStorageLeaseExpiration", "deleteOnStorageLeaseExpiration",
"deploymentLeaseSeconds", "deploymentLeaseSeconds",
"storageLeaseSeconds" "storageLeaseSeconds"

View File

@ -193,7 +193,7 @@ public class OrgPasswordPolicySettings extends ResourceType<OrgPasswordPolicySet
* Gets the value of the invalidLoginsBeforeLockout property. * Gets the value of the invalidLoginsBeforeLockout property.
* *
*/ */
public int getInvalidLoginsBeforeLockout() { public Integer getInvalidLoginsBeforeLockout() {
return invalidLoginsBeforeLockout; return invalidLoginsBeforeLockout;
} }
@ -201,7 +201,7 @@ public class OrgPasswordPolicySettings extends ResourceType<OrgPasswordPolicySet
* Gets the value of the accountLockoutIntervalMinutes property. * Gets the value of the accountLockoutIntervalMinutes property.
* *
*/ */
public int getAccountLockoutIntervalMinutes() { public Integer getAccountLockoutIntervalMinutes() {
return accountLockoutIntervalMinutes; return accountLockoutIntervalMinutes;
} }

View File

@ -69,12 +69,12 @@ import com.google.common.base.Objects.ToStringHelper;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "OrgSettings") @XmlRootElement(name = "OrgSettings")
@XmlType(propOrder = { @XmlType(propOrder = {
"orgGeneralSettings", "generalSettings",
"vAppLeaseSettings", "vAppLeaseSettings",
"vAppTemplateLeaseSettings", "vAppTemplateLeaseSettings",
"orgLdapSettings", "ldapSettings",
"orgEmailSettings", "emailSettings",
"orgPasswordPolicySettings" "passwordPolicy"
}) })
public class OrgSettings extends ResourceType<OrgSettings> { public class OrgSettings extends ResourceType<OrgSettings> {
public static Builder builder() { public static Builder builder() {
@ -87,18 +87,18 @@ public class OrgSettings extends ResourceType<OrgSettings> {
public static class Builder extends ResourceType.Builder<OrgSettings> { public static class Builder extends ResourceType.Builder<OrgSettings> {
private OrgGeneralSettings orgGeneralSettings; private OrgGeneralSettings generalSettings;
private OrgLeaseSettings vAppLeaseSettings; private OrgLeaseSettings vAppLeaseSettings;
private OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings; private OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings;
private OrgLdapSettings orgLdapSettings; private OrgLdapSettings ldapSettings;
private OrgEmailSettings orgEmailSettings; private OrgEmailSettings emailSettings;
private OrgPasswordPolicySettings orgPasswordPolicySettings; private OrgPasswordPolicySettings passwordPolicy;
/** /**
* @see OrgSettings#getOrgGeneralSettings() * @see OrgSettings#getGeneralSettings()
*/ */
public Builder orgGeneralSettings(OrgGeneralSettings orgGeneralSettings) { public Builder generalSettings(OrgGeneralSettings generalSettings) {
this.orgGeneralSettings = orgGeneralSettings; this.generalSettings = generalSettings;
return this; return this;
} }
@ -119,32 +119,32 @@ public class OrgSettings extends ResourceType<OrgSettings> {
} }
/** /**
* @see OrgSettings#getOrgLdapSettings() * @see OrgSettings#getLdapSettings()
*/ */
public Builder orgLdapSettings(OrgLdapSettings orgLdapSettings) { public Builder ldapSettings(OrgLdapSettings ldapSettings) {
this.orgLdapSettings = orgLdapSettings; this.ldapSettings = ldapSettings;
return this; return this;
} }
/** /**
* @see OrgSettings#getOrgEmailSettings() * @see OrgSettings#getEmailSettings()
*/ */
public Builder orgEmailSettings(OrgEmailSettings orgEmailSettings) { public Builder emailSettings(OrgEmailSettings emailSettings) {
this.orgEmailSettings = orgEmailSettings; this.emailSettings = emailSettings;
return this; return this;
} }
/** /**
* @see OrgSettings#getOrgPasswordPolicySettings() * @see OrgSettings#getPasswordPolicy()
*/ */
public Builder orgPasswordPolicySettings(OrgPasswordPolicySettings orgPasswordPolicySettings) { public Builder passwordPolicy(OrgPasswordPolicySettings passwordPolicy) {
this.orgPasswordPolicySettings = orgPasswordPolicySettings; this.passwordPolicy = passwordPolicy;
return this; return this;
} }
public OrgSettings build() { public OrgSettings build() {
return new OrgSettings(href, type, links, orgGeneralSettings, vAppLeaseSettings, return new OrgSettings(href, type, links, generalSettings, vAppLeaseSettings,
vAppTemplateLeaseSettings, orgLdapSettings, orgEmailSettings, orgPasswordPolicySettings); vAppTemplateLeaseSettings, ldapSettings, emailSettings, passwordPolicy);
} }
@ -191,12 +191,12 @@ public class OrgSettings extends ResourceType<OrgSettings> {
} }
public Builder fromOrgSettings(OrgSettings in) { public Builder fromOrgSettings(OrgSettings in) {
return fromResourceType(in) return fromResourceType(in)
.orgGeneralSettings(in.getOrgGeneralSettings()) .generalSettings(in.getGeneralSettings())
.vAppLeaseSettings(in.getVAppLeaseSettings()) .vAppLeaseSettings(in.getVAppLeaseSettings())
.vAppTemplateLeaseSettings(in.getVAppTemplateLeaseSettings()) .vAppTemplateLeaseSettings(in.getVAppTemplateLeaseSettings())
.orgLdapSettings(in.getOrgLdapSettings()) .ldapSettings(in.getLdapSettings())
.orgEmailSettings(in.getOrgEmailSettings()) .emailSettings(in.getEmailSettings())
.orgPasswordPolicySettings(in.getOrgPasswordPolicySettings()); .passwordPolicy(in.getPasswordPolicy());
} }
} }
@ -205,32 +205,33 @@ public class OrgSettings extends ResourceType<OrgSettings> {
// For JAXB // For JAXB
} }
public OrgSettings(URI href, String type, Set<Link> links, public OrgSettings(URI href, String type, Set<Link> links,
OrgGeneralSettings orgGeneralSettings, OrgGeneralSettings generalSettings,
OrgLeaseSettings vAppLeaseSettings, OrgLeaseSettings vAppLeaseSettings,
OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings, OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings,
OrgLdapSettings orgLdapSettings, OrgEmailSettings orgEmailSettings, OrgLdapSettings ldapSettings, OrgEmailSettings emailSettings,
OrgPasswordPolicySettings orgPasswordPolicySettings) { OrgPasswordPolicySettings passwordPolicy) {
super(href, type, links); super(href, type, links);
this.orgGeneralSettings = orgGeneralSettings; this.generalSettings = generalSettings;
this.vAppLeaseSettings = vAppLeaseSettings; this.vAppLeaseSettings = vAppLeaseSettings;
this.vAppTemplateLeaseSettings = vAppTemplateLeaseSettings; this.vAppTemplateLeaseSettings = vAppTemplateLeaseSettings;
this.orgLdapSettings = orgLdapSettings; this.ldapSettings = ldapSettings;
this.orgPasswordPolicySettings = orgPasswordPolicySettings; this.emailSettings = emailSettings;
this.passwordPolicy = passwordPolicy;
} }
@XmlElement(name = "OrgGeneralSettings") @XmlElement(name = "OrgGeneralSettings")
protected OrgGeneralSettings orgGeneralSettings; protected OrgGeneralSettings generalSettings;
@XmlElement(name = "VAppLeaseSettings") @XmlElement(name = "VAppLeaseSettings")
protected OrgLeaseSettings vAppLeaseSettings; protected OrgLeaseSettings vAppLeaseSettings;
@XmlElement(name = "VAppTemplateLeaseSettings") @XmlElement(name = "VAppTemplateLeaseSettings")
protected OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings; protected OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings;
@XmlElement(name = "OrgLdapSettings") @XmlElement(name = "OrgLdapSettings")
protected OrgLdapSettings orgLdapSettings; protected OrgLdapSettings ldapSettings;
@XmlElement(name = "OrgEmailSettings") @XmlElement(name = "OrgEmailSettings")
protected OrgEmailSettings orgEmailSettings; protected OrgEmailSettings emailSettings;
@XmlElement(name = "OrgPasswordPolicySettings") @XmlElement(name = "OrgPasswordPolicySettings")
protected OrgPasswordPolicySettings orgPasswordPolicySettings; protected OrgPasswordPolicySettings passwordPolicy;
/** /**
* Gets the value of the orgGeneralSettings property. * Gets the value of the orgGeneralSettings property.
@ -240,8 +241,8 @@ public class OrgSettings extends ResourceType<OrgSettings> {
* {@link OrgGeneralSettings } * {@link OrgGeneralSettings }
* *
*/ */
public OrgGeneralSettings getOrgGeneralSettings() { public OrgGeneralSettings getGeneralSettings() {
return orgGeneralSettings; return generalSettings;
} }
/** /**
@ -276,8 +277,8 @@ public class OrgSettings extends ResourceType<OrgSettings> {
* {@link OrgLdapSettings } * {@link OrgLdapSettings }
* *
*/ */
public OrgLdapSettings getOrgLdapSettings() { public OrgLdapSettings getLdapSettings() {
return orgLdapSettings; return ldapSettings;
} }
/** /**
@ -288,8 +289,8 @@ public class OrgSettings extends ResourceType<OrgSettings> {
* {@link OrgEmailSettings } * {@link OrgEmailSettings }
* *
*/ */
public OrgEmailSettings getOrgEmailSettings() { public OrgEmailSettings getEmailSettings() {
return orgEmailSettings; return emailSettings;
} }
/** /**
@ -300,8 +301,8 @@ public class OrgSettings extends ResourceType<OrgSettings> {
* {@link OrgPasswordPolicySettings } * {@link OrgPasswordPolicySettings }
* *
*/ */
public OrgPasswordPolicySettings getOrgPasswordPolicySettings() { public OrgPasswordPolicySettings getPasswordPolicy() {
return orgPasswordPolicySettings; return passwordPolicy;
} }
@Override @Override
@ -312,34 +313,34 @@ public class OrgSettings extends ResourceType<OrgSettings> {
return false; return false;
OrgSettings that = OrgSettings.class.cast(o); OrgSettings that = OrgSettings.class.cast(o);
return super.equals(that) && return super.equals(that) &&
equal(orgGeneralSettings, that.orgGeneralSettings) && equal(generalSettings, that.generalSettings) &&
equal(vAppLeaseSettings, that.vAppLeaseSettings) && equal(vAppLeaseSettings, that.vAppLeaseSettings) &&
equal(vAppTemplateLeaseSettings, that.vAppTemplateLeaseSettings) && equal(vAppTemplateLeaseSettings, that.vAppTemplateLeaseSettings) &&
equal(orgLdapSettings, that.orgLdapSettings) && equal(ldapSettings, that.ldapSettings) &&
equal(orgEmailSettings, that.orgEmailSettings) && equal(emailSettings, that.emailSettings) &&
equal(orgPasswordPolicySettings, that.orgPasswordPolicySettings); equal(passwordPolicy, that.passwordPolicy);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), return Objects.hashCode(super.hashCode(),
orgGeneralSettings, generalSettings,
vAppLeaseSettings, vAppLeaseSettings,
vAppTemplateLeaseSettings, vAppTemplateLeaseSettings,
orgLdapSettings, ldapSettings,
orgEmailSettings, emailSettings,
orgPasswordPolicySettings); passwordPolicy);
} }
@Override @Override
public ToStringHelper string() { public ToStringHelper string() {
return super.string() return super.string()
.add("orgGeneralSettings", orgGeneralSettings) .add("generalSettings", generalSettings)
.add("vAppLeaseSettings", vAppLeaseSettings) .add("vAppLeaseSettings", vAppLeaseSettings)
.add("vAppTemplateLeaseSettings", vAppTemplateLeaseSettings) .add("vAppTemplateLeaseSettings", vAppTemplateLeaseSettings)
.add("orgLdapSettings", orgLdapSettings) .add("ldapSettings", ldapSettings)
.add("orgEmailSettings", orgEmailSettings) .add("emailSettings", emailSettings)
.add("orgPasswordPolicySettings", orgPasswordPolicySettings); .add("passwordPolicy", passwordPolicy);
} }
} }

View File

@ -111,11 +111,11 @@ public class Reference extends ReferenceType<Reference> {
Reference that = Reference.class.cast(o); Reference that = Reference.class.cast(o);
return super.equals(that); return super.equals(that);
} }
public ReferenceType<?> toAdminReference(String endpoint) { public ReferenceType<?> toAdminReference(String endpoint) {
return toBuilder() return toBuilder()
.type(null) .type(null)
.href(URI.create(getHref().toASCIIString().replace(endpoint, endpoint+"/admin"))) .href(URI.create(getHref().toASCIIString().replace(endpoint, endpoint+"/admin")))
.build(); .build();
} }
} }

View File

@ -61,7 +61,7 @@ import com.google.common.base.Objects.ToStringHelper;
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SmtpServerSettings", propOrder = { @XmlType(name = "SmtpServerSettings", propOrder = {
"isUseAuthentication", "useAuthentication",
"host", "host",
"username", "username",
"password" "password"
@ -200,8 +200,7 @@ public class SmtpServerSettings {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
SmtpServerSettings that = SmtpServerSettings.class.cast(o); SmtpServerSettings that = SmtpServerSettings.class.cast(o);
return super.equals(that) && return equal(useAuthentication, that.useAuthentication) &&
equal(useAuthentication, that.useAuthentication) &&
equal(host, that.host) && equal(host, that.host) &&
equal(username, that.username) && equal(username, that.username) &&
equal(password, that.password); equal(password, that.password);
@ -209,8 +208,7 @@ public class SmtpServerSettings {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), return Objects.hashCode(useAuthentication,
useAuthentication,
host, host,
username, username,
password); password);

View File

@ -33,6 +33,7 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/** /**
@ -62,7 +63,7 @@ import com.google.common.collect.ImmutableList;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "UsersList") @XmlRootElement(name = "UsersList")
@XmlType(propOrder = { @XmlType(propOrder = {
"userReference" "users"
}) })
public class UsersList { public class UsersList {
public static Builder builder() { public static Builder builder() {
@ -74,7 +75,7 @@ public class UsersList {
} }
public static class Builder { public static class Builder {
private List<Reference> users; private List<Reference> users = Lists.newArrayList();
/** /**
* @see UsersList#getUsers() * @see UsersList#getUsers()

View File

@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/** /**
@ -76,7 +77,7 @@ public class Vdcs {
public static class Builder { public static class Builder {
private List<Reference> vdcs; private List<Reference> vdcs = Lists.newArrayList();
/** /**
* @see Vdcs#getVdc() * @see Vdcs#getVdc()

View File

@ -18,46 +18,203 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
import com.google.common.util.concurrent.ListenableFuture;
/** /**
* @see GroupClient * @see GroupClient
* @author danikov * @author danikov
*/ */
@RequestFilters(AddVCloudAuthorizationToRequest.class) @RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminOrgAsyncClient { public interface AdminOrgAsyncClient extends OrgAsyncClient {
// GET /admin/org/{id} /**
* @see AdminOrgClient#getOrg(URI)
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<AdminOrg> getOrg(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#getSettings(URI)
*/
@GET
@Path("/settings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgSettings> getSettings(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateSettings(URI, OrgSettings)
*/
@PUT
@Path("/settings")
@Consumes(VCloudDirectorMediaType.ORG_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgSettings> updateSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgSettings settings);
/**
* @see AdminOrgClient#getEmailSettings(URI)
*/
@GET
@Path("/settings/email")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgEmailSettings> getEmailSettings(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateEmailSettings(URI, OrgEmailSettings)
*/
@PUT
@Path("/settings/email")
@Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgEmailSettings> updateEmailSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgEmailSettings settings);
/**
* @see AdminOrgClient#getGeneralSettings(URI)
*/
@GET
@Path("/settings/general")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgGeneralSettings> getGeneralSettings(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateGeneralSettings(URI, OrgGeneralSettings)
*/
@PUT
@Path("/settings/general")
@Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgGeneralSettings> updateGeneralSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings);
// POST /admin/org/{id}/catalogs /**
* @see AdminOrgClient#getPasswordPolicy(URI)
*/
@GET
@Path("/settings/ldap")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam URI orgRef);
// POST /admin/org/{id}/groups /**
* @see AdminOrgClient#getPasswordPolicy(URI)
// GET /admin/org/{id}/settings */
@GET
// PUT /admin/org/{id}/settings @Path("/settings/passwordPolicy")
@Consumes
// GET /admin/org/{id}/settings/email @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
// PUT /admin/org/{id}/settings/email ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(
@EndpointParam URI orgRef);
// GET /admin/org/{id}/settings/general
/**
// PUT /admin/org/{id}/settings/general * @see AdminOrgClient#updatePasswordPolicy(URI, OrgPasswordPolicySettings)
*/
// GET /admin/org/{id}/settings/ldap @PUT
@Path("/settings/passwordPolicy")
// GET /admin/org/{id}/settings/passwordPolicy @Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
// PUT /admin/org/{id}/settings/passwordPolicy @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
// GET /admin/org/{id}/settings/vAppLeaseSettings ListenableFuture<OrgPasswordPolicySettings> updatePasswordPolicy(
@EndpointParam URI orgRef,
// PUT /admin/org/{id}/settings/vAppLeaseSettings @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings);
// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings
// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings
/**
* @see AdminOrgClient#getVAppLeaseSettings(URI)
*/
@GET
@Path("/settings/vAppLeaseSettings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppLeaseSettings(URI, OrgVAppLeaseSettings)
*/
@PUT
@Path("/settings/vAppLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgLeaseSettings> updateVAppLeaseSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings);
/**
* @see AdminOrgClient#getVAppTemplateLeaseSettings(URI)
*/
@GET
@Path("/settings/vAppTemplateLeaseSettings")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(
@EndpointParam URI orgRef);
/**
* @see AdminOrgClient#updateVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings)
*/
@PUT
@Path("/settings/vAppTemplateLeaseSettings")
@Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<OrgVAppTemplateLeaseSettings> updateVAppTemplateLeaseSettings(
@EndpointParam URI orgRef,
@BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings);
} }

View File

@ -18,9 +18,19 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.Group;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
/** /**
* Provides synchronous access to {@link Group} objects. * Provides synchronous access to {@link Group} objects.
@ -29,38 +39,181 @@ import org.jclouds.concurrent.Timeout;
* @author danikov * @author danikov
*/ */
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminOrgClient { public interface AdminOrgClient extends OrgClient {
// GET /admin/org/{id} /**
* Retrieves an admin view of an organization.
* The organization might be enabled or disabled.
* If enabled, the organization allows login and all other operations.
*
* <pre>
* GET /admin/org/{id}
* </pre>
*
* @param orgRef the reference for the admin org
* @return the admin org
*/
AdminOrg getOrg(URI orgRef);
// POST /admin/org/{id}/catalogs /**
* Gets organizational settings for this organization.
*
* <pre>
* GET /admin/org/{id}/settings
* </pre>
*
* @param orgRef the reference for the admin org
* @return the settings
*/
OrgSettings getSettings(URI orgRef);
// POST /admin/org/{id}/groups /**
* Updates organizational settings for this organization.
*
* <pre>
* PUT /admin/org/{id}/settings
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgSettings updateSettings(URI orgRef, OrgSettings newSettings);
// GET /admin/org/{id}/settings /**
* Retrieves email settings for an organization.
*
* <pre>
* GET /admin/org/{id}/settings/email
* </pre>
*
* @param orgRef the reference for the admin org
* @return the email settings
*/
OrgEmailSettings getEmailSettings(URI orgRef);
// PUT /admin/org/{id}/settings /**
* Updates email policy settings for organization.
*
* <pre>
* PUT /admin/org/{id}/settings/email
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgEmailSettings updateEmailSettings(URI orgRef,
OrgEmailSettings newSettings);
// GET /admin/org/{id}/settings/email /**
* Gets general organization settings.
*
* <pre>
* GET /admin/org/{id}/settings/general
* </pre>
*
* @param orgRef the reference for the admin org
* @return the lease settings
*/
OrgGeneralSettings getGeneralSettings(URI orgRef);
// PUT /admin/org/{id}/settings/email /**
* Updates general organization settings.
*
* <pre>
* PUT /admin/org/{id}/settings/general
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgGeneralSettings updateGeneralSettings(URI orgRef,
OrgGeneralSettings newSettings);
// GET /admin/org/{id}/settings/general /**
* Retrieves LDAP settings for an organization.
*
* <pre>
* GET /admin/org/{id}/settings/ldap
* </pre>
*
* @param orgRef the reference for the admin org
* @return the ldap settings
*/
OrgLdapSettings getLdapSettings(URI orgRef);
// PUT /admin/org/{id}/settings/general /**
* Retrieves password policy settings for an organization.
*
* <pre>
* GET /admin/org/{id}/settings/passwordPolicy
* </pre>
*
* @param orgRef the reference for the admin org
* @return the lease settings
*/
OrgPasswordPolicySettings getPasswordPolicy(URI orgRef);
// GET /admin/org/{id}/settings/ldap /**
* Updates password policy settings for organization.
*
* <pre>
* PUT /admin/org/{id}/settings/passwordPolicy
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgPasswordPolicySettings updatePasswordPolicy(URI orgRef,
OrgPasswordPolicySettings newSettings);
// GET /admin/org/{id}/settings/passwordPolicy /**
* Gets organization resource cleanup settings on the level of vApp.
*
* <pre>
* GET /admin/org/{id}/settings/vAppLeaseSettings
* </pre>
*
* @param orgRef the reference for the admin org
* @return the lease settings
*/
OrgLeaseSettings getVAppLeaseSettings(URI orgRef);
// PUT /admin/org/{id}/settings/passwordPolicy /**
* Updates organization resource cleanup settings on the level of vApp.
*
* <pre>
* PUT /admin/org/{id}/settings/vAppLeaseSettings
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgLeaseSettings updateVAppLeaseSettings(URI orgRef,
OrgLeaseSettings newSettings);
// GET /admin/org/{id}/settings/vAppLeaseSettings /**
* Retrieves expiration and storage policy for vApp templates in an organization.
*
* <pre>
* GET /admin/org/{id}/settings/vAppTemplateLeaseSettings
* </pre>
*
* @param orgRef the reference for the admin org
* @return the lease settings
*/
OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings(URI orgRef);
// PUT /admin/org/{id}/settings/vAppLeaseSettings /**
* Updates vApp template policy settings for organization.
// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings *
* <pre>
// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings * PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings
* </pre>
* @param orgRef the reference for the admin org
* @param newSettings the requested updated settings
* @return the resultant settings
*/
OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings(URI orgRef,
OrgVAppTemplateLeaseSettings newSettings);
} }

View File

@ -60,7 +60,7 @@ public interface OrgAsyncClient {
@Consumes @Consumes
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Org> getOrg(@EndpointParam URI orgUri); ListenableFuture<? extends Org> getOrg(@EndpointParam URI orgUri);
/** /**
* @return asynchronous access to {@link Metadata.Readable} features * @return asynchronous access to {@link Metadata.Readable} features

View File

@ -38,6 +38,9 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CustomOrgLdapSettings.AuthenticationMechanism;
import org.jclouds.vcloud.director.v1_5.domain.CustomOrgLdapSettings.ConnectorType;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings.LdapMode;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -229,6 +232,46 @@ public class Checks {
checkEntityType(org); checkEntityType(org);
} }
public static void checkAdminOrg(AdminOrg org) {
// required
assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJECT_FMT, "settings", "AdminOrg"));
// optional
if (org.getGroups() != null) {
checkGroupsList(org.getGroups());
}
if (org.getCatalogs() != null) {
checkCatalogsList(org.getCatalogs());
}
if (org.getVdcs() != null) {
checkVdcs(org.getVdcs());
}
if (org.getNetworks() != null) {
checkNetworks(org.getNetworks());
}
// Check parent type
checkOrg(org);
}
public static void checkCatalogsList(CatalogsList catalogList) {
for (Reference catalogItem : catalogList.getCatalogItems()) {
checkReferenceType(catalogItem);
}
}
public static void checkVdcs(Vdcs vdcs) {
for (Reference vdc : vdcs.getVdcs()) {
checkReferenceType(vdc);
}
}
public static void checkNetworks(Networks networks) {
for (Reference network : networks.getNetwork()) {
checkReferenceType(network);
}
}
public static void checkAdminCatalog(AdminCatalog catalog) { public static void checkAdminCatalog(AdminCatalog catalog) {
// Check parent type // Check parent type
checkCatalogType(catalog); checkCatalogType(catalog);
@ -524,4 +567,185 @@ public class Checks {
} }
} }
} }
public static void checkOrgSettings(OrgSettings settings) {
// Check optional fields
if (settings.getGeneralSettings() != null) {
checkGeneralSettings(settings.getGeneralSettings());
}
if (settings.getVAppLeaseSettings() != null) {
checkVAppLeaseSettings(settings.getVAppLeaseSettings());
}
if (settings.getVAppTemplateLeaseSettings() != null) {
checkVAppTemplateLeaseSettings(settings.getVAppTemplateLeaseSettings());
}
if (settings.getLdapSettings() != null) {
checkLdapSettings(settings.getLdapSettings());
}
if (settings.getEmailSettings() != null) {
checkEmailSettings(settings.getEmailSettings());
}
if (settings.getPasswordPolicy() != null) {
checkPasswordPolicySettings(settings.getPasswordPolicy());
}
// parent type
checkResourceType(settings);
}
public static void checkEmailSettings(OrgEmailSettings settings) {
// required
assertNotNull(settings.isDefaultSmtpServer(), String.format(OBJ_FIELD_REQ, "OrgEmailSettings", "isDefaultSmtpServer"));
assertNotNull(settings.isDefaultOrgEmail(), String.format(OBJ_FIELD_REQ, "OrgEmailSettings", "isDefaultOrgEmail"));
assertNotNull(settings.getFromEmailAddress(), String.format(OBJ_FIELD_REQ, "OrgEmailSettings", "fromEmailAddress"));
checkEmailAddress(settings.getFromEmailAddress());
assertNotNull(settings.getDefaultSubjectPrefix(), String.format(OBJ_FIELD_REQ, "OrgEmailSettings", "defaultSubjectPrefix"));
assertNotNull(settings.isAlertEmailToAllAdmins(), String.format(OBJ_FIELD_REQ, "OrgEmailSettings", "isAlertEmailToAllAdmins"));
// optional
// NOTE alertEmailsTo cannot be checked
// parent type
checkResourceType(settings);
}
public static void checkEmailAddress(String email) {
// TODO: validate email addresses
}
public static void checkGeneralSettings(OrgGeneralSettings settings) {
// Check optional fields
// NOTE canPublishCatalogs cannot be checked
// NOTE useServerBootSequence cannot be checked
if (settings.getDeployedVMQuota() != null) {
assertTrue(settings.getDeployedVMQuota() >= 0, String.format(
OBJ_FIELD_GTE_0, "deployedVMQuota", "port", settings.getDeployedVMQuota()));
}
if (settings.getStoredVmQuota() != null) {
assertTrue(settings.getStoredVmQuota() >= 0, String.format(
OBJ_FIELD_GTE_0, "storedVmQuota", "port", settings.getStoredVmQuota()));
}
if (settings.getDelayAfterPowerOnSeconds() != null) {
assertTrue(settings.getDelayAfterPowerOnSeconds() >= 0, String.format(
OBJ_FIELD_GTE_0, "delayAfterPowerOnSeconds", "port", settings.getDelayAfterPowerOnSeconds()));
}
// parent type
checkResourceType(settings);
}
public static void checkLdapSettings(OrgLdapSettings settings) {
// Check optional fields
// NOTE customUsersOu cannot be checked
if (settings.getLdapMode() != null) {
assertTrue(LdapMode.ALL.contains(settings.getLdapMode()), String.format(REQUIRED_VALUE_OBJECT_FMT,
"LdapMode", "OrdLdapSettings", settings.getLdapMode(), Iterables.toString(OrgLdapSettings.LdapMode.ALL)));
}
if (settings.getCustomOrgLdapSettings() != null) {
checkCustomOrgLdapSettings(settings.getCustomOrgLdapSettings());
}
// parent type
checkResourceType(settings);
}
public static void checkCustomOrgLdapSettings(CustomOrgLdapSettings settings) {
// required
assertNotNull(settings.getHostName(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "hostName"));
assertNotNull(settings.getPort(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "port"));
assertTrue(settings.getPort() >= 0, String.format(
OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort()));
assertNotNull(settings.getAuthenticationMechanism(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "authenticationMechanism"));
assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()), String.format(REQUIRED_VALUE_OBJECT_FMT,
"AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(),
Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL)));
assertNotNull(settings.isGroupSearchBaseEnabled(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "isGroupSearchBaseEnabled"));
assertNotNull(settings.getConnectorType(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "connectorType"));
assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()), String.format(REQUIRED_VALUE_OBJECT_FMT,
"ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(),
Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL)));
assertNotNull(settings.getUserAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "userAttributes"));
checkUserAttributes("CustomOrdLdapSettings", settings.getUserAttributes());
assertNotNull(settings.getGroupAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "groupAttributes"));
checkGroupAttributes("CustomOrdLdapSettings", settings.getGroupAttributes());
// optional
// NOTE isSsl cannot be checked
// NOTE isSSlAcceptAll cannot be checked
// NOTE realm cannot be checked
// NOTE searchBase cannot be checked
// NOTE userName cannot be checked
// NOTE password cannot be checked
// NOTE groupSearchBase cannot be checked
}
public static void checkUserAttributes(String client, OrgLdapUserAttributes attributes) {
// required
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, client, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, client, "objectIdentifier"));
assertNotNull(attributes.getUserName(), String.format(OBJ_FIELD_REQ, client, "userName"));
assertNotNull(attributes.getEmail(), String.format(OBJ_FIELD_REQ, client, "email"));
assertNotNull(attributes.getFullName(), String.format(OBJ_FIELD_REQ, client, "fullName"));
assertNotNull(attributes.getGivenName(), String.format(OBJ_FIELD_REQ, client, "givenName"));
assertNotNull(attributes.getSurname(), String.format(OBJ_FIELD_REQ, client, "surname"));
assertNotNull(attributes.getTelephone(), String.format(OBJ_FIELD_REQ, client, "telephone"));
assertNotNull(attributes.getGroupMembershipIdentifier(), String.format(OBJ_FIELD_REQ, client, "groupMembershipIdentifier"));
// optional
// NOTE groupBackLinkIdentifier cannot be checked
}
public static void checkGroupAttributes(String client, OrgLdapGroupAttributes attributes) {
// required
assertNotNull(attributes.getObjectClass(), String.format(OBJ_FIELD_REQ, client, "objectClass"));
assertNotNull(attributes.getObjectIdentifier(), String.format(OBJ_FIELD_REQ, client, "objectIdentifier"));
assertNotNull(attributes.getGroupName(), String.format(OBJ_FIELD_REQ, client, "groupName"));
assertNotNull(attributes.getMembership(), String.format(OBJ_FIELD_REQ, client, "membership"));
assertNotNull(attributes.getMembershipIdentifier(), String.format(OBJ_FIELD_REQ, client, "membershipIdentifier"));
// optional
// NOTE backLinkIdentifier cannot be checked
}
public static void checkPasswordPolicySettings(OrgPasswordPolicySettings settings) {
// required
assertNotNull(settings.isAccountLockoutEnabled(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "isAccountLockoutEnabled"));
assertNotNull(settings.getInvalidLoginsBeforeLockout(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "invalidLoginsBeforeLockout"));
assertTrue(settings.getInvalidLoginsBeforeLockout() >= 0, String.format(
OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "storageLeaseSeconds", settings.getInvalidLoginsBeforeLockout()));
assertNotNull(settings.getAccountLockoutIntervalMinutes(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes"));
assertTrue(settings.getAccountLockoutIntervalMinutes() >= 0, String.format(
OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes", settings.getAccountLockoutIntervalMinutes()));
// parent type
checkResourceType(settings);
}
public static void checkVAppLeaseSettings(OrgLeaseSettings settings) {
// Check optional fields
// NOTE deleteOnStorageLeaseExpiration cannot be checked
if (settings.getStorageLeaseSeconds() != null) {
assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
OBJ_FIELD_GTE_0, "OrgLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
}
if (settings.getDeploymentLeaseSeconds() != null) {
assertTrue(settings.getDeploymentLeaseSeconds() >= 0, String.format(
OBJ_FIELD_GTE_0, "OrgLeaseSettings", "deploymentLeaseSeconds", settings.getDeploymentLeaseSeconds()));
}
// parent type
checkResourceType(settings);
}
public static void checkVAppTemplateLeaseSettings(OrgVAppTemplateLeaseSettings settings) {
// Check optional fields
// NOTE deleteOnStorageLeaseExpiration cannot be checked
if (settings.getStorageLeaseSeconds() != null) {
assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
OBJ_FIELD_GTE_0, "OrgVAppTemplateLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
}
// parent type
checkResourceType(settings);
}
} }

View File

@ -31,10 +31,11 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksInProgress;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/** /**
* Test the {@link CatalogClient} by observing its side effects. * Test the {@link CatalogClient} by observing its side effects.
* *
@ -225,8 +226,8 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"))
.build()) .build())
.description("created by testCreateCatalog()") .description("created by testCreateCatalog()")
.tasksInProgress(TasksInProgress.builder() .tasks(ImmutableSet.<Task>builder()
.task(Task.builder() .add(Task.builder()
.status("running") .status("running")
.startTime(dateService.iso8601DateParse("2012-03-11T18:43:02.429-04:00")) .startTime(dateService.iso8601DateParse("2012-03-11T18:43:02.429-04:00"))
.operationName("catalogCreateCatalog") .operationName("catalogCreateCatalog")

View File

@ -18,9 +18,28 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import static org.testng.Assert.assertEquals;
import java.net.URI; import java.net.URI;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.CatalogsList;
import org.jclouds.vcloud.director.v1_5.domain.GroupsList;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Networks;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings;
import org.jclouds.vcloud.director.v1_5.domain.UsersList;
import org.jclouds.vcloud.director.v1_5.domain.Vdcs;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -33,40 +52,571 @@ import org.testng.annotations.Test;
public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
private Reference orgRef = Reference.builder() private Reference orgRef = Reference.builder()
.type("application/vnd.vmware.admin.???+xml") .href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.name("???")
.href(URI.create(endpoint + "/admin/org/???"))
.build(); .build();
// GET /admin/org/{id} @Test
public void testGetOrg() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/org.xml",
VCloudDirectorMediaType.ADMIN_ORG)
.httpResponseBuilder().build());
AdminOrg expected = adminOrg();
assertEquals(client.getAdminOrgClient().getOrg(orgRef.getHref()), expected);
}
// POST /admin/org/{id}/catalogs public static final AdminOrg adminOrg() {
return AdminOrg.builder()
.name("JClouds")
.id("urn:vcloud:org:6f312e42-cd2b-488d-a2bb-97519cd57ed0")
.type("application/vnd.vmware.admin.organization+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.vcloud.tasksList+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.vcloud.metadata+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
.build())
.link(Link.builder()
.rel("add")
.type("application/vnd.vmware.admin.catalog+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs"))
.build())
.link(Link.builder()
.rel("add")
.type("application/vnd.vmware.admin.user+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/users"))
.build())
.link(Link.builder()
.rel("add")
.type("application/vnd.vmware.admin.group+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/groups"))
.build())
.link(Link.builder()
.rel("add")
.type("application/vnd.vmware.admin.orgNetwork+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/networks"))
.build())
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.organization+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.link(Link.builder()
.rel("remove")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.link(Link.builder()
.rel("alternate")
.type("application/vnd.vmware.vcloud.org+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.description("")
.fullName("JClouds")
.isEnabled(true)
.settings(settings())
.users(UsersList.builder()
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("adam.lowe@cloudsoftcorp.com")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/672ebb67-d8ff-4201-9c1b-c1be869e526c"))
.build())
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("adrian@jclouds.org")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/8c360b93-ed25-4c9a-8e24-d48cd9966d93"))
.build())
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("qunying.huang@enstratus.com")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"))
.build())
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("dan@cloudsoftcorp.com")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
.build())
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("adk@cloudsoftcorp.com")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
.build())
.build())
.groups(GroupsList.builder()
.build())
.catalogs(CatalogsList.builder()
.catalog(Reference.builder()
.type("application/vnd.vmware.admin.catalog+xml")
.name("QunyingTestCatalog")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.build())
.catalog(Reference.builder()
.type("application/vnd.vmware.admin.catalog+xml")
.name("Public")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"))
.build())
.catalog(Reference.builder()
.type("application/vnd.vmware.admin.catalog+xml")
.name("dantest")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/b542aff4-9f97-4f51-a126-4330fbf62f02"))
.build())
.catalog(Reference.builder()
.type("application/vnd.vmware.admin.catalog+xml")
.name("test")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"))
.build())
.build())
.vdcs(Vdcs.builder()
.vdc(Reference.builder()
.type("application/vnd.vmware.vcloud.vdc+xml")
.name("Cluster01-JClouds")
.href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07"))
.build())
.build())
.networks(Networks.builder()
.network(Reference.builder()
.type("application/vnd.vmware.admin.network+xml")
.name("ilsolation01-Jclouds")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
.build())
.network(Reference.builder()
.type("application/vnd.vmware.admin.network+xml")
.name("internet01-Jclouds")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/55a677cf-ab3f-48ae-b880-fab90421980c"))
.build())
.build())
.build();
}
@Test(enabled = false)
public void testGetSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/settings.xml",
VCloudDirectorMediaType.ORG_SETTINGS)
.httpResponseBuilder().build());
OrgSettings expected = settings();
assertEquals(client.getAdminOrgClient().getSettings(orgRef.getHref()), expected);
}
public static final OrgSettings settings() {
return OrgSettings.builder()
.type("application/vnd.vmware.admin.orgSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings"))
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.organizationEmailSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.vAppLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.organizationGeneralSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.admin.organizationLdapSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap"))
.build())
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.orgSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings"))
.build())
.generalSettings(generalSettings())
.vAppLeaseSettings(vAppLeaseSettings())
.vAppTemplateLeaseSettings(vAppTemplateLeaseSettings())
.ldapSettings(ldapSettings())
.emailSettings(emailSettings())
.passwordPolicy(passwordPolicy())
.build();
}
@Test(enabled = false)
public void testUpdateSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
.xmlFilePayload("/org/admin/updateSettingsSource.xml",
VCloudDirectorMediaType.ORG_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateSettings.xml",
VCloudDirectorMediaType.ORG_SETTINGS)
.httpResponseBuilder().build());
OrgSettings expected = updateSettings();
assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getHref(), expected), expected);
}
@Test
public static final OrgSettings updateSettings() {
return settings().toBuilder()
.build();
}
// POST /admin/org/{id}/groups @Test
public void testGetEmailSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/emailSettings.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.httpResponseBuilder().build());
OrgEmailSettings expected = emailSettings();
assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getHref()), expected);
}
public static final OrgEmailSettings emailSettings() {
return OrgEmailSettings.builder()
.type("application/vnd.vmware.admin.organizationEmailSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"))
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.organizationEmailSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"))
.build())
.isDefaultSmtpServer(true)
.isDefaultOrgEmail(true)
.fromEmailAddress("")
.defaultSubjectPrefix("")
.isAlertEmailToAllAdmins(true)
.smtpServerSettings(SmtpServerSettings.builder()
.useAuthentication(false)
.host("")
.username("")
.password("")
.build())
.build();
}
@Test
public void testUpdateEmailSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email")
.xmlFilePayload("/org/admin/updateEmailSettingsSource.xml",
VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateEmailSettings.xml",
VCloudDirectorMediaType.ORG_EMAIL_SETTINGS)
.httpResponseBuilder().build());
OrgEmailSettings expected = updateEmailSettings();
assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected);
}
@Test
public static final OrgEmailSettings updateEmailSettings() {
return emailSettings().toBuilder()
.isDefaultSmtpServer(false)
.isDefaultOrgEmail(false)
.fromEmailAddress("test@test.com")
.defaultSubjectPrefix("new")
.isAlertEmailToAllAdmins(false)
.smtpServerSettings(emailSettings().getSmtpServerSettings().toBuilder()
.useAuthentication(true)
.host("new")
.username("new")
.build())
.build();
}
@Test(enabled = false)
public void testGetGeneralSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/generalSettings.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.httpResponseBuilder().build());
OrgGeneralSettings expected = generalSettings();
assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getHref()), expected);
}
public static final OrgGeneralSettings generalSettings() {
return OrgGeneralSettings.builder()
.type("application/vnd.vmware.admin.organizationGeneralSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general"))
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.organizationGeneralSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general"))
.build())
.canPublishCatalogs(false)
.deployedVMQuota(0)
.storedVmQuota(0)
.useServerBootSequence(false)
.delayAfterPowerOnSeconds(0)
.build();
}
@Test(enabled = false)
public void testUpdateGeneralSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")
.xmlFilePayload("/org/admin/updateGeneralSettingsSource.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateGeneralSettings.xml",
VCloudDirectorMediaType.ORG_GENERAL_SETTINGS)
.httpResponseBuilder().build());
OrgGeneralSettings expected = updateGeneralSettings();
assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected);
}
public static final OrgGeneralSettings updateGeneralSettings() {
return generalSettings().toBuilder()
.build();
}
// GET /admin/org/{id}/settings @Test
public void testGetLdapSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/ldapSettings.xml",
VCloudDirectorMediaType.ORG_LDAP_SETTINGS)
.httpResponseBuilder().build());
OrgLdapSettings expected = ldapSettings();
assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getHref()), expected);
}
public static final OrgLdapSettings ldapSettings() {
return OrgLdapSettings.builder()
.type("application/vnd.vmware.admin.organizationLdapSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap"))
.ldapMode("NONE")
.build();
}
// PUT /admin/org/{id}/settings @Test
public void testGetPasswordPolicy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/passwordPolicy.xml",
VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
.httpResponseBuilder().build());
OrgPasswordPolicySettings expected = passwordPolicy();
assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getHref()), expected);
}
public static final OrgPasswordPolicySettings passwordPolicy() {
return OrgPasswordPolicySettings.builder()
.type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml")
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"))
.build())
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"))
.accountLockoutEnabled(false)
.invalidLoginsBeforeLockout(5)
.accountLockoutIntervalMinutes(10)
.build();
}
@Test
public void testUpdatePasswordPolicy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")
.xmlFilePayload("/org/admin/updatePasswordPolicySource.xml",
VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updatePasswordPolicy.xml",
VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS)
.httpResponseBuilder().build());
OrgPasswordPolicySettings expected = updateOrgPasswordPolicy();
assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected);
}
public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() {
return passwordPolicy().toBuilder()
.accountLockoutEnabled(true)
.invalidLoginsBeforeLockout(6)
.accountLockoutIntervalMinutes(11)
.build();
}
// GET /admin/org/{id}/settings/email @Test(enabled = false)
public void testGetVAppLeaseSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/vAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
.httpResponseBuilder().build());
OrgLeaseSettings expected = vAppLeaseSettings();
assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected);
}
public static final OrgLeaseSettings vAppLeaseSettings() {
return OrgLeaseSettings.builder()
.type("application/vnd.vmware.admin.vAppLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings"))
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.vAppLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings"))
.build())
.deleteOnStorageLeaseExpiration(false)
.deploymentLeaseSeconds(0)
.storageLeaseSeconds(0)
.build();
}
@Test(enabled = false)
public void testUpdateOrgVAppLeaseSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml",
VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_LEASE_SETTINGS)
.httpResponseBuilder().build());
OrgLeaseSettings expected = updateVAppLeaseSettings();
assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected);
}
public static final OrgLeaseSettings updateVAppLeaseSettings() {
return vAppLeaseSettings().toBuilder()
.build();
}
// PUT /admin/org/{id}/settings/email @Test(enabled = false)
public void testGetVAppTemplateLeaseSettings() {
// GET /admin/org/{id}/settings/general VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
// PUT /admin/org/{id}/settings/general .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
.acceptAnyMedia()
// GET /admin/org/{id}/settings/ldap .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
// GET /admin/org/{id}/settings/passwordPolicy .xmlFilePayload("/org/admin/vAppTemplateLeaseSettings.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
// PUT /admin/org/{id}/settings/passwordPolicy .httpResponseBuilder().build());
// GET /admin/org/{id}/settings/vAppLeaseSettings OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings();
// PUT /admin/org/{id}/settings/vAppLeaseSettings assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected);
}
// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings
public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() {
// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings return OrgVAppTemplateLeaseSettings.builder()
.type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings"))
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings"))
.build())
.deleteOnStorageLeaseExpiration(false)
.storageLeaseSeconds(0)
.build();
}
@Test(enabled = false)
public void testUpdateOrgVAppTemplateLeaseSettings() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")
.xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
.acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml",
VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS)
.httpResponseBuilder().build());
OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings();
assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
}
public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() {
return vAppTemplateLeaseSettings().toBuilder()
.build();
}
} }

View File

@ -18,15 +18,29 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/** /**
* Tests live behavior of {@link AdminGroupClient}. * Tests live behavior of {@link AdminGroupClient}.
* *
@ -35,7 +49,7 @@ import org.testng.annotations.Test;
@Test(groups = { "live", "admin", "org" }, singleThreaded = true, testName = "AdminOrgClientLiveTest") @Test(groups = { "live", "admin", "org" }, singleThreaded = true, testName = "AdminOrgClientLiveTest")
public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String GROUP = "admin org"; public static final String ORG = "admin org";
/* /*
* Convenience references to API clients. * Convenience references to API clients.
@ -47,46 +61,381 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
* Shared state between dependant tests. * Shared state between dependant tests.
*/ */
private ReferenceType<?> orgRef; private ReferenceType<?> orgRef;
private AdminOrg org; private OrgSettings settings, newSettings;
private OrgEmailSettings emailSettings, newEmailSettings;
private OrgGeneralSettings generalSettings, newGeneralSettings;
private OrgLdapSettings ldapSettings, newLdapSettings;
private OrgPasswordPolicySettings passwordPolicy, newPasswordPolicy;
private OrgLeaseSettings vAppLeaseSettings, newVAppLeaseSettings;
private OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings, newVAppTemplateLeaseSettings;
@Override @Override
@BeforeClass(inheritGroups = true) @BeforeClass(inheritGroups = true)
public void setupRequiredClients() { public void setupRequiredClients() {
orgClient = context.getApi().getAdminOrgClient(); orgClient = context.getApi().getAdminOrgClient();
orgRef = Reference.builder() orgRef = Iterables.getFirst(orgClient.getOrgList().getOrgs(), null).toAdminReference(endpoint);
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/???")) assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org"));
.build();
} }
// GET /admin/org/{id} @Test(testName = "GET /admin/org/{id}")
public void testGetAdminOrg() {
AdminOrg adminOrg = orgClient.getOrg(orgRef.getHref());
Checks.checkAdminOrg(adminOrg);
}
// POST /admin/org/{id}/catalogs @Test(testName = "GET /admin/org/{id}/settings/emailSettings")
public void testGetEmailSettings() {
emailSettings = orgClient.getEmailSettings(orgRef.getHref());
Checks.checkEmailSettings(emailSettings);
}
@Test(testName = "PUT /admin/org/{id}/settings/emailSettings",
dependsOnMethods = { "testGetEmailSettings" })
public void testUpdateEmailSettings() {
boolean isDefaultSmtpServer = emailSettings.isDefaultSmtpServer();
boolean isDefaultOrgEmail = emailSettings.isDefaultOrgEmail();
String oldFromEmailAddress = emailSettings.getFromEmailAddress();
String newFromEmailAddress = "test@test.com";
String oldDefaultSubjectPrefix = emailSettings.getDefaultSubjectPrefix();
String newDefaultSubjectPrefix = "new"+oldDefaultSubjectPrefix;
boolean isAlertEmailToAllAdmins = emailSettings.isAlertEmailToAllAdmins();
SmtpServerSettings oldSmtpServerSettings = emailSettings.getSmtpServerSettings();
SmtpServerSettings newSmtpServerSettings = oldSmtpServerSettings.toBuilder()
.useAuthentication(!oldSmtpServerSettings.useAuthentication())
.host("new"+oldSmtpServerSettings.getHost())
.username("new"+oldSmtpServerSettings.getUsername())
.password("new"+oldSmtpServerSettings.getPassword())
.build();
try {
newEmailSettings = emailSettings.toBuilder()
.isDefaultSmtpServer(!isDefaultSmtpServer)
.isDefaultOrgEmail(!isDefaultOrgEmail)
.fromEmailAddress(newFromEmailAddress)
.defaultSubjectPrefix(newDefaultSubjectPrefix)
.isAlertEmailToAllAdmins(!isAlertEmailToAllAdmins)
.smtpServerSettings(newSmtpServerSettings)
.build();
emailSettings = orgClient.updateEmailSettings(
orgRef.getHref(), newEmailSettings);
assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "isDefaultSmtpServer"));
assertTrue(equal(emailSettings.isDefaultOrgEmail(), !isDefaultOrgEmail),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "isDefaultOrgEmail"));
assertTrue(equal(emailSettings.getFromEmailAddress(), newFromEmailAddress),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "fromEmailAddress"));
assertTrue(equal(emailSettings.getDefaultSubjectPrefix(), newDefaultSubjectPrefix),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "defaultSubjectPrefix"));
assertTrue(equal(emailSettings.isAlertEmailToAllAdmins(), !isAlertEmailToAllAdmins),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "isAlertEmailToAllAdmins"));
assertTrue(equal(emailSettings.getSmtpServerSettings(), newSmtpServerSettings),
String.format(OBJ_FIELD_UPDATABLE,
"emailSettings", "smtpServerSettings"));
//TODO negative tests?
Checks.checkEmailSettings(emailSettings);
} finally {
emailSettings = emailSettings.toBuilder()
.isDefaultSmtpServer(isDefaultSmtpServer)
.isDefaultOrgEmail(isDefaultOrgEmail)
.fromEmailAddress(oldFromEmailAddress)
.defaultSubjectPrefix(oldDefaultSubjectPrefix)
.isAlertEmailToAllAdmins(isAlertEmailToAllAdmins)
.smtpServerSettings(oldSmtpServerSettings)
.build();
emailSettings = orgClient.updateEmailSettings(
orgRef.getHref(), emailSettings);
}
}
// POST /admin/org/{id}/groups @Test(testName = "GET /admin/org/{id}/settings/generalSettings")
public void testGetGeneralSettings() {
generalSettings = orgClient.getGeneralSettings(orgRef.getHref());
Checks.checkGeneralSettings(generalSettings);
}
@Test(testName = "PUT /admin/org/{id}/settings/generalSettings",
dependsOnMethods = { "testGetGeneralSettings" }, enabled = false )
public void testUpdateGeneralSettings() {
// boolean canPublishCatalogs = generalSettings.canPublishCatalogs(); // FIXME: did not update
Integer deployedVMQuota = generalSettings.getDeployedVMQuota();
Integer storedVmQuota = generalSettings.getStoredVmQuota();
boolean useServerBootSequence = generalSettings.useServerBootSequence();
Integer delayAfterPowerOnSeconds = generalSettings.getDelayAfterPowerOnSeconds();
try {
newGeneralSettings = generalSettings.toBuilder()
// .canPublishCatalogs(!canPublishCatalogs)
.deployedVMQuota(deployedVMQuota+1)
.storedVmQuota(storedVmQuota+1)
.useServerBootSequence(!useServerBootSequence)
.delayAfterPowerOnSeconds(delayAfterPowerOnSeconds+1)
.build();
generalSettings = orgClient.updateGeneralSettings(
orgRef.getHref(), newGeneralSettings);
// assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs),
// String.format(OBJ_FIELD_UPDATABLE,
// "generalSettings", "canPublishCatalogs"));
assertTrue(equal(generalSettings.getDeployedVMQuota(), deployedVMQuota+1),
String.format(OBJ_FIELD_UPDATABLE,
"generalSettings", "deployedVMQuota"));
assertTrue(equal(generalSettings.getStoredVmQuota(), storedVmQuota+1),
String.format(OBJ_FIELD_UPDATABLE,
"generalSettings", "storedVmQuota"));
assertTrue(equal(generalSettings.useServerBootSequence(), !useServerBootSequence),
String.format(OBJ_FIELD_UPDATABLE,
"generalSettings", "useServerBootSequence"));
assertTrue(equal(generalSettings.getDelayAfterPowerOnSeconds(), delayAfterPowerOnSeconds+1),
String.format(OBJ_FIELD_UPDATABLE,
"generalSettings", "delayAfterPowerOnSeconds"));
//TODO negative tests?
Checks.checkGeneralSettings(generalSettings);
} finally {
generalSettings = generalSettings.toBuilder()
// .canPublishCatalogs(canPublishCatalogs)
.deployedVMQuota(deployedVMQuota)
.storedVmQuota(storedVmQuota)
.useServerBootSequence(useServerBootSequence)
.delayAfterPowerOnSeconds(delayAfterPowerOnSeconds)
.build();
generalSettings = orgClient.updateGeneralSettings(
orgRef.getHref(), generalSettings);
}
}
// GET /admin/org/{id}/settings @Test(testName = "GET /admin/org/{id}/settings/ldap")
public void testGetLdapSettings() {
ldapSettings = orgClient.getLdapSettings(orgRef.getHref());
Checks.checkLdapSettings(ldapSettings);
}
// PUT /admin/org/{id}/settings @Test(testName = "GET /admin/org/{id}/settings/passwordPolicy")
public void testGetPasswordPolicy() {
passwordPolicy = orgClient.getPasswordPolicy(orgRef.getHref());
Checks.checkPasswordPolicySettings(passwordPolicy);
}
@Test(testName = "PUT /admin/org/{id}/settings/passwordPolicy",
dependsOnMethods = { "testGetPasswordPolicy" })
public void testUpdatePasswordPolicy() {
boolean accountLockoutEnabled = passwordPolicy.isAccountLockoutEnabled();
Integer invalidLoginsBeforeLockout = passwordPolicy.getInvalidLoginsBeforeLockout();
Integer accountLockoutIntervalMinutes = passwordPolicy.getAccountLockoutIntervalMinutes();
try {
newPasswordPolicy = passwordPolicy.toBuilder()
.accountLockoutEnabled(!accountLockoutEnabled)
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout+1)
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes+1)
.build();
passwordPolicy = orgClient.updatePasswordPolicy(
orgRef.getHref(), newPasswordPolicy);
assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled),
String.format(OBJ_FIELD_UPDATABLE,
"PasswordPolicySettings", "deleteOnStorageLeaseExpiration"));
assertTrue(equal(passwordPolicy.getInvalidLoginsBeforeLockout(), invalidLoginsBeforeLockout+1),
String.format(OBJ_FIELD_UPDATABLE,
"PasswordPolicySettings", "storageLeaseSeconds"));
assertTrue(equal(passwordPolicy.getAccountLockoutIntervalMinutes(), accountLockoutIntervalMinutes+1),
String.format(OBJ_FIELD_UPDATABLE,
"PasswordPolicySettings", "deploymentLeaseSeconds"));
//TODO negative tests?
Checks.checkPasswordPolicySettings(passwordPolicy);
} finally {
passwordPolicy = passwordPolicy.toBuilder()
.accountLockoutEnabled(accountLockoutEnabled)
.invalidLoginsBeforeLockout(invalidLoginsBeforeLockout)
.accountLockoutIntervalMinutes(accountLockoutIntervalMinutes)
.build();
passwordPolicy = orgClient.updatePasswordPolicy(
orgRef.getHref(), passwordPolicy);
}
}
@Test(testName = "GET /admin/org/{id}/settings/vAppLeaseSettings")
public void testGetVAppLeaseSettings() {
vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getHref());
Checks.checkVAppLeaseSettings(vAppLeaseSettings);
}
@Test(testName = "PUT /admin/org/{id}/settings/vAppLeaseSettings",
dependsOnMethods = { "testGetVAppLeaseSettings" }, enabled = false) // FIXME: fails with 403 forbidden
public void testUpdateVAppLeaseSettings() {
boolean deleteOnStorageLeaseExpiration = vAppLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppLeaseSettings.getStorageLeaseSeconds();
Integer deploymentLeaseSeconds = vAppLeaseSettings.getDeploymentLeaseSeconds();
try {
newVAppLeaseSettings = vAppLeaseSettings.toBuilder()
.deleteOnStorageLeaseExpiration(!deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds+1)
.deploymentLeaseSeconds(deploymentLeaseSeconds+1)
.build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
orgRef.getHref(), newVAppLeaseSettings);
assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE,
"vAppLeaseSettings", "deleteOnStorageLeaseExpiration"));
assertTrue(equal(vAppLeaseSettings.getStorageLeaseSeconds(), storageLeaseSeconds+1),
String.format(OBJ_FIELD_UPDATABLE,
"vAppLeaseSettings", "storageLeaseSeconds"));
assertTrue(equal(vAppLeaseSettings.getDeploymentLeaseSeconds(), deploymentLeaseSeconds+1),
String.format(OBJ_FIELD_UPDATABLE,
"vAppLeaseSettings", "deploymentLeaseSeconds"));
//TODO negative tests?
Checks.checkVAppLeaseSettings(vAppLeaseSettings);
} finally {
vAppLeaseSettings = vAppLeaseSettings.toBuilder()
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds)
.deploymentLeaseSeconds(deploymentLeaseSeconds)
.build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
orgRef.getHref(), vAppLeaseSettings);
}
}
// GET /admin/org/{id}/settings/email @Test(testName = "GET /admin/org/{id}/settings/vAppTemplateLeaseSettings")
public void testGetVAppTemplateLeaseSettings() {
// PUT /admin/org/{id}/settings/email vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getHref());
// GET /admin/org/{id}/settings/general Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings);
}
// PUT /admin/org/{id}/settings/general
@Test(testName = "PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings",
// GET /admin/org/{id}/settings/ldap dependsOnMethods = { "testGetVAppTemplateLeaseSettings" }, enabled = false) // FIXME: fails with 403 forbidden
public void testUpdateVAppTemplateLeaseSettings() {
// GET /admin/org/{id}/settings/passwordPolicy boolean deleteOnStorageLeaseExpiration = vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration();
Integer storageLeaseSeconds = vAppTemplateLeaseSettings.getStorageLeaseSeconds();
// PUT /admin/org/{id}/settings/passwordPolicy
try {
// GET /admin/org/{id}/settings/vAppLeaseSettings newVAppTemplateLeaseSettings = vAppTemplateLeaseSettings.toBuilder()
.deleteOnStorageLeaseExpiration(!deleteOnStorageLeaseExpiration)
// PUT /admin/org/{id}/settings/vAppLeaseSettings .storageLeaseSeconds(storageLeaseSeconds+1)
.build();
// GET /admin/org/{id}/settings/vAppTemplateLeaseSettings
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
// PUT /admin/org/{id}/settings/vAppTemplateLeaseSettings orgRef.getHref(), newVAppTemplateLeaseSettings);
assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE,
"vAppTemplateLeaseSettings", "deleteOnStorageLeaseExpiration"));
assertTrue(equal(vAppTemplateLeaseSettings.getStorageLeaseSeconds(), storageLeaseSeconds+1),
String.format(OBJ_FIELD_UPDATABLE,
"vAppTemplateLeaseSettings", "storageLeaseSeconds"));
//TODO negative tests?
Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings);
} finally {
vAppTemplateLeaseSettings = vAppTemplateLeaseSettings.toBuilder()
.deleteOnStorageLeaseExpiration(deleteOnStorageLeaseExpiration)
.storageLeaseSeconds(storageLeaseSeconds)
.build();
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
orgRef.getHref(), vAppTemplateLeaseSettings);
}
}
@Test(testName = "GET /admin/org/{id}/settings/settings",
dependsOnMethods = { "testGetGeneralSettings",
"testGetVAppLeaseSettings",
"testGetVAppTemplateLeaseSettings",
"testGetLdapSettings",
"testGetEmailSettings",
"testGetPasswordPolicy"})
public void testGetSettings() {
settings = orgClient.getSettings(orgRef.getHref());
Checks.checkOrgSettings(settings);
}
@Test(testName = "PUT /admin/org/{id}/settings/settings",
dependsOnMethods = { "testUpdateGeneralSettings",
"testUpdateVAppLeaseSettings",
"testUpdateVAppTemplateLeaseSettings",
"testUpdateEmailSettings",
"testUpdatePasswordPolicy"},
enabled = false )
public void testUpdateSettings() {
try {
newSettings = settings.toBuilder()
.generalSettings(newGeneralSettings)
.vAppLeaseSettings(newVAppLeaseSettings)
.vAppTemplateLeaseSettings(newVAppTemplateLeaseSettings)
.ldapSettings(newLdapSettings)
.emailSettings(newEmailSettings)
.passwordPolicy(newPasswordPolicy)
.build();
settings = orgClient.updateSettings(
orgRef.getHref(), newSettings);
assertTrue(equal(settings.getGeneralSettings(), newGeneralSettings),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "generalSettings"));
assertTrue(equal(settings.getVAppLeaseSettings(), newVAppLeaseSettings),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "vAppLeaseSettings"));
assertTrue(equal(settings.getVAppTemplateLeaseSettings(), newVAppTemplateLeaseSettings),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "vAppTemplateLeaseSettings"));
assertTrue(equal(settings.getLdapSettings(), newLdapSettings),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "ldapSettings"));
assertTrue(equal(settings.getEmailSettings(), newEmailSettings),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "emailSettings"));
assertTrue(equal(settings.getPasswordPolicy(), newPasswordPolicy),
String.format(OBJ_FIELD_UPDATABLE,
"orgSettings", "passwordPolicy"));
//TODO negative tests?
Checks.checkOrgSettings(settings);
} finally {
settings = settings.toBuilder()
.generalSettings(generalSettings)
.vAppLeaseSettings(vAppLeaseSettings)
.vAppTemplateLeaseSettings(vAppTemplateLeaseSettings)
.ldapSettings(ldapSettings)
.emailSettings(emailSettings)
.passwordPolicy(passwordPolicy)
.build();
settings = orgClient.updateSettings(
orgRef.getHref(), settings);
}
}
} }

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgEmailSettings xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="edit" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"/>
<IsDefaultSmtpServer>true</IsDefaultSmtpServer>
<IsDefaultOrgEmail>true</IsDefaultOrgEmail>
<FromEmailAddress/>
<DefaultSubjectPrefix/>
<IsAlertEmailToAllAdmins>true</IsAlertEmailToAllAdmins>
<SmtpServerSettings>
<IsUseAuthentication>false</IsUseAuthentication>
<Host/>
<Username/>
</SmtpServerSettings>
</OrgEmailSettings>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgLdapSettings xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.organizationLdapSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<OrgLdapMode>NONE</OrgLdapMode>
</OrgLdapSettings>

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<AdminOrg xmlns="http://www.vmware.com/vcloud/v1.5" name="JClouds" id="urn:vcloud:org:6f312e42-cd2b-488d-a2bb-97519cd57ed0" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"/>
<Link rel="add" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs"/>
<Link rel="add" type="application/vnd.vmware.admin.user+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/users"/>
<Link rel="add" type="application/vnd.vmware.admin.group+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/groups"/>
<Link rel="add" type="application/vnd.vmware.admin.orgNetwork+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/networks"/>
<Link rel="edit" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
<Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
<Link rel="alternate" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
<Description/>
<FullName>JClouds</FullName>
<IsEnabled>true</IsEnabled>
<Settings type="application/vnd.vmware.admin.orgSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings">
<Link rel="down" type="application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings"/>
<Link rel="down" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"/>
<Link rel="down" type="application/vnd.vmware.admin.vAppLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings"/>
<Link rel="down" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"/>
<Link rel="down" type="application/vnd.vmware.admin.organizationGeneralSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general"/>
<Link rel="down" type="application/vnd.vmware.admin.organizationLdapSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap"/>
<Link rel="edit" type="application/vnd.vmware.admin.orgSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings"/>
<OrgGeneralSettings type="application/vnd.vmware.admin.organizationGeneralSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general">
<Link rel="edit" type="application/vnd.vmware.admin.organizationGeneralSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general"/>
<CanPublishCatalogs>false</CanPublishCatalogs>
<DeployedVMQuota>0</DeployedVMQuota>
<StoredVmQuota>0</StoredVmQuota>
<UseServerBootSequence>false</UseServerBootSequence>
<DelayAfterPowerOnSeconds>0</DelayAfterPowerOnSeconds>
</OrgGeneralSettings>
<VAppLeaseSettings type="application/vnd.vmware.admin.vAppLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings">
<Link rel="edit" type="application/vnd.vmware.admin.vAppLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings"/>
<DeleteOnStorageLeaseExpiration>false</DeleteOnStorageLeaseExpiration>
<DeploymentLeaseSeconds>0</DeploymentLeaseSeconds>
<StorageLeaseSeconds>0</StorageLeaseSeconds>
</VAppLeaseSettings>
<VAppTemplateLeaseSettings type="application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings">
<Link rel="edit" type="application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings"/>
<DeleteOnStorageLeaseExpiration>false</DeleteOnStorageLeaseExpiration>
<StorageLeaseSeconds>0</StorageLeaseSeconds>
</VAppTemplateLeaseSettings>
<OrgLdapSettings type="application/vnd.vmware.admin.organizationLdapSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap">
<OrgLdapMode>NONE</OrgLdapMode>
</OrgLdapSettings>
<OrgEmailSettings type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email">
<Link rel="edit" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"/>
<IsDefaultSmtpServer>true</IsDefaultSmtpServer>
<IsDefaultOrgEmail>true</IsDefaultOrgEmail>
<FromEmailAddress/>
<DefaultSubjectPrefix/>
<IsAlertEmailToAllAdmins>true</IsAlertEmailToAllAdmins>
<SmtpServerSettings>
<IsUseAuthentication>false</IsUseAuthentication>
<Host/>
<Username/>
</SmtpServerSettings>
</OrgEmailSettings>
<OrgPasswordPolicySettings type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy">
<Link rel="edit" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"/>
<AccountLockoutEnabled>false</AccountLockoutEnabled>
<InvalidLoginsBeforeLockout>5</InvalidLoginsBeforeLockout>
<AccountLockoutIntervalMinutes>10</AccountLockoutIntervalMinutes>
</OrgPasswordPolicySettings>
</Settings>
<Users>
<UserReference type="application/vnd.vmware.admin.user+xml" name="adam.lowe@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/672ebb67-d8ff-4201-9c1b-c1be869e526c"/>
<UserReference type="application/vnd.vmware.admin.user+xml" name="adrian@jclouds.org" href="https://vcloudbeta.bluelock.com/api/admin/user/8c360b93-ed25-4c9a-8e24-d48cd9966d93"/>
<UserReference type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
<UserReference type="application/vnd.vmware.admin.user+xml" name="dan@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"/>
<UserReference type="application/vnd.vmware.admin.user+xml" name="adk@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"/>
</Users>
<Groups/>
<Catalogs>
<CatalogReference type="application/vnd.vmware.admin.catalog+xml" name="QunyingTestCatalog" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
<CatalogReference type="application/vnd.vmware.admin.catalog+xml" name="Public" href="https://vcloudbeta.bluelock.com/api/admin/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"/>
<CatalogReference type="application/vnd.vmware.admin.catalog+xml" name="dantest" href="https://vcloudbeta.bluelock.com/api/admin/catalog/b542aff4-9f97-4f51-a126-4330fbf62f02"/>
<CatalogReference type="application/vnd.vmware.admin.catalog+xml" name="test" href="https://vcloudbeta.bluelock.com/api/admin/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"/>
</Catalogs>
<Vdcs>
<Vdc type="application/vnd.vmware.vcloud.vdc+xml" name="Cluster01-JClouds" href="https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07"/>
</Vdcs>
<Networks>
<Network type="application/vnd.vmware.admin.network+xml" name="ilsolation01-Jclouds" href="https://vcloudbeta.bluelock.com/api/admin/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"/>
<Network type="application/vnd.vmware.admin.network+xml" name="internet01-Jclouds" href="https://vcloudbeta.bluelock.com/api/admin/network/55a677cf-ab3f-48ae-b880-fab90421980c"/>
</Networks>
</AdminOrg>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgPasswordPolicySettings xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="edit" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"/>
<AccountLockoutEnabled>false</AccountLockoutEnabled>
<InvalidLoginsBeforeLockout>5</InvalidLoginsBeforeLockout>
<AccountLockoutIntervalMinutes>10</AccountLockoutIntervalMinutes>
</OrgPasswordPolicySettings>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgEmailSettings xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="edit" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"/>
<IsDefaultSmtpServer>false</IsDefaultSmtpServer>
<IsDefaultOrgEmail>false</IsDefaultOrgEmail>
<FromEmailAddress>test@test.com</FromEmailAddress>
<DefaultSubjectPrefix>new</DefaultSubjectPrefix>
<IsAlertEmailToAllAdmins>false</IsAlertEmailToAllAdmins>
<SmtpServerSettings>
<IsUseAuthentication>true</IsUseAuthentication>
<Host>new</Host>
<Username>new</Username>
</SmtpServerSettings>
</OrgEmailSettings>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OrgEmailSettings type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email" xmlns="http://www.vmware.com/vcloud/v1.5">
<Link rel="edit" type="application/vnd.vmware.admin.organizationEmailSettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email"/>
<IsDefaultSmtpServer>false</IsDefaultSmtpServer>
<IsDefaultOrgEmail>false</IsDefaultOrgEmail>
<FromEmailAddress>test@test.com</FromEmailAddress>
<DefaultSubjectPrefix>new</DefaultSubjectPrefix>
<IsAlertEmailToAllAdmins>false</IsAlertEmailToAllAdmins>
<SmtpServerSettings>
<IsUseAuthentication>true</IsUseAuthentication>
<Host>new</Host>
<Username>new</Username>
</SmtpServerSettings>
</OrgEmailSettings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgPasswordPolicySettings xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
<Link rel="edit" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"/>
<AccountLockoutEnabled>true</AccountLockoutEnabled>
<InvalidLoginsBeforeLockout>6</InvalidLoginsBeforeLockout>
<AccountLockoutIntervalMinutes>11</AccountLockoutIntervalMinutes>
</OrgPasswordPolicySettings>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OrgPasswordPolicySettings type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy" xmlns="http://www.vmware.com/vcloud/v1.5">
<Link rel="edit" type="application/vnd.vmware.admin.organizationPasswordPolicySettings+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy"/>
<AccountLockoutEnabled>true</AccountLockoutEnabled>
<InvalidLoginsBeforeLockout>6</InvalidLoginsBeforeLockout>
<AccountLockoutIntervalMinutes>11</AccountLockoutIntervalMinutes>
</OrgPasswordPolicySettings>