mirror of https://github.com/apache/jclouds.git
Merge pull request #236 from jsonking/695-Terremark
Issue 695: input objects for creating a virtual machine
This commit is contained in:
commit
0b3edf3c1e
|
@ -0,0 +1,181 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.AnonymousResource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LayoutRequest has three variations. Only one of the three variations is permitted in a call:
|
||||||
|
*
|
||||||
|
* 1. Use an existing group.
|
||||||
|
* Group is required and the href attribute on the element is required to identify
|
||||||
|
* the group to use.
|
||||||
|
*
|
||||||
|
* 2. Use a newly created group in an existing row.
|
||||||
|
* Row is required and the href attribute on the element is required to identify
|
||||||
|
* the row in which the new group will be created.
|
||||||
|
* NewGroup is required to provide the required name,
|
||||||
|
* which may not exceed fifty characters,
|
||||||
|
* and to create the group to use.
|
||||||
|
*
|
||||||
|
* 3. Move to a newly created group in a newly created row.
|
||||||
|
* NewRow is required to provide the required name,
|
||||||
|
* which may not exceed fifty characters,
|
||||||
|
* and to create the row in which the new group will be created.
|
||||||
|
* NewGroup is required to provide the required name,
|
||||||
|
* which may not exceed fifty characters,
|
||||||
|
* and to create the group to use.
|
||||||
|
*
|
||||||
|
* <xs:complexType name="LayoutRequest">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class LayoutRequest {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromLayoutRequest(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private AnonymousResource row;
|
||||||
|
private AnonymousResource group;
|
||||||
|
private String newRow;
|
||||||
|
private String newGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see LayoutRequest#getRow
|
||||||
|
*/
|
||||||
|
public Builder row(AnonymousResource row) {
|
||||||
|
this.row = row;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see LayoutRequest#getGroup
|
||||||
|
*/
|
||||||
|
public Builder group(AnonymousResource group) {
|
||||||
|
this.group = group;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see LayoutRequest#getNewRow
|
||||||
|
*/
|
||||||
|
public Builder newRow(String newRow) {
|
||||||
|
this.newRow = newRow;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see LayoutRequest#getNewGroup
|
||||||
|
*/
|
||||||
|
public Builder newGroup(String newGroup) {
|
||||||
|
this.newGroup = newGroup;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayoutRequest build() {
|
||||||
|
return new LayoutRequest(row, group, newRow, newGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromLayoutRequest(LayoutRequest in) {
|
||||||
|
return row(in.getRow()).group(in.getGroup()).newRow(in.getNewRow()).newGroup(in.getNewGroup());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Row", required = false)
|
||||||
|
private AnonymousResource row;
|
||||||
|
|
||||||
|
@XmlElement(name = "Group", required = false)
|
||||||
|
private AnonymousResource group;
|
||||||
|
|
||||||
|
@XmlElement(name = "NewRow", required = false)
|
||||||
|
private String newRow;
|
||||||
|
|
||||||
|
@XmlElement(name = "NewGroup", required = false)
|
||||||
|
private String newGroup;
|
||||||
|
|
||||||
|
|
||||||
|
private LayoutRequest(@Nullable AnonymousResource row, @Nullable AnonymousResource group, @Nullable String newRow, @Nullable String newGroup) {
|
||||||
|
this.row = row;
|
||||||
|
this.group = group;
|
||||||
|
this.newRow = newRow;
|
||||||
|
this.newGroup = newGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LayoutRequest() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnonymousResource getRow() {
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnonymousResource getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewRow() {
|
||||||
|
return newRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewGroup() {
|
||||||
|
return newGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
LayoutRequest that = (LayoutRequest) o;
|
||||||
|
|
||||||
|
if (group != null ? !group.equals(that.group) : that.group != null)
|
||||||
|
return false;
|
||||||
|
if (newGroup != null ? !newGroup.equals(that.newGroup) : that.newGroup != null)
|
||||||
|
return false;
|
||||||
|
if (newRow != null ? !newRow.equals(that.newRow) : that.newRow != null)
|
||||||
|
return false;
|
||||||
|
if (row != null ? !row.equals(that.row) : that.row != null) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = row != null ? row.hashCode() : 0;
|
||||||
|
result = 31 * result + (group != null ? group.hashCode() : 0);
|
||||||
|
result = 31 * result + (newRow != null ? newRow.hashCode() : 0);
|
||||||
|
result = 31 * result + (newGroup != null ? newGroup.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "row="+row+", group="+group+", newRow="+newRow+", newGroup="+newGroup;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="DnsSettingsType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class DnsSettings {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromDnsSettings(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private String primaryDns;
|
||||||
|
private String secondaryDns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.DnsSettings#getPrimaryDns
|
||||||
|
*/
|
||||||
|
public Builder primaryDns(String primaryDns) {
|
||||||
|
this.primaryDns = primaryDns;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.DnsSettings#getSecondaryDns
|
||||||
|
*/
|
||||||
|
public Builder secondaryDns(String secondaryDns) {
|
||||||
|
this.secondaryDns = secondaryDns;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DnsSettings build() {
|
||||||
|
return new DnsSettings(primaryDns, secondaryDns);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromDnsSettings(DnsSettings in) {
|
||||||
|
return primaryDns(in.getPrimaryDns()).secondaryDns(in.getSecondaryDns());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "PrimaryDns", required = false)
|
||||||
|
private String primaryDns;
|
||||||
|
|
||||||
|
@XmlElement(name = "SecondaryDns", required = false)
|
||||||
|
private String secondaryDns;
|
||||||
|
|
||||||
|
public DnsSettings(@Nullable String primaryDns, @Nullable String secondaryDns) {
|
||||||
|
this.primaryDns = primaryDns;
|
||||||
|
this.secondaryDns = secondaryDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DnsSettings() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getPrimaryDns() {
|
||||||
|
return primaryDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getSecondaryDns() {
|
||||||
|
return secondaryDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
DnsSettings that = (DnsSettings) o;
|
||||||
|
|
||||||
|
if (primaryDns != null ? !primaryDns.equals(that.primaryDns) : that.primaryDns != null)
|
||||||
|
return false;
|
||||||
|
if (secondaryDns != null ? !secondaryDns.equals(that.secondaryDns) : that.secondaryDns != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = primaryDns != null ? primaryDns.hashCode() : 0;
|
||||||
|
result = 31 * result + (secondaryDns != null ? secondaryDns.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[primaryDns="+ primaryDns +",secondaryDns="+ secondaryDns +"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.AnonymousResource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="LinuxCustomizationType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class LinuxCustomization {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromLinuxCustomization(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private NetworkSettings networkSettings;
|
||||||
|
private AnonymousResource sshKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.LinuxCustomization#getNetworkSettings
|
||||||
|
*/
|
||||||
|
public Builder networkSettings(NetworkSettings networkSettings) {
|
||||||
|
this.networkSettings = networkSettings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.LinuxCustomization#getSshKey
|
||||||
|
*/
|
||||||
|
public Builder sshKey(AnonymousResource sshKey) {
|
||||||
|
this.sshKey = sshKey;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinuxCustomization build() {
|
||||||
|
return new LinuxCustomization(networkSettings, sshKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromLinuxCustomization(LinuxCustomization in) {
|
||||||
|
return networkSettings(in.getNetworkSettings()).sshKey(in.getSshKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "NetworkSettings", required = false)
|
||||||
|
private NetworkSettings networkSettings;
|
||||||
|
|
||||||
|
@XmlElement(name = "SshKey", required = false)
|
||||||
|
private AnonymousResource sshKey;
|
||||||
|
|
||||||
|
public LinuxCustomization(@Nullable NetworkSettings networkSettings, @Nullable AnonymousResource sshKey) {
|
||||||
|
this.networkSettings = networkSettings;
|
||||||
|
this.sshKey = sshKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinuxCustomization() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkSettings getNetworkSettings() {
|
||||||
|
return networkSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnonymousResource getSshKey() {
|
||||||
|
return sshKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
LinuxCustomization that = (LinuxCustomization) o;
|
||||||
|
|
||||||
|
if (networkSettings != null ? !networkSettings.equals(that.networkSettings) : that.networkSettings != null)
|
||||||
|
return false;
|
||||||
|
if (sshKey != null ? !sshKey.equals(that.sshKey) : that.sshKey != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = networkSettings != null ? networkSettings.hashCode() : 0;
|
||||||
|
result = 31 * result + (sshKey != null ? sshKey.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[networkSettings="+ networkSettings +",sshKey="+ sshKey +"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="NetworkAdapterSettingType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class NetworkAdapterSetting {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromNetworkAdapterSetting(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private NamedResource network;
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getNetwork
|
||||||
|
*/
|
||||||
|
public Builder network(NamedResource network) {
|
||||||
|
this.network = network;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getIpAddress
|
||||||
|
*/
|
||||||
|
public Builder ipAddress(String ipAddress) {
|
||||||
|
this.ipAddress = ipAddress;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkAdapterSetting build() {
|
||||||
|
return new NetworkAdapterSetting(ipAddress, network);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromNetworkAdapterSetting(NetworkAdapterSetting in) {
|
||||||
|
return ipAddress(in.getIpAddress()).network(in.getNetwork());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Network", required = false)
|
||||||
|
private NamedResource network;
|
||||||
|
|
||||||
|
@XmlElement(name = "IpAddress", required = false)
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
public NetworkAdapterSetting(@Nullable String ipAddress, @Nullable NamedResource network) {
|
||||||
|
this.ipAddress = ipAddress;
|
||||||
|
this.network = network;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NetworkAdapterSetting() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getIpAddress() {
|
||||||
|
return ipAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public NamedResource getNetwork() {
|
||||||
|
return network;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
NetworkAdapterSetting that = (NetworkAdapterSetting) o;
|
||||||
|
|
||||||
|
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null)
|
||||||
|
return false;
|
||||||
|
if (network != null ? !network.equals(that.network) : that.network != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = network != null ? network.hashCode() : 0;
|
||||||
|
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[ipAddress="+ ipAddress +",network="+ network +"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="NetworkAdapterSettingsType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class NetworkAdapterSettings {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromNetworkAdapterSettings(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private Set<NetworkAdapterSetting> adapters = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSettings#getNetworkAdapterSettings()
|
||||||
|
*/
|
||||||
|
public Builder adapters(Set<NetworkAdapterSetting> adapters) {
|
||||||
|
this.adapters = Sets.newLinkedHashSet(checkNotNull(adapters, "adapters"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder addNetworkAdapterSetting(NetworkAdapterSetting adapter) {
|
||||||
|
adapters.add(checkNotNull(adapter, "adapter"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkAdapterSettings build() {
|
||||||
|
return new NetworkAdapterSettings(adapters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromNetworkAdapterSettings(NetworkAdapterSettings in) {
|
||||||
|
return adapters(in.getNetworkAdapterSettings());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private NetworkAdapterSettings() {
|
||||||
|
//For JAXB and builder use
|
||||||
|
}
|
||||||
|
|
||||||
|
private NetworkAdapterSettings(Set<NetworkAdapterSetting> adapters) {
|
||||||
|
this.adapters = Sets.newLinkedHashSet(adapters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "NetworkAdapter")
|
||||||
|
private Set<NetworkAdapterSetting> adapters = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
public Set<NetworkAdapterSetting> getNetworkAdapterSettings() {
|
||||||
|
return Collections.unmodifiableSet(adapters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
NetworkAdapterSettings that = (NetworkAdapterSettings) o;
|
||||||
|
|
||||||
|
if (!adapters.equals(that.adapters)) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return adapters.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "["+ adapters.toString()+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="NetworkSettingsType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class NetworkSettings {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromNetworkAdapterSetting(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private NetworkAdapterSettings networkAdapterSettings;
|
||||||
|
private DnsSettings dnsSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkSettings#getNetworkAdapterSettings
|
||||||
|
*/
|
||||||
|
public Builder networkAdapterSettings(NetworkAdapterSettings networkAdapterSettings) {
|
||||||
|
this.networkAdapterSettings = networkAdapterSettings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkSettings#getDnsSettings
|
||||||
|
*/
|
||||||
|
public Builder dnsSettings(DnsSettings dnsSettings) {
|
||||||
|
this.dnsSettings = dnsSettings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkSettings build() {
|
||||||
|
return new NetworkSettings(networkAdapterSettings, dnsSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromNetworkAdapterSetting(NetworkSettings in) {
|
||||||
|
return networkAdapterSettings(in.getNetworkAdapterSettings()).dnsSettings(in.getDnsSettings());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "NetworkAdapterSettings", required = false)
|
||||||
|
private NetworkAdapterSettings networkAdapterSettings;
|
||||||
|
|
||||||
|
@XmlElement(name = "DnsSettings", required = false)
|
||||||
|
private DnsSettings dnsSettings;
|
||||||
|
|
||||||
|
public NetworkSettings(@Nullable NetworkAdapterSettings networkAdapterSettings, @Nullable DnsSettings dnsSettings) {
|
||||||
|
this.networkAdapterSettings = networkAdapterSettings;
|
||||||
|
this.dnsSettings = dnsSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NetworkSettings() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkAdapterSettings getNetworkAdapterSettings() {
|
||||||
|
return networkAdapterSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DnsSettings getDnsSettings() {
|
||||||
|
return dnsSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
NetworkSettings that = (NetworkSettings) o;
|
||||||
|
|
||||||
|
if (dnsSettings != null ? !dnsSettings.equals(that.dnsSettings) : that.dnsSettings != null)
|
||||||
|
return false;
|
||||||
|
if (networkAdapterSettings != null ? !networkAdapterSettings.equals(that.networkAdapterSettings) : that.networkAdapterSettings != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = networkAdapterSettings != null ? networkAdapterSettings.hashCode() : 0;
|
||||||
|
result = 31 * result + (dnsSettings != null ? dnsSettings.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[networkAdapterSettings="+ networkAdapterSettings +",dnsSettings="+ dnsSettings +"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.network;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="WindowsCustomizationType">
|
||||||
|
* @author Jason King
|
||||||
|
*/
|
||||||
|
public class WindowsCustomization {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromLinuxCustomization(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private NetworkSettings networkSettings;
|
||||||
|
private String password;
|
||||||
|
private String licenseKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getNetworkSettings
|
||||||
|
*/
|
||||||
|
public Builder networkSettings(NetworkSettings networkSettings) {
|
||||||
|
this.networkSettings = networkSettings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getPassword
|
||||||
|
*/
|
||||||
|
public Builder password(String password) {
|
||||||
|
this.password = password;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization#getLicenseKey
|
||||||
|
*/
|
||||||
|
public Builder licenseKey(String licenseKey) {
|
||||||
|
this.licenseKey = licenseKey;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WindowsCustomization build() {
|
||||||
|
return new WindowsCustomization(networkSettings, password, licenseKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromLinuxCustomization(WindowsCustomization in) {
|
||||||
|
return networkSettings(in.getNetworkSettings()).password(in.getPassword()).licenseKey(in.getLicenseKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "NetworkSettings", required = false)
|
||||||
|
private NetworkSettings networkSettings;
|
||||||
|
|
||||||
|
@XmlElement(name = "Password", required = false)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@XmlElement(name = "LicenseKey", required = false)
|
||||||
|
private String licenseKey;
|
||||||
|
|
||||||
|
public WindowsCustomization(@Nullable NetworkSettings networkSettings, @Nullable String password, @Nullable String licenseKey) {
|
||||||
|
this.networkSettings = networkSettings;
|
||||||
|
this.password = password;
|
||||||
|
this.licenseKey = licenseKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
private WindowsCustomization() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetworkSettings getNetworkSettings() {
|
||||||
|
return networkSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicenseKey() {
|
||||||
|
return licenseKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
WindowsCustomization that = (WindowsCustomization) o;
|
||||||
|
|
||||||
|
if (licenseKey != null ? !licenseKey.equals(that.licenseKey) : that.licenseKey != null)
|
||||||
|
return false;
|
||||||
|
if (networkSettings != null ? !networkSettings.equals(that.networkSettings) : that.networkSettings != null)
|
||||||
|
return false;
|
||||||
|
if (password != null ? !password.equals(that.password) : that.password != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = networkSettings != null ? networkSettings.hashCode() : 0;
|
||||||
|
result = 31 * result + (password != null ? password.hashCode() : 0);
|
||||||
|
result = 31 * result + (licenseKey != null ? licenseKey.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final String pw = password==null ? null : "*******";
|
||||||
|
final String lic = licenseKey==null ? null : "*******";
|
||||||
|
return "[networkSettings="+networkSettings+",password="+pw+",licenseKey="+lic+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,207 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.vm;
|
||||||
|
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.LayoutRequest;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.network.LinuxCustomization;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.network.WindowsCustomization;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="CreateOsTemplateVirtualMachineRequestType">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "CreateVirtualMachineRequest")
|
||||||
|
public class CreateOsTemplateVirtualMachineRequest extends CreateVirtualMachineRequest {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromCreateOsTemplateVirtualMachineRequest(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder extends CreateVirtualMachineRequest.Builder<CreateOsTemplateVirtualMachineRequest> {
|
||||||
|
|
||||||
|
private LinuxCustomization linuxCustomization;
|
||||||
|
private WindowsCustomization windowsCustomization;
|
||||||
|
private boolean poweredOn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.vm.CreateOsTemplateVirtualMachineRequest#getLinuxCustomization
|
||||||
|
*/
|
||||||
|
public Builder linuxCustomization(LinuxCustomization linuxCustomization) {
|
||||||
|
this.linuxCustomization = linuxCustomization;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.vm.CreateOsTemplateVirtualMachineRequest#getWindowsCustomization
|
||||||
|
*/
|
||||||
|
public Builder windowsCustomization(WindowsCustomization windowsCustomization) {
|
||||||
|
this.windowsCustomization = windowsCustomization;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.jclouds.tmrk.enterprisecloud.domain.vm.CreateOsTemplateVirtualMachineRequest#isPoweredOn
|
||||||
|
*/
|
||||||
|
public Builder poweredOn(boolean poweredOn) {
|
||||||
|
this.poweredOn = poweredOn;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getName()
|
||||||
|
*/
|
||||||
|
public Builder name(String name) {
|
||||||
|
return Builder.class.cast(super.name(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getDescription()
|
||||||
|
*/
|
||||||
|
public Builder description(String description) {
|
||||||
|
return Builder.class.cast(super.description(description));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getProcessorCount()
|
||||||
|
*/
|
||||||
|
public Builder processorCount(int processorCount) {
|
||||||
|
return Builder.class.cast(super.processorCount(processorCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getMemory()
|
||||||
|
*/
|
||||||
|
public Builder memory(ResourceCapacity memory) {
|
||||||
|
return Builder.class.cast(super.memory(memory));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getLayout()
|
||||||
|
*/
|
||||||
|
public Builder layout(LayoutRequest layout) {
|
||||||
|
return Builder.class.cast(super.layout(layout));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getTags()
|
||||||
|
*/
|
||||||
|
public Builder tags(Set<String> tags) {
|
||||||
|
return Builder.class.cast(super.tags(tags));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromCreateVirtualMachineRequest(CreateVirtualMachineRequest request) {
|
||||||
|
return Builder.class.cast(super.fromCreateVirtualMachineRequest(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CreateOsTemplateVirtualMachineRequest build() {
|
||||||
|
return new CreateOsTemplateVirtualMachineRequest(name, processorCount,memory,
|
||||||
|
description,layout,tags,
|
||||||
|
linuxCustomization,windowsCustomization,poweredOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromCreateOsTemplateVirtualMachineRequest(CreateOsTemplateVirtualMachineRequest in) {
|
||||||
|
return fromCreateVirtualMachineRequest(in)
|
||||||
|
.linuxCustomization(in.getLinuxCustomization())
|
||||||
|
.windowsCustomization(in.getWindowsCustomization())
|
||||||
|
.poweredOn(in.isPoweredOn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LinuxCustomization", required = false)
|
||||||
|
private LinuxCustomization linuxCustomization;
|
||||||
|
|
||||||
|
@XmlElement(name = "WindowsCustomization", required = false)
|
||||||
|
private WindowsCustomization windowsCustomization;
|
||||||
|
|
||||||
|
@XmlElement(name = "PoweredOn", required = false)
|
||||||
|
private boolean poweredOn;
|
||||||
|
|
||||||
|
|
||||||
|
private CreateOsTemplateVirtualMachineRequest(String name, int processorCount, ResourceCapacity memory,
|
||||||
|
@Nullable String description,@Nullable LayoutRequest layout,@Nullable Set<String> tags,
|
||||||
|
@Nullable LinuxCustomization linuxCustomization, @Nullable WindowsCustomization windowsCustomization, boolean poweredOn) {
|
||||||
|
super(name,processorCount,memory,description,layout,tags);
|
||||||
|
this.linuxCustomization = linuxCustomization;
|
||||||
|
this.windowsCustomization = windowsCustomization;
|
||||||
|
this.poweredOn = poweredOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CreateOsTemplateVirtualMachineRequest() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinuxCustomization getLinuxCustomization() {
|
||||||
|
return linuxCustomization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WindowsCustomization getWindowsCustomization() {
|
||||||
|
return windowsCustomization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPoweredOn() {
|
||||||
|
return poweredOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
CreateOsTemplateVirtualMachineRequest that = (CreateOsTemplateVirtualMachineRequest) o;
|
||||||
|
|
||||||
|
if (poweredOn != that.poweredOn) return false;
|
||||||
|
if (linuxCustomization != null ? !linuxCustomization.equals(that.linuxCustomization) : that.linuxCustomization != null)
|
||||||
|
return false;
|
||||||
|
if (windowsCustomization != null ? !windowsCustomization.equals(that.windowsCustomization) : that.windowsCustomization != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = linuxCustomization != null ? linuxCustomization.hashCode() : 0;
|
||||||
|
result = 31 * result + (windowsCustomization != null ? windowsCustomization.hashCode() : 0);
|
||||||
|
result = 31 * result + (poweredOn ? 1 : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String string() {
|
||||||
|
return super.string()+", linuxCustomization="+linuxCustomization+", windowsCustomization="+windowsCustomization+", poweredOn="+poweredOn;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,182 @@
|
||||||
|
/**
|
||||||
|
* 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.tmrk.enterprisecloud.domain.vm;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.LayoutRequest;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <xs:complexType name="CreateVirtualMachineRequestType">
|
||||||
|
* @author Jason King
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CreateVirtualMachineRequest<T extends CreateVirtualMachineRequest<T>> {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder toBuilder() {
|
||||||
|
return new Builder().fromCreateVirtualMachineRequest(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<T extends CreateVirtualMachineRequest> {
|
||||||
|
|
||||||
|
protected String name;
|
||||||
|
protected String description;
|
||||||
|
protected int processorCount;
|
||||||
|
protected ResourceCapacity memory;
|
||||||
|
protected LayoutRequest layout;
|
||||||
|
protected Set<String> tags = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getName()
|
||||||
|
*/
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getDescription()
|
||||||
|
*/
|
||||||
|
public Builder description(String description) {
|
||||||
|
this.description = description;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getProcessorCount()
|
||||||
|
*/
|
||||||
|
public Builder processorCount(int processorCount) {
|
||||||
|
this.processorCount = processorCount;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getMemory()
|
||||||
|
*/
|
||||||
|
public Builder memory(ResourceCapacity memory) {
|
||||||
|
this.memory = memory;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getLayout()
|
||||||
|
*/
|
||||||
|
public Builder layout(LayoutRequest layout) {
|
||||||
|
this.layout = layout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CreateVirtualMachineRequest#getTags()
|
||||||
|
*/
|
||||||
|
public Builder tags(Set<String> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateVirtualMachineRequest build() {
|
||||||
|
return new CreateVirtualMachineRequest(name,processorCount,memory,description,layout,tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder fromCreateVirtualMachineRequest(CreateVirtualMachineRequest in) {
|
||||||
|
return name(in.getName())
|
||||||
|
.processorCount(in.getProcessorCount())
|
||||||
|
.memory(in.getMemory())
|
||||||
|
.description(in.getDescription())
|
||||||
|
.layout(in.getLayout())
|
||||||
|
.tags(in.getTags());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "name", required = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@XmlElement(name = "ProcessorCount", required = true)
|
||||||
|
private int processorCount;
|
||||||
|
|
||||||
|
@XmlElement(name = "Memory", required = true) //Docs/Schema are contradictory - required
|
||||||
|
private ResourceCapacity memory;
|
||||||
|
|
||||||
|
@XmlElement(name = "Layout", required = true) //Docs/Schema are contradictory - required
|
||||||
|
private LayoutRequest layout;
|
||||||
|
|
||||||
|
@XmlElement(name = "Description", required = false)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@XmlElement(name = "Tags", required = true) //Might need empty element
|
||||||
|
private Set<String> tags = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
protected CreateVirtualMachineRequest(String name, int processorCount, ResourceCapacity memory,
|
||||||
|
@Nullable String description,@Nullable LayoutRequest layout,@Nullable Set<String> tags) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.processorCount = processorCount;
|
||||||
|
this.memory = memory;
|
||||||
|
this.layout = layout;
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CreateVirtualMachineRequest() {
|
||||||
|
//For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProcessorCount() {
|
||||||
|
return processorCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceCapacity getMemory() {
|
||||||
|
return memory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayoutRequest getLayout() {
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getTags() {
|
||||||
|
return Collections.unmodifiableSet(tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("[%s]",string());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String string() {
|
||||||
|
return "name="+name+", description="+description+", processorCount="+processorCount+", memory="+memory+", layout="+layout+", tags="+tags;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue