mirror of https://github.com/apache/jclouds.git
Implement the Cloudstack 'ISO' API
This commit is contained in:
parent
304dda4823
commit
6482e6f90e
|
@ -26,6 +26,7 @@ import org.jclouds.cloudstack.features.EventAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.FirewallAsyncClient;
|
import org.jclouds.cloudstack.features.FirewallAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
|
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
|
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
|
||||||
|
import org.jclouds.cloudstack.features.IsoAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.LimitAsyncClient;
|
import org.jclouds.cloudstack.features.LimitAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
|
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.NATAsyncClient;
|
import org.jclouds.cloudstack.features.NATAsyncClient;
|
||||||
|
@ -164,4 +165,9 @@ public interface CloudStackAsyncClient {
|
||||||
@Delegate
|
@Delegate
|
||||||
LimitAsyncClient getLimitClient();
|
LimitAsyncClient getLimitClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides asynchronous access to ISOs
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
IsoAsyncClient getIsoClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.jclouds.cloudstack.features.EventClient;
|
||||||
import org.jclouds.cloudstack.features.FirewallClient;
|
import org.jclouds.cloudstack.features.FirewallClient;
|
||||||
import org.jclouds.cloudstack.features.GuestOSClient;
|
import org.jclouds.cloudstack.features.GuestOSClient;
|
||||||
import org.jclouds.cloudstack.features.HypervisorClient;
|
import org.jclouds.cloudstack.features.HypervisorClient;
|
||||||
|
import org.jclouds.cloudstack.features.IsoClient;
|
||||||
import org.jclouds.cloudstack.features.LimitClient;
|
import org.jclouds.cloudstack.features.LimitClient;
|
||||||
import org.jclouds.cloudstack.features.LoadBalancerClient;
|
import org.jclouds.cloudstack.features.LoadBalancerClient;
|
||||||
import org.jclouds.cloudstack.features.NATClient;
|
import org.jclouds.cloudstack.features.NATClient;
|
||||||
|
@ -167,4 +168,9 @@ public interface CloudStackClient {
|
||||||
@Delegate
|
@Delegate
|
||||||
LimitClient getLimitClient();
|
LimitClient getLimitClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to ISOs
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
IsoClient getIsoClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ import org.jclouds.cloudstack.features.GuestOSAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.GuestOSClient;
|
import org.jclouds.cloudstack.features.GuestOSClient;
|
||||||
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
|
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.HypervisorClient;
|
import org.jclouds.cloudstack.features.HypervisorClient;
|
||||||
|
import org.jclouds.cloudstack.features.IsoAsyncClient;
|
||||||
|
import org.jclouds.cloudstack.features.IsoClient;
|
||||||
import org.jclouds.cloudstack.features.LimitAsyncClient;
|
import org.jclouds.cloudstack.features.LimitAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.LimitClient;
|
import org.jclouds.cloudstack.features.LimitClient;
|
||||||
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
|
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
|
||||||
|
@ -101,6 +103,7 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
|
||||||
.put(LimitClient.class, LimitAsyncClient.class)//
|
.put(LimitClient.class, LimitAsyncClient.class)//
|
||||||
.put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)//
|
.put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)//
|
||||||
.put(VMGroupClient.class, VMGroupAsyncClient.class)//
|
.put(VMGroupClient.class, VMGroupAsyncClient.class)//
|
||||||
|
.put(IsoClient.class, IsoAsyncClient.class)//
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public CloudStackRestClientModule() {
|
public CloudStackRestClientModule() {
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.domain;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public enum ExtractMode {
|
||||||
|
|
||||||
|
HTTP_DOWNLOAD, FTP_UPLOAD, UNRECOGNIZED;
|
||||||
|
|
||||||
|
public static ExtractMode fromValue(String format) {
|
||||||
|
try {
|
||||||
|
return valueOf(checkNotNull(format, "format"));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,644 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.domain;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class Iso implements Comparable<Iso> {
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String account;
|
||||||
|
private long accountId;
|
||||||
|
private boolean bootable;
|
||||||
|
private String checksum;
|
||||||
|
private Date created;
|
||||||
|
private boolean crossZones;
|
||||||
|
private String displayText;
|
||||||
|
private String domain;
|
||||||
|
private long domainid;
|
||||||
|
private String format;
|
||||||
|
private long hostId;
|
||||||
|
private String hostName;
|
||||||
|
private String hypervisor;
|
||||||
|
private boolean isExtractable;
|
||||||
|
private boolean isFeatured;
|
||||||
|
private boolean isPublic;
|
||||||
|
private boolean isReady;
|
||||||
|
private long jobId;
|
||||||
|
private String jobStatus;
|
||||||
|
private String name;
|
||||||
|
private long osTypeId;
|
||||||
|
private String osTypeName;
|
||||||
|
private boolean passwordEnabled;
|
||||||
|
private Date removed;
|
||||||
|
private long size;
|
||||||
|
private long sourceTemplateId;
|
||||||
|
private String status;
|
||||||
|
private String templateTag;
|
||||||
|
private String templateType;
|
||||||
|
private long zoneId;
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id the template ID
|
||||||
|
*/
|
||||||
|
public Builder id(long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param account the account name to which the template belongs
|
||||||
|
*/
|
||||||
|
public Builder account(String account) {
|
||||||
|
this.account = account;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accountId the account id to which the template belongs
|
||||||
|
*/
|
||||||
|
public Builder accountId(long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if the ISO is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder bootable(boolean bootable) {
|
||||||
|
this.bootable = bootable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param checksum checksum of the template
|
||||||
|
*/
|
||||||
|
public Builder checksum(String checksum) {
|
||||||
|
this.checksum = checksum;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param created the date this template was created
|
||||||
|
*/
|
||||||
|
public Builder created(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param crossZones true if the template is managed across all Zones, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder crossZones(boolean crossZones) {
|
||||||
|
this.crossZones = crossZones;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayText the template display text
|
||||||
|
*/
|
||||||
|
public Builder displayText(String displayText) {
|
||||||
|
this.displayText = displayText;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domain the name of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public Builder domain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domainid the ID of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public Builder domainid(long domainid) {
|
||||||
|
this.domainid = domainid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param format the format of the template.
|
||||||
|
*/
|
||||||
|
public Builder format(String format) {
|
||||||
|
this.format = format;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hostId the ID of the secondary storage host for the template
|
||||||
|
*/
|
||||||
|
public Builder hostId(long hostId) {
|
||||||
|
this.hostId = hostId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hostName the name of the secondary storage host for the template
|
||||||
|
*/
|
||||||
|
public Builder hostName(String hostName) {
|
||||||
|
this.hostName = hostName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hypervisor the hypervisor on which the template runs
|
||||||
|
*/
|
||||||
|
public Builder hypervisor(String hypervisor) {
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isExtractable true if the template is extractable, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder isExtractable(boolean isExtractable) {
|
||||||
|
this.isExtractable = isExtractable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isFeatured true if this template is a featured template, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder isFeatured(boolean isFeatured) {
|
||||||
|
this.isFeatured = isFeatured;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if this template is a public template, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder isPublic(boolean isPublic) {
|
||||||
|
this.isPublic = isPublic;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isReady true if the template is ready to be deployed from, false otherwise.
|
||||||
|
*/
|
||||||
|
public Builder isReady(boolean isReady) {
|
||||||
|
this.isReady = isReady;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobId shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template
|
||||||
|
*/
|
||||||
|
public Builder jobId(long jobId) {
|
||||||
|
this.jobId = jobId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobStatus shows the current pending asynchronous job status
|
||||||
|
*/
|
||||||
|
public Builder jobStatus(String jobStatus) {
|
||||||
|
this.jobStatus = jobStatus;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the template name
|
||||||
|
*/
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeId the ID of the OS type for this template.
|
||||||
|
*/
|
||||||
|
public Builder osTypeId(long osTypeId) {
|
||||||
|
this.osTypeId = osTypeId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeName the name of the OS type for this template.
|
||||||
|
*/
|
||||||
|
public Builder osTypeName(String osTypeName) {
|
||||||
|
this.osTypeName = osTypeName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param passwordEnabled true if the reset password feature is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder passwordEnabled(boolean passwordEnabled) {
|
||||||
|
this.passwordEnabled = passwordEnabled;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removed the date this template was removed
|
||||||
|
*/
|
||||||
|
public Builder removed(Date removed) {
|
||||||
|
this.removed = removed;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param size the size of the template
|
||||||
|
*/
|
||||||
|
public Builder size(long size) {
|
||||||
|
this.size = size;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sourceTemplateId the template ID of the parent template if present
|
||||||
|
*/
|
||||||
|
public Builder sourceTemplateId(long sourceTemplateId) {
|
||||||
|
this.sourceTemplateId = sourceTemplateId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status the status of the template
|
||||||
|
*/
|
||||||
|
public Builder status(String status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param templateTag the tag of this template
|
||||||
|
*/
|
||||||
|
public Builder templateTag(String templateTag) {
|
||||||
|
this.templateTag = templateTag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param templateType the type of the template
|
||||||
|
*/
|
||||||
|
public Builder templateType(String templateType) {
|
||||||
|
this.templateType = templateType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId the ID of the zone for this template
|
||||||
|
*/
|
||||||
|
public Builder zoneId(long zoneId) {
|
||||||
|
this.zoneId = zoneId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneName the name of the zone for this template
|
||||||
|
*/
|
||||||
|
public Builder zoneName(String zoneName) {
|
||||||
|
this.zoneName = zoneName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String account;
|
||||||
|
@SerializedName("accountid")
|
||||||
|
private long accountId;
|
||||||
|
private boolean bootable;
|
||||||
|
private String checksum;
|
||||||
|
private Date created;
|
||||||
|
private boolean crossZones;
|
||||||
|
@SerializedName("displaytext")
|
||||||
|
private String displayText;
|
||||||
|
private String domain;
|
||||||
|
@SerializedName("domainId")
|
||||||
|
private long domainid;
|
||||||
|
private String format;
|
||||||
|
@SerializedName("hostid")
|
||||||
|
private long hostId;
|
||||||
|
@SerializedName("hostname")
|
||||||
|
private String hostName;
|
||||||
|
@SerializedName("")
|
||||||
|
private String hypervisor;
|
||||||
|
@SerializedName("isextractable")
|
||||||
|
private boolean isExtractable;
|
||||||
|
@SerializedName("isfeatured")
|
||||||
|
private boolean isFeatured;
|
||||||
|
@SerializedName("ispublic")
|
||||||
|
private boolean isPublic;
|
||||||
|
@SerializedName("isready")
|
||||||
|
private boolean isReady;
|
||||||
|
@SerializedName("jobid")
|
||||||
|
private long jobId;
|
||||||
|
@SerializedName("jobstatus")
|
||||||
|
private String jobStatus;
|
||||||
|
private String name;
|
||||||
|
@SerializedName("ostypeid")
|
||||||
|
private long osTypeId;
|
||||||
|
@SerializedName("ostypename")
|
||||||
|
private String osTypeName;
|
||||||
|
@SerializedName("passwordenabled")
|
||||||
|
private boolean passwordEnabled;
|
||||||
|
private Date removed;
|
||||||
|
private long size;
|
||||||
|
@SerializedName("sourcetemplateid")
|
||||||
|
private long sourceTemplateId;
|
||||||
|
private String status;
|
||||||
|
@SerializedName("templatetag")
|
||||||
|
private String templateTag;
|
||||||
|
@SerializedName("templatetype")
|
||||||
|
private String templateType;
|
||||||
|
@SerializedName("zoneid")
|
||||||
|
private long zoneId;
|
||||||
|
@SerializedName("zonename")
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* present only for serializer
|
||||||
|
*/
|
||||||
|
Iso() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the template ID
|
||||||
|
*/
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the account name to which the template belongs
|
||||||
|
*/
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the account id to which the template belongs
|
||||||
|
*/
|
||||||
|
public long getAccountId() {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the ISO is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getBootable() {
|
||||||
|
return bootable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return checksum of the template
|
||||||
|
*/
|
||||||
|
public String getChecksum() {
|
||||||
|
return checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the date this template was created
|
||||||
|
*/
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the template is managed across all Zones, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getCrossZones() {
|
||||||
|
return crossZones;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the template display text
|
||||||
|
*/
|
||||||
|
public String getDisplayText() {
|
||||||
|
return displayText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ID of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public long getDomainid() {
|
||||||
|
return domainid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the format of the template.
|
||||||
|
*/
|
||||||
|
public String getFormat() {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ID of the secondary storage host for the template
|
||||||
|
*/
|
||||||
|
public long getHostId() {
|
||||||
|
return hostId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the secondary storage host for the template
|
||||||
|
*/
|
||||||
|
public String getHostName() {
|
||||||
|
return hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the hypervisor on which the template runs
|
||||||
|
*/
|
||||||
|
public String getHypervisor() {
|
||||||
|
return hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the template is extractable, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getIsExtractable() {
|
||||||
|
return isExtractable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this template is a featured template, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getIsFeatured() {
|
||||||
|
return isFeatured;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this template is a public template, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getIsPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the template is ready to be deployed from, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean getIsReady() {
|
||||||
|
return isReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the template
|
||||||
|
*/
|
||||||
|
public long getJobId() {
|
||||||
|
return jobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return shows the current pending asynchronous job status
|
||||||
|
*/
|
||||||
|
public String getJobStatus() {
|
||||||
|
return jobStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the template name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ID of the OS type for this template.
|
||||||
|
*/
|
||||||
|
public long getOsTypeId() {
|
||||||
|
return osTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the OS type for this template.
|
||||||
|
*/
|
||||||
|
public String getOsTypeName() {
|
||||||
|
return osTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the reset password feature is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getPasswordEnabled() {
|
||||||
|
return passwordEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the date this template was removed
|
||||||
|
*/
|
||||||
|
public Date getRemoved() {
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the size of the template
|
||||||
|
*/
|
||||||
|
public long getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the template ID of the parent template if present
|
||||||
|
*/
|
||||||
|
public long getSourceTemplateId() {
|
||||||
|
return sourceTemplateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status of the template
|
||||||
|
*/
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the tag of this template
|
||||||
|
*/
|
||||||
|
public String getTemplateTag() {
|
||||||
|
return templateTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type of the template
|
||||||
|
*/
|
||||||
|
public String getTemplateType() {
|
||||||
|
return templateType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ID of the zone for this template
|
||||||
|
*/
|
||||||
|
public long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the zone for this template
|
||||||
|
*/
|
||||||
|
public String getZoneName() {
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Iso other) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum IsoFilter {
|
||||||
|
|
||||||
|
featured, self, self_executable, executable, community, UNRECOGNIZED;
|
||||||
|
|
||||||
|
public static IsoFilter fromValue(String format) {
|
||||||
|
try {
|
||||||
|
return valueOf(checkNotNull(format, "format"));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,292 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.domain;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class IsoExtraction implements Comparable<IsoExtraction> {
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private long accountId;
|
||||||
|
private Date created;
|
||||||
|
private long extractId;
|
||||||
|
private ExtractMode extractMode;
|
||||||
|
private String name;
|
||||||
|
private String state;
|
||||||
|
private String status;
|
||||||
|
private String storageType;
|
||||||
|
private int uploadPercentage;
|
||||||
|
private String url;
|
||||||
|
private long zoneId;
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id the id of extracted object
|
||||||
|
*/
|
||||||
|
public Builder id(long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accountId the account id to which the extracted object belongs
|
||||||
|
*/
|
||||||
|
public Builder accountId(long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param created the time and date the object was created
|
||||||
|
*/
|
||||||
|
public Builder created(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param extractId the upload id of extracted object
|
||||||
|
*/
|
||||||
|
public Builder extractId(long extractId) {
|
||||||
|
this.extractId = extractId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param extractMode the mode of extraction - upload or download
|
||||||
|
*/
|
||||||
|
public Builder extractMode(ExtractMode extractMode) {
|
||||||
|
this.extractMode = extractMode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the name of the extracted object
|
||||||
|
*/
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param state the state of the extracted object
|
||||||
|
*/
|
||||||
|
public Builder state(String state) {
|
||||||
|
this.state = state;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param status the status of the extraction
|
||||||
|
*/
|
||||||
|
public Builder status(String status) {
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param storageType type of the storage
|
||||||
|
*/
|
||||||
|
public Builder storageType(String storageType) {
|
||||||
|
this.storageType = storageType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param uploadPercentage the percentage of the entity uploaded to the specified location
|
||||||
|
*/
|
||||||
|
public Builder uploadPercentage(int uploadPercentage) {
|
||||||
|
this.uploadPercentage = uploadPercentage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param url if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded
|
||||||
|
*/
|
||||||
|
public Builder url(String url) {
|
||||||
|
this.url = url;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId zone ID the object was extracted from
|
||||||
|
*/
|
||||||
|
public Builder zoneId(long zoneId) {
|
||||||
|
this.zoneId = zoneId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneName zone name the object was extracted from
|
||||||
|
*/
|
||||||
|
public Builder zoneName(String zoneName) {
|
||||||
|
this.zoneName = zoneName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
@SerializedName("accountid")
|
||||||
|
private long accountId;
|
||||||
|
private Date created;
|
||||||
|
private long extractId;
|
||||||
|
private ExtractMode extractMode;
|
||||||
|
private String name;
|
||||||
|
private String state;
|
||||||
|
private String status;
|
||||||
|
@SerializedName("storagetype")
|
||||||
|
private String storageType;
|
||||||
|
@SerializedName("uploadpercentage")
|
||||||
|
private int uploadPercentage;
|
||||||
|
private String url;
|
||||||
|
@SerializedName("zoneid")
|
||||||
|
private long zoneId;
|
||||||
|
@SerializedName("zonename")
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* present only for serializer
|
||||||
|
*/
|
||||||
|
IsoExtraction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id of extracted object
|
||||||
|
*/
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the account id to which the extracted object belongs
|
||||||
|
*/
|
||||||
|
public long getAccountId() {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the time and date the object was created
|
||||||
|
*/
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the upload id of extracted object
|
||||||
|
*/
|
||||||
|
public long getExtractId() {
|
||||||
|
return extractId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mode of extraction - upload or download
|
||||||
|
*/
|
||||||
|
public ExtractMode getExtractMode() {
|
||||||
|
return extractMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the extracted object
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the state of the extracted object
|
||||||
|
*/
|
||||||
|
public String getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the status of the extraction
|
||||||
|
*/
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return type of the storage
|
||||||
|
*/
|
||||||
|
public String getStorageType() {
|
||||||
|
return storageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the percentage of the entity uploaded to the specified location
|
||||||
|
*/
|
||||||
|
public int getUploadPercentage() {
|
||||||
|
return uploadPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if mode = upload then url of the uploaded entity. if mode = download the url from which the entity can be downloaded
|
||||||
|
*/
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return zone ID the object was extracted from
|
||||||
|
*/
|
||||||
|
public long getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return zone name the object was extracted from
|
||||||
|
*/
|
||||||
|
public String getZoneName() {
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(IsoExtraction other) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.domain;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class IsoPermissions implements Comparable<IsoPermissions> {
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String account;
|
||||||
|
private long domainId;
|
||||||
|
private boolean isPublic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id the template ID
|
||||||
|
*/
|
||||||
|
public Builder id(long id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param account the list of accounts the template is available for
|
||||||
|
*/
|
||||||
|
public Builder account(String account) {
|
||||||
|
this.account = account;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domainId the ID of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public Builder domainId(long domainId) {
|
||||||
|
this.domainId = domainId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if this template is a public template, false otherwise
|
||||||
|
*/
|
||||||
|
public Builder isPublic(boolean isPublic) {
|
||||||
|
this.isPublic = isPublic;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String account;
|
||||||
|
@SerializedName("domainid")
|
||||||
|
private long domainId;
|
||||||
|
@SerializedName("ispublic")
|
||||||
|
private boolean isPublic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* present only for serializer
|
||||||
|
*/
|
||||||
|
IsoPermissions() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the template ID
|
||||||
|
*/
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the list of accounts the template is available for
|
||||||
|
*/
|
||||||
|
public String getAccount() {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the ID of the domain to which the template belongs
|
||||||
|
*/
|
||||||
|
public long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this template is a public template, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getIsPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(IsoPermissions other) {
|
||||||
|
throw new RuntimeException("FIXME: Implement me");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.domain;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public enum PermissionOperation {
|
||||||
|
|
||||||
|
add, remove, reset, UNRECOGNIZED;
|
||||||
|
|
||||||
|
public static PermissionOperation fromValue(String format) {
|
||||||
|
try {
|
||||||
|
return valueOf(checkNotNull(format, "format"));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -233,19 +233,6 @@ public class Template implements Comparable<Template> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ExtractMode {
|
|
||||||
|
|
||||||
HTTP_DOWNLOAD, FTP_UPLOAD, UNRECOGNIZED;
|
|
||||||
|
|
||||||
public static ExtractMode fromValue(String format) {
|
|
||||||
try {
|
|
||||||
return valueOf(checkNotNull(format, "format"));
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return UNRECOGNIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private long id;
|
private long id;
|
||||||
@SerializedName("displaytext")
|
@SerializedName("displaytext")
|
||||||
private String displayText;
|
private String displayText;
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
|
||||||
|
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||||
|
import org.jclouds.cloudstack.domain.Iso;
|
||||||
|
import org.jclouds.cloudstack.domain.IsoPermissions;
|
||||||
|
import org.jclouds.cloudstack.filters.QuerySigner;
|
||||||
|
import org.jclouds.cloudstack.options.AccountInDomainOptions;
|
||||||
|
import org.jclouds.cloudstack.options.DeleteIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ExtractIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ListIsosOptions;
|
||||||
|
import org.jclouds.cloudstack.options.RegisterIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoPermissionsOptions;
|
||||||
|
import org.jclouds.rest.annotations.QueryParams;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.SkipEncoding;
|
||||||
|
import org.jclouds.rest.annotations.Unwrap;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see IsoClient
|
||||||
|
* @see http://download.cloud.com/releases/2.2.12/api/TOC_User.html
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
@RequestFilters(QuerySigner.class)
|
||||||
|
@QueryParams(keys = "response", values = "json")
|
||||||
|
@SkipEncoding({'/', ','})
|
||||||
|
public interface IsoAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches an ISO to a virtual machine.
|
||||||
|
*
|
||||||
|
* @param isoId the ID of the ISO file
|
||||||
|
* @param vmId the ID of the virtual machine
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "attachIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<AsyncCreateResponse> attachIso(@QueryParam("id") long isoId, @QueryParam("virtualmachineid") long vmId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detaches any ISO file (if any) currently attached to a virtual machine.
|
||||||
|
*
|
||||||
|
* @param vmId The ID of the virtual machine
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "detachIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<AsyncCreateResponse> detachIso(@QueryParam("virtualmachineid") long vmId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets information about an ISO by its ID.
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @return the ISO object matching the ID
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "listIsos")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Iso> getIso(@QueryParam("id") long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available ISO files.
|
||||||
|
*
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return a set of ISO objects the match the filter
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "listIsos")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Set<Iso>> listIsos(ListIsosOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an existing ISO into the Cloud.com Cloud.
|
||||||
|
*
|
||||||
|
* @param name the name of the ISO
|
||||||
|
* @param displayText the display text of the ISO. This is usually used for display purposes.
|
||||||
|
* @param url the URL to where the ISO is currently being hosted
|
||||||
|
* @param zoneId the ID of the zone you wish to register the ISO to.
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return the newly-added ISO
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "registerIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Iso> registerIso(@QueryParam("name") String name, @QueryParam("displaytext") String displayText, @QueryParam("url") String url, @QueryParam("zoneid") long zoneId, RegisterIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return the ISO object matching the ID
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "updateIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Iso> updateIso(@QueryParam("id") long id, UpdateIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an ISO file.
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "deleteIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<AsyncCreateResponse> deleteIso(@QueryParam("id") long id, DeleteIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a template from one zone to another.
|
||||||
|
*
|
||||||
|
* @param isoId Template ID.
|
||||||
|
* @param sourceZoneId ID of the zone the template is currently hosted on.
|
||||||
|
* @param destZoneId ID of the zone the template is being copied to.
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "copyIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<AsyncCreateResponse> copyIso(@QueryParam("id") long isoId, @QueryParam("sourcezoneid") long sourceZoneId, @QueryParam("destzoneid") long destZoneId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates iso permissions
|
||||||
|
*
|
||||||
|
* @param id the template ID
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "updateIsoPermissions")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Void> updateIsoPermissions(@QueryParam("id") long id, UpdateIsoPermissionsOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List template visibility and all accounts that have permissions to view this template.
|
||||||
|
*
|
||||||
|
* @param id the template ID
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return A set of the permissions on this ISO
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "listIsoPermissions")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<Set<IsoPermissions>> listIsoPermissions(@QueryParam("id") long id, AccountInDomainOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts an ISO
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param mode the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD
|
||||||
|
* @param zoneId the ID of the zone where the ISO is originally located
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@QueryParams(keys = "command", values = "extractIso")
|
||||||
|
@Unwrap
|
||||||
|
ListenableFuture<AsyncCreateResponse> extractIso(@QueryParam("id") long id, @QueryParam("mode") ExtractMode mode, @QueryParam("zoneid") long zoneId, ExtractIsoOptions... options);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
|
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
|
||||||
|
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||||
|
import org.jclouds.cloudstack.domain.Iso;
|
||||||
|
import org.jclouds.cloudstack.domain.IsoPermissions;
|
||||||
|
import org.jclouds.cloudstack.options.AccountInDomainOptions;
|
||||||
|
import org.jclouds.cloudstack.options.DeleteIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ExtractIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ListIsosOptions;
|
||||||
|
import org.jclouds.cloudstack.options.RegisterIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoPermissionsOptions;
|
||||||
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see IsoAsyncClient
|
||||||
|
* @see http://download.cloud.com/releases/2.2.12/api/TOC_User.html
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||||
|
public interface IsoClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches an ISO to a virtual machine.
|
||||||
|
*
|
||||||
|
* @param isoId the ID of the ISO file
|
||||||
|
* @param vmId the ID of the virtual machine
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
AsyncCreateResponse attachIso(long isoId, long vmId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detaches any ISO file (if any) currently attached to a virtual machine.
|
||||||
|
*
|
||||||
|
* @param vmId The ID of the virtual machine
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
AsyncCreateResponse detachIso(long vmId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets information about an ISO by its ID.
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @return the ISO object matching the ID
|
||||||
|
*/
|
||||||
|
Iso getIso(long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available ISO files.
|
||||||
|
*
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return a set of ISO objects the match the filter
|
||||||
|
*/
|
||||||
|
Set<Iso> listIsos(ListIsosOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an existing ISO into the Cloud.com Cloud.
|
||||||
|
*
|
||||||
|
* @param name the name of the ISO
|
||||||
|
* @param displayText the display text of the ISO. This is usually used for display purposes.
|
||||||
|
* @param url the URL to where the ISO is currently being hosted
|
||||||
|
* @param zoneId the ID of the zone you wish to register the ISO to.
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return the newly-added ISO
|
||||||
|
*/
|
||||||
|
Iso registerIso(String name, String displayText, String url, long zoneId, RegisterIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return the ISO object matching the ID
|
||||||
|
*/
|
||||||
|
Iso updateIso(long id, UpdateIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an ISO file.
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
AsyncCreateResponse deleteIso(long id, DeleteIsoOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a template from one zone to another.
|
||||||
|
*
|
||||||
|
* @param isoId Template ID.
|
||||||
|
* @param sourceZoneId ID of the zone the template is currently hosted on.
|
||||||
|
* @param destZoneId ID of the zone the template is being copied to.
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
AsyncCreateResponse copyIso(long isoId, long sourceZoneId, long destZoneId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates iso permissions
|
||||||
|
*
|
||||||
|
* @param id the template ID
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void updateIsoPermissions(long id, UpdateIsoPermissionsOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List template visibility and all accounts that have permissions to view this template.
|
||||||
|
*
|
||||||
|
* @param id the template ID
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return A set of the permissions on this ISO
|
||||||
|
*/
|
||||||
|
Set<IsoPermissions> listIsoPermissions(long id, AccountInDomainOptions... options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts an ISO
|
||||||
|
*
|
||||||
|
* @param id the ID of the ISO file
|
||||||
|
* @param mode the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD
|
||||||
|
* @param zoneId the ID of the zone where the ISO is originally located
|
||||||
|
* @param options optional arguments
|
||||||
|
* @return an asynchronous job response.
|
||||||
|
*/
|
||||||
|
AsyncCreateResponse extractIso(long id, ExtractMode mode, long zoneId, ExtractIsoOptions... options);
|
||||||
|
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.cloudstack.binders.BindTemplateMetadataToQueryParams;
|
import org.jclouds.cloudstack.binders.BindTemplateMetadataToQueryParams;
|
||||||
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
|
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
|
||||||
|
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||||
import org.jclouds.cloudstack.domain.Template;
|
import org.jclouds.cloudstack.domain.Template;
|
||||||
import org.jclouds.cloudstack.domain.TemplateMetadata;
|
import org.jclouds.cloudstack.domain.TemplateMetadata;
|
||||||
import org.jclouds.cloudstack.domain.TemplatePermission;
|
import org.jclouds.cloudstack.domain.TemplatePermission;
|
||||||
|
@ -164,5 +165,5 @@ public interface TemplateAsyncClient {
|
||||||
@QueryParams(keys = "command", values = "extractTemplate")
|
@QueryParams(keys = "command", values = "extractTemplate")
|
||||||
@Unwrap
|
@Unwrap
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
ListenableFuture<AsyncCreateResponse> extractTemplate(@QueryParam("id") long id, @QueryParam("mode") Template.ExtractMode mode, @QueryParam("zoneid") long zoneId, ExtractTemplateOptions... options);
|
ListenableFuture<AsyncCreateResponse> extractTemplate(@QueryParam("id") long id, @QueryParam("mode") ExtractMode mode, @QueryParam("zoneid") long zoneId, ExtractTemplateOptions... options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso deleteIso method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#deleteIso
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#deleteIso
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class DeleteIsoOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
|
public static final DeleteIsoOptions NONE = new DeleteIsoOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones
|
||||||
|
*/
|
||||||
|
public DeleteIsoOptions zoneId(long zoneId) {
|
||||||
|
this.queryParameters.replaceValues("zoneid", ImmutableSet.of(zoneId + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones
|
||||||
|
*/
|
||||||
|
public static DeleteIsoOptions zoneId(long zoneId) {
|
||||||
|
return new DeleteIsoOptions().zoneId(zoneId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso extractIso method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#extractIso
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#extractIso
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class ExtractIsoOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
|
public static final ExtractIsoOptions NONE = new ExtractIsoOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param url the url to which the ISO would be extracted
|
||||||
|
*/
|
||||||
|
public ExtractIsoOptions url(String url) {
|
||||||
|
this.queryParameters.replaceValues("url", ImmutableSet.of(url + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param url the url to which the ISO would be extracted
|
||||||
|
*/
|
||||||
|
public static ExtractIsoOptions url(String url) {
|
||||||
|
return new ExtractIsoOptions().url(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,188 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.cloudstack.domain.Iso;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso listIsos method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#listIsos
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#listIsos
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class ListIsosOptions extends AccountInDomainOptions {
|
||||||
|
|
||||||
|
public static final ListIsosOptions NONE = new ListIsosOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if the ISO is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public ListIsosOptions bootable(boolean bootable) {
|
||||||
|
this.queryParameters.replaceValues("bootable", ImmutableSet.of(bootable + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hypervisor the hypervisor for which to restrict the search
|
||||||
|
*/
|
||||||
|
public ListIsosOptions hypervisor(String hypervisor) {
|
||||||
|
this.queryParameters.replaceValues("hypervisor", ImmutableSet.of(hypervisor + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id list all isos by id
|
||||||
|
*/
|
||||||
|
public ListIsosOptions id(long id) {
|
||||||
|
this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isoFilter possible values are "featured", "self", "self-executable","executable", and "community".
|
||||||
|
*/
|
||||||
|
public ListIsosOptions isoFilter(Iso.IsoFilter isoFilter) {
|
||||||
|
this.queryParameters.replaceValues("isofilter", ImmutableSet.of(isoFilter + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if the ISO is publicly available to all users, false otherwise.
|
||||||
|
*/
|
||||||
|
public ListIsosOptions isPublic(boolean isPublic) {
|
||||||
|
this.queryParameters.replaceValues("ispublic", ImmutableSet.of(isPublic + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isReady true if this ISO is ready to be deployed
|
||||||
|
*/
|
||||||
|
public ListIsosOptions isReady(boolean isReady) {
|
||||||
|
this.queryParameters.replaceValues("isready", ImmutableSet.of(isReady + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param keyword List by keyword
|
||||||
|
*/
|
||||||
|
public ListIsosOptions keyword(String keyword) {
|
||||||
|
this.queryParameters.replaceValues("keyword", ImmutableSet.of(keyword + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name list all isos by name
|
||||||
|
*/
|
||||||
|
public ListIsosOptions name(String name) {
|
||||||
|
this.queryParameters.replaceValues("name", ImmutableSet.of(name + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId the ID of the zone
|
||||||
|
*/
|
||||||
|
public ListIsosOptions zoneId(long zoneId) {
|
||||||
|
this.queryParameters.replaceValues("zoneid", ImmutableSet.of(zoneId + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param account the account of the ISO file. Must be used with the domainId parameter.
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions accountInDomain(String account, long domainId) {
|
||||||
|
return (ListIsosOptions) new ListIsosOptions().accountInDomain(account, domainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if the ISO is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions bootable(boolean bootable) {
|
||||||
|
return new ListIsosOptions().bootable(bootable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domainId lists all available ISO files by ID of a domain. If used with the account parameter, lists all available ISO files for the account in the ID of a domain.
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions domainId(long domainId) {
|
||||||
|
return (ListIsosOptions) new ListIsosOptions().domainId(domainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param hypervisor the hypervisor for which to restrict the search
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions hypervisor(String hypervisor) {
|
||||||
|
return new ListIsosOptions().hypervisor(hypervisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id list all isos by id
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions id(long id) {
|
||||||
|
return new ListIsosOptions().id(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isoFilter possible values are "featured", "self", "self-executable","executable", and "community".
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions isoFilter(Iso.IsoFilter isoFilter) {
|
||||||
|
return new ListIsosOptions().isoFilter(isoFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if the ISO is publicly available to all users, false otherwise.
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions isPublic(boolean isPublic) {
|
||||||
|
return new ListIsosOptions().isPublic(isPublic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isReady true if this ISO is ready to be deployed
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions isReady(boolean isReady) {
|
||||||
|
return new ListIsosOptions().isReady(isReady);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param keyword List by keyword
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions keyword(String keyword) {
|
||||||
|
return new ListIsosOptions().keyword(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name list all isos by name
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions name(String name) {
|
||||||
|
return new ListIsosOptions().name(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param zoneId the ID of the zone
|
||||||
|
*/
|
||||||
|
public static ListIsosOptions zoneId(long zoneId) {
|
||||||
|
return new ListIsosOptions().zoneId(zoneId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso registerIso method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#registerIso
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#registerIso
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class RegisterIsoOptions extends AccountInDomainOptions {
|
||||||
|
|
||||||
|
public static final RegisterIsoOptions NONE = new RegisterIsoOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if this ISO is bootable
|
||||||
|
*/
|
||||||
|
public RegisterIsoOptions bootable(boolean bootable) {
|
||||||
|
this.queryParameters.replaceValues("bootable", ImmutableSet.of(bootable + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isExtractable true if the iso or its derivatives are extractable; default is false
|
||||||
|
*/
|
||||||
|
public RegisterIsoOptions isExtractable(boolean isExtractable) {
|
||||||
|
this.queryParameters.replaceValues("isextractable", ImmutableSet.of(isExtractable + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isFeatured true if you want this ISO to be featured
|
||||||
|
*/
|
||||||
|
public RegisterIsoOptions isFeatured(boolean isFeatured) {
|
||||||
|
this.queryParameters.replaceValues("isfeatured", ImmutableSet.of(isFeatured + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if you want to register the ISO to be publicly available to all users, false otherwise.
|
||||||
|
*/
|
||||||
|
public RegisterIsoOptions isPublic(boolean isPublic) {
|
||||||
|
this.queryParameters.replaceValues("ispublic", ImmutableSet.of(isPublic + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeId the ID of the OS Type that best represents the OS of this ISO
|
||||||
|
*/
|
||||||
|
public RegisterIsoOptions osTypeId(long osTypeId) {
|
||||||
|
this.queryParameters.replaceValues("ostypeid", ImmutableSet.of(osTypeId + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param account an optional account name. Must be used with domainId.
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions accountInDomain(String account, long domainId) {
|
||||||
|
return (RegisterIsoOptions) new RegisterIsoOptions().accountInDomain(account, domainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if this ISO is bootable
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions bootable(boolean bootable) {
|
||||||
|
return new RegisterIsoOptions().bootable(bootable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param domainId an optional domainId. If the account parameter is used, domainId must also be used.
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions domainId(long domainId) {
|
||||||
|
return (RegisterIsoOptions) new RegisterIsoOptions().domainId(domainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isExtractable true if the iso or its derivatives are extractable; default is false
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions isExtractable(boolean isExtractable) {
|
||||||
|
return new RegisterIsoOptions().isExtractable(isExtractable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isFeatured true if you want this ISO to be featured
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions isFeatured(boolean isFeatured) {
|
||||||
|
return new RegisterIsoOptions().isFeatured(isFeatured);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true if you want to register the ISO to be publicly available to all users, false otherwise.
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions isPublic(boolean isPublic) {
|
||||||
|
return new RegisterIsoOptions().isPublic(isPublic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeId the ID of the OS Type that best represents the OS of this ISO
|
||||||
|
*/
|
||||||
|
public static RegisterIsoOptions osTypeId(long osTypeId) {
|
||||||
|
return new RegisterIsoOptions().osTypeId(osTypeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso updateIso method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#updateIso
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#updateIso
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class UpdateIsoOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
|
public static final UpdateIsoOptions NONE = new UpdateIsoOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if image is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions bootable(boolean bootable) {
|
||||||
|
this.queryParameters.replaceValues("bootable", ImmutableSet.of(bootable + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayText the display text of the image
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions displayText(String displayText) {
|
||||||
|
this.queryParameters.replaceValues("displaytext", ImmutableSet.of(displayText + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param format the format for the image
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions format(String format) {
|
||||||
|
this.queryParameters.replaceValues("format", ImmutableSet.of(format + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the name of the image file
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions name(String name) {
|
||||||
|
this.queryParameters.replaceValues("name", ImmutableSet.of(name + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeId the ID of the OS type that best represents the OS of this image.
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions osTypeId(long osTypeId) {
|
||||||
|
this.queryParameters.replaceValues("ostypeid", ImmutableSet.of(osTypeId + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param passwordEnabled true if the image supports the password reset feature; default is false
|
||||||
|
*/
|
||||||
|
public UpdateIsoOptions passwordEnabled(boolean passwordEnabled) {
|
||||||
|
this.queryParameters.replaceValues("passwordenabled", ImmutableSet.of(passwordEnabled + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bootable true if image is bootable, false otherwise
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions bootable(boolean bootable) {
|
||||||
|
return new UpdateIsoOptions().bootable(bootable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayText the display text of the image
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions displayText(String displayText) {
|
||||||
|
return new UpdateIsoOptions().displayText(displayText);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param format the format for the image
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions format(String format) {
|
||||||
|
return new UpdateIsoOptions().format(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the name of the image file
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions name(String name) {
|
||||||
|
return new UpdateIsoOptions().name(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param osTypeId the ID of the OS type that best represents the OS of this image.
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions osTypeId(long osTypeId) {
|
||||||
|
return new UpdateIsoOptions().osTypeId(osTypeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param passwordEnabled true if the image supports the password reset feature; default is false
|
||||||
|
*/
|
||||||
|
public static UpdateIsoOptions passwordEnabled(boolean passwordEnabled) {
|
||||||
|
return new UpdateIsoOptions().passwordEnabled(passwordEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.options;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.cloudstack.domain.PermissionOperation;
|
||||||
|
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the Iso updateIsoPermissions method.
|
||||||
|
*
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoClient#updateIsoPermissions
|
||||||
|
* @see org.jclouds.cloudstack.features.IsoAsyncClient#updateIsoPermissions
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
public class UpdateIsoPermissionsOptions extends BaseHttpRequestOptions {
|
||||||
|
|
||||||
|
public static final UpdateIsoPermissionsOptions NONE = new UpdateIsoPermissionsOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accounts a comma delimited list of accounts. If specified, "op" parameter has to be passed in.
|
||||||
|
*/
|
||||||
|
public UpdateIsoPermissionsOptions accounts(Iterable<String> accounts) {
|
||||||
|
this.queryParameters.replaceValues("accounts", ImmutableSet.of(Joiner.on(',').join(accounts)));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isExtractable true if the template/iso is extractable, false other wise. Can be set only by root admin
|
||||||
|
*/
|
||||||
|
public UpdateIsoPermissionsOptions isExtractable(boolean isExtractable) {
|
||||||
|
this.queryParameters.replaceValues("isextractable", ImmutableSet.of(isExtractable + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isFeatured true for featured template/iso, false otherwise
|
||||||
|
*/
|
||||||
|
public UpdateIsoPermissionsOptions isFeatured(boolean isFeatured) {
|
||||||
|
this.queryParameters.replaceValues("isfeatured", ImmutableSet.of(isFeatured + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true for public template/iso, false for private templates/isos
|
||||||
|
*/
|
||||||
|
public UpdateIsoPermissionsOptions isPublic(boolean isPublic) {
|
||||||
|
this.queryParameters.replaceValues("ispublic", ImmutableSet.of(isPublic + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param operation permission operator (add, remove, reset)
|
||||||
|
*/
|
||||||
|
public UpdateIsoPermissionsOptions operation(PermissionOperation operation) {
|
||||||
|
this.queryParameters.replaceValues("op", ImmutableSet.of(operation + ""));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param accounts a comma delimited list of accounts. If specified, "op" parameter has to be passed in.
|
||||||
|
*/
|
||||||
|
public static UpdateIsoPermissionsOptions accounts(Iterable<String> accounts) {
|
||||||
|
return new UpdateIsoPermissionsOptions().accounts(accounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isExtractable true if the template/iso is extractable, false other wise. Can be set only by root admin
|
||||||
|
*/
|
||||||
|
public static UpdateIsoPermissionsOptions isExtractable(boolean isExtractable) {
|
||||||
|
return new UpdateIsoPermissionsOptions().isExtractable(isExtractable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isFeatured true for featured template/iso, false otherwise
|
||||||
|
*/
|
||||||
|
public static UpdateIsoPermissionsOptions isFeatured(boolean isFeatured) {
|
||||||
|
return new UpdateIsoPermissionsOptions().isFeatured(isFeatured);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isPublic true for public template/iso, false for private templates/isos
|
||||||
|
*/
|
||||||
|
public static UpdateIsoPermissionsOptions isPublic(boolean isPublic) {
|
||||||
|
return new UpdateIsoPermissionsOptions().isPublic(isPublic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param operation permission operator (add, remove, reset)
|
||||||
|
*/
|
||||||
|
public static UpdateIsoPermissionsOptions operation(PermissionOperation operation) {
|
||||||
|
return new UpdateIsoPermissionsOptions().operation(operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,346 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||||
|
import org.jclouds.cloudstack.domain.Iso;
|
||||||
|
import org.jclouds.cloudstack.domain.PermissionOperation;
|
||||||
|
import org.jclouds.cloudstack.options.AccountInDomainOptions;
|
||||||
|
import org.jclouds.cloudstack.options.DeleteIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ExtractIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.ListIsosOptions;
|
||||||
|
import org.jclouds.cloudstack.options.RegisterIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoOptions;
|
||||||
|
import org.jclouds.cloudstack.options.UpdateIsoPermissionsOptions;
|
||||||
|
import org.jclouds.http.HttpRequest;
|
||||||
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||||
|
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
|
||||||
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
/**
|
||||||
|
* Tests the behaviour of IsoAsyncClient.
|
||||||
|
*
|
||||||
|
* @see IsoAsyncClient
|
||||||
|
* @author Richard Downer
|
||||||
|
*/
|
||||||
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||||
|
// surefire
|
||||||
|
@Test(groups = "unit", testName = "IsoAsyncClientTest")
|
||||||
|
public class IsoAsyncClientTest extends BaseCloudStackAsyncClientTest<IsoAsyncClient> {
|
||||||
|
|
||||||
|
public void testAttachIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("attachIso", long.class, long.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, 5);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=attachIso&id=3&virtualmachineid=5 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDetachIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("detachIso", long.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=detachIso&virtualmachineid=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("getIso", long.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listIsos&id=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListIsos() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("listIsos", ListIsosOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listIsos HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListIsosOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("listIsos", ListIsosOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, ListIsosOptions.Builder.accountInDomain("fred", 5).bootable(true).hypervisor("xen").id(3).isoFilter(Iso.IsoFilter.featured).isPublic(true).isReady(true).keyword("bob").name("bob's iso").zoneId(7));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listIsos&account=fred&domainid=5&bootable=true&hypervisor=xen&id=3&isofilter=featured&ispublic=true&isready=true&keyword=bob&name=bob%27s%20iso&zoneid=7 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRegisterIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("registerIso", String.class, String.class, String.class, long.class, RegisterIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, "bob's iso", "bob's copy of linux", "http://example.com/", 9);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=registerIso&name=bob%27s%20iso&url=http%3A//example.com/&displaytext=bob%27s%20copy%20of%20linux&zoneid=9 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRegisterIsoOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("registerIso", String.class, String.class, String.class, long.class, RegisterIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, "bob's iso", "bob's copy of linux", "http://example.com/", 9, RegisterIsoOptions.Builder.accountInDomain("fred", 5).bootable(true).isExtractable(true).isFeatured(true).isPublic(true).osTypeId(7));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=registerIso&name=bob%27s%20iso&url=http%3A//example.com/&displaytext=bob%27s%20copy%20of%20linux&zoneid=9&account=fred&domainid=5&bootable=true&isextractable=true&isfeatured=true&ispublic=true&ostypeid=7 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("updateIso", long.class, UpdateIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=updateIso&id=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateIsoOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("updateIso", long.class, UpdateIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, UpdateIsoOptions.Builder.bootable(true).displayText("robert").format("format").name("bob").osTypeId(9).passwordEnabled(true));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=updateIso&id=3&bootable=true&displaytext=robert&format=format&name=bob&ostypeid=9&passwordenabled=true HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("deleteIso", long.class, DeleteIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=deleteIso&id=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeleteIsoOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("deleteIso", long.class, DeleteIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, DeleteIsoOptions.Builder.zoneId(5));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=deleteIso&id=3&zoneid=5 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("copyIso", long.class, long.class, long.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, 5, 7);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=copyIso&id=3&destzoneid=7&sourcezoneid=5 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateIsoPermissions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("updateIsoPermissions", long.class, UpdateIsoPermissionsOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=updateIsoPermissions&id=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testUpdateIsoPermissionsOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("updateIsoPermissions", long.class, UpdateIsoPermissionsOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, UpdateIsoPermissionsOptions.Builder.accounts(ImmutableSet.<String>of("fred", "bob")).isExtractable(true).isFeatured(true).isPublic(true).operation(PermissionOperation.add));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=updateIsoPermissions&id=3&accounts=fred,bob&isextractable=true&isfeatured=true&ispublic=true&op=add HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListIsoPermissions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("listIsoPermissions", long.class, AccountInDomainOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listIsoPermissions&id=3 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testListIsoPermissionsOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("listIsoPermissions", long.class, AccountInDomainOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, AccountInDomainOptions.Builder.accountInDomain("fred", 5));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listIsoPermissions&id=3&account=fred&domainid=5 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testExtractIso() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("extractIso", long.class, ExtractMode.class, long.class, ExtractIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=extractIso&id=3&zoneid=5&mode=HTTP_DOWNLOAD HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testExtractIsoOptions() throws NoSuchMethodException {
|
||||||
|
Method method = IsoAsyncClient.class.getMethod("extractIso", long.class, ExtractMode.class, long.class, ExtractIsoOptions[].class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractIsoOptions.Builder.url("http://example.com/"));
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=extractIso&id=3&zoneid=5&mode=HTTP_DOWNLOAD&url=http%3A//example.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TypeLiteral<RestAnnotationProcessor<IsoAsyncClient>> createTypeLiteral() {
|
||||||
|
return new TypeLiteral<RestAnnotationProcessor<IsoAsyncClient>>() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||||
import org.jclouds.cloudstack.domain.Template;
|
import org.jclouds.cloudstack.domain.Template;
|
||||||
import org.jclouds.cloudstack.domain.TemplateFilter;
|
import org.jclouds.cloudstack.domain.TemplateFilter;
|
||||||
import org.jclouds.cloudstack.domain.TemplateMetadata;
|
import org.jclouds.cloudstack.domain.TemplateMetadata;
|
||||||
|
@ -48,8 +49,6 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.base.Functions;
|
import com.google.common.base.Functions;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code TemplateAsyncClient}
|
* Tests behavior of {@code TemplateAsyncClient}
|
||||||
*
|
*
|
||||||
|
@ -315,8 +314,8 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtractTemplate() throws NoSuchMethodException {
|
public void testExtractTemplate() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", long.class, Template.ExtractMode.class, long.class, ExtractTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", long.class, ExtractMode.class, long.class, ExtractTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, Template.ExtractMode.HTTP_DOWNLOAD, 5);
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD HTTP/1.1");
|
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
@ -330,8 +329,8 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", long.class, Template.ExtractMode.class, long.class, ExtractTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", long.class, ExtractMode.class, long.class, ExtractTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, Template.ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/"));
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/"));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD&url=http%3A%2F%2Fexample.com%2F HTTP/1.1");
|
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD&url=http%3A%2F%2Fexample.com%2F HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
|
Loading…
Reference in New Issue