mirror of https://github.com/apache/jclouds.git
merge
This commit is contained in:
parent
1a9f49bce7
commit
a2d74a25f3
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp-au</artifactId>
|
||||
<name>jclouds Fujitsu Global Cloud Platform AU provider</name>
|
||||
<description>jclouds components to access Fujitsu Global Cloud Platform in Australia</description>
|
||||
<url>http://globalcloud.fujitsu.com.au</url>
|
||||
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Dies Koper</name>
|
||||
<id>dkoper</id>
|
||||
<email>diesk -at- fast -dot- au -dot- fujitsu -dot- com</email>
|
||||
<organization>Fujitsu</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
<timezone>+10</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<test.fgcp-au.endpoint>https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint</test.fgcp-au.endpoint>
|
||||
<test.fgcp-au.apiversion>2011-01-31</test.fgcp-au.apiversion>
|
||||
<test.fgcp-au.build-version></test.fgcp-au.build-version>
|
||||
<test.fgcp-au.identity>fgcp-id</test.fgcp-au.identity>
|
||||
<test.fgcp-au.credential>fgcp-cred</test.fgcp-au.credential>
|
||||
<test.fgcp-au.image-id />
|
||||
<test.fgcp-au.image.login-user />
|
||||
<test.fgcp-au.image.authenticate-sudo />
|
||||
<jclouds.osgi.export>org.jclouds.fujitsu.fgcp*;version="${project.version}"</jclouds.osgi.export>
|
||||
<jclouds.osgi.import>
|
||||
org.jclouds.providers*;version="${project.version}",
|
||||
*
|
||||
</jclouds.osgi.import>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.jclouds.provider</groupId>-->
|
||||
<!--<artifactId>fgcp</artifactId>-->
|
||||
<!--<version>${project.version}</version>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>live</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.fgcp-au.identity>${test.fgcp-au.identity}</test.fgcp-au.identity>
|
||||
<test.fgcp-au.credential>${test.fgcp-au.credential}</test.fgcp-au.credential>
|
||||
<test.fgcp-au.endpoint>${test.fgcp-au.endpoint}</test.fgcp-au.endpoint>
|
||||
<test.fgcp-au.apiversion>${test.fgcp-au.apiversion}</test.fgcp-au.apiversion>
|
||||
<test.fgcp-au.build-version>${test.fgcp-au.build-version}</test.fgcp-au.build-version>
|
||||
<test.fgcp-au.image-id>${test.fgcp-au.image-id}</test.fgcp-au.image-id>
|
||||
<test.fgcp-au.image.login-user>${test.fgcp-au.image.login-user}</test.fgcp-au.image.login-user>
|
||||
<test.fgcp-au.image.authenticate-sudo>${test.fgcp-au.image.authenticate-sudo}</test.fgcp-au.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.providers.internal.BaseProviderMetadata;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.jclouds.providers.ProviderMetadata} for FGCP.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPAUProviderMetadata extends FGCPProviderMetadata {
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public FGCPAUProviderMetadata() {
|
||||
super(builder());
|
||||
}
|
||||
|
||||
public FGCPAUProviderMetadata(Builder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return builder().fromProviderMetadata(this);
|
||||
}
|
||||
|
||||
public static class Builder extends BaseProviderMetadata.Builder {
|
||||
|
||||
protected Builder() {
|
||||
id("fgcp-au")
|
||||
.name("Fujitsu Global Cloud Platform (FGCP) - AU")
|
||||
.apiMetadata(new FGCPApiMetadata())
|
||||
.homepage(
|
||||
URI.create("http://www.fujitsu.com/global/solutions/cloud/solutions/global-cloud-platform/index.html"))
|
||||
.console(URI.create("http://globalcloud.fujitsu.com.au"))
|
||||
.defaultProperties(FGCPApiMetadata.defaultProperties())
|
||||
.iso3166Codes("AU-NSW")
|
||||
.endpoint(
|
||||
"https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint")
|
||||
.defaultProperties(FGCPProviderMetadata.defaultProperties());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FGCPAUProviderMetadata build() {
|
||||
return new FGCPAUProviderMetadata(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromProviderMetadata(ProviderMetadata in) {
|
||||
super.fromProviderMetadata(in);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.jclouds.fujitsu.fgcp.FGCPAUProviderMetadata
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Test(groups = "unit", testName = "FGCPAUProviderTest")
|
||||
public class FGCPAUProviderTest extends BaseProviderMetadataTest {
|
||||
|
||||
public FGCPAUProviderTest() {
|
||||
super(new FGCPAUProviderMetadata(), new FGCPApiMetadata());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "FGCPAUTemplateBuilderLiveTest")
|
||||
public class FGCPAUTemplateBuilderLiveTest extends
|
||||
FGCPBaseTemplateBuilderLiveTest {
|
||||
|
||||
public FGCPAUTemplateBuilderLiveTest() {
|
||||
provider = "fgcp-au";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getIso3166Codes() {
|
||||
return ImmutableSet.<String> of("AU-NSW");
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.compute.config;
|
||||
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "FGCPAUComputeServiceLiveTest")
|
||||
public class FGCPAUComputeServiceLiveTest extends FGCPBaseComputeServiceLiveTest {
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
provider = "fgcp-au";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp-de</artifactId>
|
||||
<name>jclouds Fujitsu Global Cloud Platform DE provider</name>
|
||||
<description>jclouds components to access Fujitsu Global Cloud Platform in Germany</description>
|
||||
<url>http://globalcloud.de.fujitsu.com</url>
|
||||
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Dies Koper</name>
|
||||
<id>dkoper</id>
|
||||
<email>diesk -at- fast -dot- au -dot- fujitsu -dot- com</email>
|
||||
<organization>Fujitsu</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
<timezone>+10</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<test.fgcp-de.endpoint>https://api.globalcloud.de.fujitsu.com/ovissapi/endpoint</test.fgcp-de.endpoint>
|
||||
<test.fgcp-de.apiversion>2011-01-31</test.fgcp-de.apiversion>
|
||||
<test.fgcp-de.build-version></test.fgcp-de.build-version>
|
||||
<test.fgcp-de.identity>fgcp-id</test.fgcp-de.identity>
|
||||
<test.fgcp-de.credential>fgcp-cred</test.fgcp-de.credential>
|
||||
<test.fgcp-de.image-id />
|
||||
<test.fgcp-de.image.login-user />
|
||||
<test.fgcp-de.image.authenticate-sudo />
|
||||
<jclouds.osgi.export>org.jclouds.fujitsu.fgcp*;version="${project.version}"</jclouds.osgi.export>
|
||||
<jclouds.osgi.import>
|
||||
org.jclouds.providers*;version="${project.version}",
|
||||
*
|
||||
</jclouds.osgi.import>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.jclouds.provider</groupId>-->
|
||||
<!--<artifactId>fgcp</artifactId>-->
|
||||
<!--<version>${project.version}</version>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>live</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.fgcp-de.identity>${test.fgcp-de.identity}</test.fgcp-de.identity>
|
||||
<test.fgcp-de.credential>${test.fgcp-de.credential}</test.fgcp-de.credential>
|
||||
<test.fgcp-de.endpoint>${test.fgcp-de.endpoint}</test.fgcp-de.endpoint>
|
||||
<test.fgcp-de.apiversion>${test.fgcp-de.apiversion}</test.fgcp-de.apiversion>
|
||||
<test.fgcp-de.build-version>${test.fgcp-de.build-version}</test.fgcp-de.build-version>
|
||||
<test.fgcp-de.image-id>${test.fgcp-de.image-id}</test.fgcp-de.image-id>
|
||||
<test.fgcp-de.image.login-user>${test.fgcp-de.image.login-user}</test.fgcp-de.image.login-user>
|
||||
<test.fgcp-de.image.authenticate-sudo>${test.fgcp-de.image.authenticate-sudo}</test.fgcp-de.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.providers.internal.BaseProviderMetadata;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.jclouds.providers.ProviderMetadata} for FGCP.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPDEProviderMetadata extends FGCPProviderMetadata {
|
||||
|
||||
private static final long serialVersionUID = -8498457904032259345L;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public FGCPDEProviderMetadata() {
|
||||
super(builder());
|
||||
}
|
||||
|
||||
public FGCPDEProviderMetadata(Builder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return builder().fromProviderMetadata(this);
|
||||
}
|
||||
|
||||
public static class Builder extends BaseProviderMetadata.Builder {
|
||||
|
||||
protected Builder() {
|
||||
id("fgcp-de")
|
||||
.name("Fujitsu Global Cloud Platform (FGCP) - DE")
|
||||
.apiMetadata(new FGCPApiMetadata())
|
||||
.homepage(
|
||||
URI.create("http://www.fujitsu.com/global/solutions/cloud/solutions/global-cloud-platform/index.html"))
|
||||
.console(URI.create("http://globalcloud.de.fujitsu.com"))
|
||||
.defaultProperties(FGCPApiMetadata.defaultProperties())
|
||||
.iso3166Codes("DE-BY")
|
||||
.endpoint(
|
||||
"https://api.globalcloud.de.fujitsu.com/ovissapi/endpoint")
|
||||
.defaultProperties(FGCPProviderMetadata.defaultProperties());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FGCPDEProviderMetadata build() {
|
||||
return new FGCPDEProviderMetadata(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromProviderMetadata(ProviderMetadata in) {
|
||||
super.fromProviderMetadata(in);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.jclouds.fujitsu.fgcp.FGCPDEProviderMetadata
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Test(groups = "unit", testName = "FGCPDEProviderTest")
|
||||
public class FGCPDEProviderTest extends BaseProviderMetadataTest {
|
||||
|
||||
public FGCPDEProviderTest() {
|
||||
super(new FGCPDEProviderMetadata(), new FGCPApiMetadata());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "FGCPDETemplateBuilderLiveTest")
|
||||
public class FGCPDETemplateBuilderLiveTest extends
|
||||
FGCPBaseTemplateBuilderLiveTest {
|
||||
|
||||
public FGCPDETemplateBuilderLiveTest() {
|
||||
provider = "fgcp-de";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getIso3166Codes() {
|
||||
return ImmutableSet.<String> of("DE-BY");
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.compute.config;
|
||||
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "FGCPDEComputeServiceLiveTest")
|
||||
public class FGCPDEComputeServiceLiveTest extends FGCPBaseComputeServiceLiveTest {
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
provider = "fgcp-de";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.jclouds.labs</groupId>
|
||||
<artifactId>fgcp</artifactId>
|
||||
<name>jclouds Fujitsu Global Cloud Platform</name>
|
||||
<description>jclouds components to access Fujitsu Global Cloud Platform</description>
|
||||
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Dies Koper</name>
|
||||
<id>dkoper</id>
|
||||
<email>diesk -at- fast -dot- au -dot- fujitsu -dot- com</email>
|
||||
<organization>Fujitsu</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
<timezone>+10</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<test.fgcp-au.endpoint>https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint</test.fgcp-au.endpoint>
|
||||
<test.fgcp-au.apiversion>2011-01-31</test.fgcp-au.apiversion>
|
||||
<test.fgcp-au.build-version></test.fgcp-au.build-version>
|
||||
<test.fgcp-au.identity>fgcp-id</test.fgcp-au.identity>
|
||||
<test.fgcp-au.credential>fgcp-cred</test.fgcp-au.credential>
|
||||
<test.fgcp-au.image-id>IMG_3c9820_71OW9NZC268</test.fgcp-au.image-id><!-- CentOS 6.2 64bit(EN) in AU -->
|
||||
<test.fgcp-au.image.login-user />
|
||||
<test.fgcp-au.image.authenticate-sudo />
|
||||
<jclouds.osgi.export>org.jclouds.fujitsu.fgcp*;version="${project.version}"</jclouds.osgi.export>
|
||||
<jclouds.osgi.import>
|
||||
org.jclouds.compute.internal;version="${project.version}",
|
||||
org.jclouds.rest.internal;version="${project.version}",
|
||||
org.jclouds*;version="${project.version}",
|
||||
*
|
||||
</jclouds.osgi.import>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.jclouds.provider</groupId>-->
|
||||
<!--<artifactId>fgcp</artifactId>-->
|
||||
<!--<version>${project.version}</version>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>live</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.fgcp-au.identity>${test.fgcp-au.identity}</test.fgcp-au.identity>
|
||||
<test.fgcp-au.credential>${test.fgcp-au.credential}</test.fgcp-au.credential>
|
||||
<test.fgcp-au.endpoint>${test.fgcp-au.endpoint}</test.fgcp-au.endpoint>
|
||||
<test.fgcp-au.apiversion>${test.fgcp-au.apiversion}</test.fgcp-au.apiversion>
|
||||
<test.fgcp-au.build-version>${test.fgcp-au.build-version}</test.fgcp-au.build-version>
|
||||
<test.fgcp-au.image-id>${test.fgcp-au.image-id}</test.fgcp-au.image-id>
|
||||
<test.fgcp-au.image.login-user>${test.fgcp-au.image.login-user}</test.fgcp-au.image.login-user>
|
||||
<test.fgcp-au.image.authenticate-sudo>${test.fgcp-au.image.authenticate-sudo}</test.fgcp-au.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.services.AdditionalDiskApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.DiskImageApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.FirewallApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.LoadBalancerApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.PublicIPAddressApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.SystemTemplateApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualDCApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualServerApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualSystemApi;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to FGCP services.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface FGCPApi {
|
||||
|
||||
@Delegate
|
||||
VirtualDCApi getVirtualDCApi();
|
||||
|
||||
@Delegate
|
||||
VirtualSystemApi getVirtualSystemApi();
|
||||
|
||||
@Delegate
|
||||
VirtualServerApi getVirtualServerApi();
|
||||
|
||||
@Delegate
|
||||
AdditionalDiskApi getAdditionalDiskApi();
|
||||
|
||||
@Delegate
|
||||
SystemTemplateApi getSystemTemplateApi();
|
||||
|
||||
@Delegate
|
||||
DiskImageApi getDiskImageApi();
|
||||
|
||||
@Delegate
|
||||
FirewallApi getFirewallApi();
|
||||
|
||||
@Delegate
|
||||
LoadBalancerApi getLoadBalancerApi();
|
||||
|
||||
@Delegate
|
||||
PublicIPAddressApi getPublicIPAddressApi();
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.fujitsu.fgcp.compute.FGCPRestClientModule;
|
||||
import org.jclouds.fujitsu.fgcp.compute.config.FGCPComputeServiceContextModule;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Implementation of {@link ApiMetadata} for Fujitsu's Global Cloud Platform
|
||||
* (FGCP, FGCP/S5) provider in Australia.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPApiMetadata extends BaseRestApiMetadata {
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromApiMetadata(this);
|
||||
}
|
||||
|
||||
public FGCPApiMetadata() {
|
||||
this(new Builder());
|
||||
}
|
||||
|
||||
protected FGCPApiMetadata(Builder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
// enables peer verification using the CAs bundled with the JRE (or
|
||||
// value of javax.net.ssl.trustStore if set)
|
||||
properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "false");
|
||||
// properties.setProperty("jclouds.ssh.max-retries", "5");
|
||||
// properties.setProperty("jclouds.ssh.retry-auth", "true");
|
||||
return properties;
|
||||
}
|
||||
|
||||
public static class Builder extends BaseRestApiMetadata.Builder {
|
||||
|
||||
protected Builder() {
|
||||
super(FGCPApi.class, FGCPAsyncApi.class);
|
||||
id("fgcp")
|
||||
.name("Fujitsu Global Cloud Platform (FGCP)")
|
||||
.identityName("User certificate (PEM file)")
|
||||
.credentialName("User certificate password")
|
||||
.documentation(
|
||||
URI.create("https://globalcloud.fujitsu.com.au/portala/ctrl/aboutSopManual"))
|
||||
.version(FGCPAsyncApi.VERSION)
|
||||
.defaultEndpoint(
|
||||
"https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint")
|
||||
.defaultProperties(FGCPApiMetadata.defaultProperties())
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(
|
||||
ImmutableSet.<Class<? extends Module>> of(
|
||||
FGCPComputeServiceContextModule.class,
|
||||
FGCPRestClientModule.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FGCPApiMetadata build() {
|
||||
return new FGCPApiMetadata(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromApiMetadata(ApiMetadata in) {
|
||||
super.fromApiMetadata(in);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.fujitsu.fgcp;
|
||||
|
||||
import org.jclouds.fujitsu.fgcp.services.AdditionalDiskAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.DiskImageAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.FirewallAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.LoadBalancerAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.PublicIPAddressAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.SystemTemplateAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualDCAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualServerAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualSystemAsyncApi;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to FGCP services.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public interface FGCPAsyncApi {
|
||||
public final static String VERSION = "2012-02-18";
|
||||
|
||||
@Delegate
|
||||
VirtualDCAsyncApi getVirtualDCApi();
|
||||
|
||||
@Delegate
|
||||
VirtualSystemAsyncApi getVirtualSystemApi();
|
||||
|
||||
@Delegate
|
||||
VirtualServerAsyncApi getVirtualServerApi();
|
||||
|
||||
@Delegate
|
||||
AdditionalDiskAsyncApi getAdditionalDiskApi();
|
||||
|
||||
@Delegate
|
||||
SystemTemplateAsyncApi getSystemTemplateApi();
|
||||
|
||||
@Delegate
|
||||
DiskImageAsyncApi getDiskImageApi();
|
||||
|
||||
@Delegate
|
||||
FirewallAsyncApi getFirewallApi();
|
||||
|
||||
@Delegate
|
||||
LoadBalancerAsyncApi getLoadBalancerApi();
|
||||
|
||||
@Delegate
|
||||
PublicIPAddressAsyncApi getPublicIPAddressApi();
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp;
|
||||
|
||||
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.providers.internal.BaseProviderMetadata;
|
||||
|
||||
/**
|
||||
* Base implementation of {@link org.jclouds.providers.ProviderMetadata} for
|
||||
* FGCP.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPProviderMetadata extends BaseProviderMetadata {
|
||||
|
||||
private static final long serialVersionUID = 7527265705102650456L;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public FGCPProviderMetadata() {
|
||||
super(builder());
|
||||
}
|
||||
|
||||
public FGCPProviderMetadata(Builder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = new Properties();
|
||||
|
||||
properties.setProperty(TEMPLATE,
|
||||
"osFamily=CENTOS,osVersionMatches=6.2,os64Bit=true");
|
||||
|
||||
return properties;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.binders;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpRequest.Builder;
|
||||
import org.jclouds.rest.Binder;
|
||||
|
||||
/**
|
||||
* Adds system id to resource id and binds them to query parameters
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class BindAlsoToSystemId implements Binder {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* request where the query params will be set
|
||||
* @param input
|
||||
* array of String params
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
|
||||
checkNotNull(input);
|
||||
checkArgument(
|
||||
input instanceof String,
|
||||
"this binder only applies to String arguments: "
|
||||
+ input.getClass());
|
||||
|
||||
Pattern pattern = Pattern.compile("^(\\w+-\\w+)\\b.*");
|
||||
Matcher matcher = pattern.matcher((String) input);
|
||||
|
||||
checkArgument(matcher.find(),
|
||||
"no valid resource id found to construct vsys id from: "
|
||||
+ input.toString());
|
||||
|
||||
Builder<?> builder = request.toBuilder();
|
||||
builder.replaceQueryParam("vsysId", matcher.group(1));
|
||||
|
||||
return (R) builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,375 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.jclouds.crypto.Crypto;
|
||||
import org.jclouds.crypto.Pems;
|
||||
import org.jclouds.date.TimeStamp;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPApi;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.handlers.FGCPRetryIfNotProxyAuthenticationFailureHandler;
|
||||
import org.jclouds.fujitsu.fgcp.http.SSLContextWithKeysSupplier;
|
||||
import org.jclouds.fujitsu.fgcp.location.SystemAndNetworkSegmentToLocationSupplier;
|
||||
import org.jclouds.fujitsu.fgcp.services.AdditionalDiskApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.AdditionalDiskAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.BuiltinServerApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.BuiltinServerAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.DiskImageApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.DiskImageAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.FirewallApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.FirewallAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.LoadBalancerApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.LoadBalancerAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.PublicIPAddressApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.PublicIPAddressAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.SystemTemplateApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.SystemTemplateAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualDCApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualDCAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualServerApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualServerAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualSystemApi;
|
||||
import org.jclouds.fujitsu.fgcp.services.VirtualSystemAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.xml.FGCPJAXBParser;
|
||||
import org.jclouds.http.HttpRetryHandler;
|
||||
import org.jclouds.http.annotation.ClientError;
|
||||
import org.jclouds.io.InputSuppliers;
|
||||
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
||||
import org.jclouds.location.suppliers.LocationsSupplier;
|
||||
import org.jclouds.location.suppliers.implicit.FirstNetwork;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.jclouds.rest.config.RestClientModule;
|
||||
import org.jclouds.xml.XMLParser;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* Configures the FGCP connection. This module is added in FGCPContextBuilder.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@ConfiguresRestClient
|
||||
public class FGCPRestClientModule extends
|
||||
RestClientModule<FGCPApi, FGCPAsyncApi> {
|
||||
|
||||
@Resource
|
||||
Logger logger = Logger.NULL;
|
||||
|
||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap
|
||||
.<Class<?>, Class<?>> builder()
|
||||
//
|
||||
.put(VirtualDCApi.class, VirtualDCAsyncApi.class)
|
||||
.put(VirtualSystemApi.class, VirtualSystemAsyncApi.class)
|
||||
.put(VirtualServerApi.class, VirtualServerAsyncApi.class)
|
||||
.put(AdditionalDiskApi.class, AdditionalDiskAsyncApi.class)
|
||||
.put(SystemTemplateApi.class, SystemTemplateAsyncApi.class)
|
||||
.put(DiskImageApi.class, DiskImageAsyncApi.class)
|
||||
.put(BuiltinServerApi.class, BuiltinServerAsyncApi.class)
|
||||
.put(FirewallApi.class, FirewallAsyncApi.class)
|
||||
.put(LoadBalancerApi.class, LoadBalancerAsyncApi.class)
|
||||
.put(PublicIPAddressApi.class, PublicIPAddressAsyncApi.class)
|
||||
.build();
|
||||
|
||||
public FGCPRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindErrorHandlers() {
|
||||
// bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAWSErrorFromXmlContent.class);
|
||||
// bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAWSErrorFromXmlContent.class);
|
||||
// bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAWSErrorFromXmlContent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installLocations() {
|
||||
super.installLocations();
|
||||
bind(ImplicitLocationSupplier.class).to(FirstNetwork.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(LocationsSupplier.class).to(
|
||||
SystemAndNetworkSegmentToLocationSupplier.class).in(
|
||||
Scopes.SINGLETON);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindRetryHandlers() {
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(
|
||||
FGCPRetryIfNotProxyAuthenticationFailureHandler.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
bind(XMLParser.class).to(FGCPJAXBParser.class);
|
||||
bind(new TypeLiteral<Supplier<SSLContext>>() {
|
||||
}).to(new TypeLiteral<SSLContextWithKeysSupplier>() {
|
||||
});
|
||||
}
|
||||
|
||||
@Provides
|
||||
@TimeStamp
|
||||
protected Calendar provideCalendar() {
|
||||
return Calendar.getInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @Provides
|
||||
*
|
||||
* @Singleton protected KeyStore
|
||||
* provideKeyStore(@Named(Constants.PROPERTY_IDENTITY) String
|
||||
* keyStoreFilename, @Named(Constants.PROPERTY_CREDENTIAL) String
|
||||
* keyStorePassword) throws KeyStoreException { KeyStore keyStore =
|
||||
* KeyStore.getInstance("pkcs12");
|
||||
*
|
||||
* try { FileInputStream is = new
|
||||
* FileInputStream(checkNotNull(keyStoreFilename,
|
||||
* Constants.PROPERTY_IDENTITY)); keyStore.load(is,
|
||||
* checkNotNull(keyStorePassword,
|
||||
* Constants.PROPERTY_CREDENTIAL).toCharArray()); } catch (Exception e) { //
|
||||
* expecting IOException, NoSuchAlgorithmException, CertificateException
|
||||
* logger.error(e, "Keystore could not be opened: %s", keyStoreFilename); }
|
||||
* return keyStore; }
|
||||
*
|
||||
* @Provides
|
||||
*
|
||||
* @Singleton protected PrivateKey provideKey(Provider<KeyStore>
|
||||
* keyStoreProvider, @Named(Constants.PROPERTY_CREDENTIAL) String
|
||||
* keyPassword) throws KeyStoreException, NoSuchAlgorithmException,
|
||||
* UnrecoverableKeyException { KeyStore keyStore = keyStoreProvider.get();
|
||||
* if (keyStore == null) return null;
|
||||
*
|
||||
* // retrieving 1st alias in keystore as expecting only one String alias =
|
||||
* checkNotNull(keyStore.aliases().nextElement(),
|
||||
* "first alias in keystore"); return (PrivateKey) keyStore.getKey(alias,
|
||||
* checkNotNull(keyPassword, Constants.PROPERTY_CREDENTIAL).toCharArray());
|
||||
* }
|
||||
*/
|
||||
/*
|
||||
* maybe we can provide two authentication methods:
|
||||
*
|
||||
* 1. same as DeltaCloud: User passes a folder name as identity and cert
|
||||
* password as credential Note: pass relative path (e.g. cert's path:
|
||||
* c:\jclouds\certs\dkoper\UserCert.p12: user passes 'dkoper': provider
|
||||
* impl. finds it under e.g. $USER_DIR or $CURRENT_DIR or pass absolute path
|
||||
* 2. no file access for GAE: User passes cert in PEM format (converted from
|
||||
* UserCert.p12 using openssl?) as identity and cert password as credential
|
||||
*/
|
||||
@Provides
|
||||
@Singleton
|
||||
protected KeyStore provideKeyStore(Crypto crypto, @Identity String cert,
|
||||
@Credential String keyStorePassword) {
|
||||
KeyStore keyStore = null;
|
||||
try {
|
||||
keyStore = KeyStore.getInstance("PKCS12");
|
||||
|
||||
// System.out.println("cert: " + cert);
|
||||
// System.out.println("pwd : " + keyStorePassword);
|
||||
File certFile = new File(checkNotNull(cert));
|
||||
if (certFile.isFile()) { // cert is path to pkcs12 file
|
||||
|
||||
keyStore.load(new FileInputStream(certFile),
|
||||
keyStorePassword.toCharArray());
|
||||
} else { // cert is PEM encoded, containing private key and certs
|
||||
|
||||
// System.out.println("cert:\n" + cert);
|
||||
// split in private key and certs
|
||||
int privateKeyBeginIdx = cert.indexOf("-----BEGIN PRIVATE KEY");
|
||||
int privateKeyEndIdx = cert.indexOf("-----END PRIVATE KEY");
|
||||
String pemPrivateKey = cert.substring(privateKeyBeginIdx,
|
||||
privateKeyEndIdx + 26);
|
||||
// System.out.println("***************");
|
||||
// System.out.println("pemPrivateKey:\n" + pemPrivateKey);
|
||||
// System.out.println("***************");
|
||||
|
||||
String pemCerts = "";
|
||||
int certsBeginIdx = 0;
|
||||
|
||||
do {
|
||||
certsBeginIdx = cert.indexOf("-----BEGIN CERTIFICATE",
|
||||
certsBeginIdx);
|
||||
// System.out.println("begin:" + certsBeginIdx);
|
||||
|
||||
if (certsBeginIdx >= 0) {
|
||||
int certsEndIdx = cert.indexOf("-----END CERTIFICATE",
|
||||
certsBeginIdx) + 26;
|
||||
// System.out.println("end :" + certsEndIdx);
|
||||
pemCerts += cert.substring(certsBeginIdx, certsEndIdx);
|
||||
certsBeginIdx = certsEndIdx;
|
||||
}
|
||||
} while (certsBeginIdx != -1);
|
||||
// System.out.println("***************");
|
||||
// System.out.println("pemCerts:\n" + pemCerts);
|
||||
// System.out.println("***************");
|
||||
|
||||
/*
|
||||
* String pemCerts = "-----BEGIN "; Splitter pemSplitter =
|
||||
* Splitter.on("-----BEGIN ");
|
||||
*
|
||||
* for (String part : pemSplitter.split(cert)) {
|
||||
* System.out.println("***************");
|
||||
* System.out.println("Part:\n" + part);
|
||||
* System.out.println("***************");
|
||||
*
|
||||
* if (part.startsWith("PRIVATE KEY")
|
||||
*/
|
||||
/* || part.startsWith("RSA PRIVATE KEY)" *//*
|
||||
* ) {
|
||||
*
|
||||
* int certEndIdx =
|
||||
* part.lastIndexOf
|
||||
* ("-----END");
|
||||
* pemPrivateKey +=
|
||||
* part.substring(0,
|
||||
* certEndIdx + 26);
|
||||
* // take up to next
|
||||
* "-----" (i.e.
|
||||
* "-----END") //
|
||||
* Splitter
|
||||
* keySplitter =
|
||||
* Splitter
|
||||
* .on("-----").
|
||||
* omitEmptyStrings
|
||||
* ().trimResults();
|
||||
* //
|
||||
* Iterator<String>
|
||||
* iter =
|
||||
* keySplitter.
|
||||
* split(part
|
||||
* ).iterator(); //
|
||||
* String keyName =
|
||||
* iter.next() +
|
||||
* "-----\n"; //
|
||||
* pemPrivateKey +=
|
||||
* keyName; ////
|
||||
* System.out
|
||||
* .println
|
||||
* ("Skipping: '" +
|
||||
* iter.next() +
|
||||
* "'"); //
|
||||
* pemPrivateKey +=
|
||||
* iter.next(); //
|
||||
* pemPrivateKey +=
|
||||
* "\n-----END " +
|
||||
* keyName;
|
||||
* System.out.println
|
||||
* (
|
||||
* "/////////////////"
|
||||
* );
|
||||
* System.out.println
|
||||
* (
|
||||
* "pemPrivateKey:\n"
|
||||
* + pemPrivateKey);
|
||||
* System
|
||||
* .out.println(
|
||||
* "/////////////////"
|
||||
* ); } else if
|
||||
* (part.startsWith
|
||||
* ("CERTIFICATE")) {
|
||||
*
|
||||
* // take up to next
|
||||
* "-----" (i.e.
|
||||
* "-----END") // or
|
||||
* take up to last
|
||||
* END CERTIFICATE?
|
||||
* int certEndIdx =
|
||||
* part.lastIndexOf (
|
||||
* "----- END CERTIFICATE"
|
||||
* ); // pemCerts +=
|
||||
* part. // Splitter
|
||||
* keySplitter =
|
||||
* Splitter
|
||||
* .on("-----").
|
||||
* omitEmptyStrings
|
||||
* (); // pemCerts +=
|
||||
* keySplitter
|
||||
* .split(part)
|
||||
* .iterator
|
||||
* ().next(); //
|
||||
* pemCerts +=
|
||||
* "-----BEGIN "; }
|
||||
* else { // ignore
|
||||
* the fluff in
|
||||
* between (Bag
|
||||
* Attributes, etc.)
|
||||
* } }
|
||||
*/
|
||||
|
||||
// parse private key
|
||||
KeySpec keySpec = Pems.privateKeySpec(InputSuppliers
|
||||
.of(pemPrivateKey));
|
||||
PrivateKey privateKey = crypto.rsaKeyFactory().generatePrivate(
|
||||
keySpec);
|
||||
|
||||
// populate keystore with private key and certs
|
||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Certificate> certs = (Collection<Certificate>) cf
|
||||
.generateCertificates(new ByteArrayInputStream(pemCerts
|
||||
.getBytes("UTF-8")));
|
||||
keyStore.load(null);
|
||||
keyStore.setKeyEntry("dummy", privateKey,
|
||||
keyStorePassword.toCharArray(),
|
||||
certs.toArray(new java.security.cert.Certificate[0]));
|
||||
|
||||
// System.out.println("private key: " + privateKey.getFormat() +
|
||||
// "; "
|
||||
// + privateKey.getAlgorithm() + "; class: " +
|
||||
// privateKey.getClass().getName());// + "; " + new
|
||||
// String(privateKey.getEncoded()));
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
/*
|
||||
* KeyStoreException, IOException, NoSuchAlgorithmException,
|
||||
* CertificateException, InvalidKeySpecException
|
||||
*/
|
||||
throw new AuthorizationException("Error loading certificate", e);
|
||||
}
|
||||
|
||||
return keyStore;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.config;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceAdapter;
|
||||
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.Processor;
|
||||
import org.jclouds.compute.domain.Volume;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.CPUToProcessor;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.DiskImageToImage;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.DiskImageToOperatingSystem;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.DiskToVolume;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.ServerTypeToHardware;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.VServerMetadataToNodeMetadata;
|
||||
import org.jclouds.fujitsu.fgcp.compute.options.FGCPTemplateOptions;
|
||||
import org.jclouds.fujitsu.fgcp.compute.strategy.FGCPComputeServiceAdapter;
|
||||
import org.jclouds.fujitsu.fgcp.compute.strategy.VServerMetadata;
|
||||
import org.jclouds.fujitsu.fgcp.domain.CPU;
|
||||
import org.jclouds.fujitsu.fgcp.domain.Disk;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
import org.jclouds.fujitsu.fgcp.domain.ServerType;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.TypeLiteral;
|
||||
//import org.jclouds.fujitsu.fgcp.compute.predicates.ServerStopped;
|
||||
|
||||
/**
|
||||
* Added in FGCPContextBuilder
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPComputeServiceContextModule
|
||||
extends
|
||||
ComputeServiceAdapterContextModule<VServerMetadata, ServerType, DiskImage, Location> {
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
// installDependencies();
|
||||
|
||||
bind(
|
||||
new TypeLiteral<ComputeServiceAdapter<VServerMetadata, ServerType, DiskImage, Location>>() {
|
||||
}).to(FGCPComputeServiceAdapter.class);
|
||||
|
||||
// the following bind functions that map FGCP domain specific resources
|
||||
// to jclouds'
|
||||
bind(new TypeLiteral<Function<VServerMetadata, NodeMetadata>>() {
|
||||
}).to(VServerMetadataToNodeMetadata.class);
|
||||
bind(new TypeLiteral<Function<DiskImage, Image>>() {
|
||||
}).to(DiskImageToImage.class);
|
||||
bind(new TypeLiteral<Function<DiskImage, OperatingSystem>>() {
|
||||
}).to(DiskImageToOperatingSystem.class);
|
||||
bind(new TypeLiteral<Function<ServerType, Hardware>>() {
|
||||
}).to(ServerTypeToHardware.class);
|
||||
bind(new TypeLiteral<Function<Disk, Volume>>() {
|
||||
}).to(DiskToVolume.class);
|
||||
bind(new TypeLiteral<Function<CPU, Processor>>() {
|
||||
}).to(CPUToProcessor.class);
|
||||
|
||||
// we aren't converting hardware from a provider-specific type
|
||||
bind(new TypeLiteral<Function<Location, Location>>() {
|
||||
}).to((Class) IdentityFunction.class);
|
||||
bind(new TypeLiteral<Function<Hardware, Hardware>>() {
|
||||
}).to((Class) IdentityFunction.class);
|
||||
|
||||
bind(TemplateOptions.class).to(FGCPTemplateOptions.class);
|
||||
|
||||
|
||||
// bind(new TypeLiteral<Predicate<String>>() {
|
||||
// }).to((Class) ServerStopped.class);
|
||||
|
||||
// need to look into the following later for to map (create) jclouds'
|
||||
// location to FGCP.
|
||||
// see LocationScope:
|
||||
// PROVIDER: FGCP
|
||||
// REGION: country?/country+state?
|
||||
// ZONE: virtual DC: contractId
|
||||
// NETWORK: VSYS? DMZ/SECURE1/SECURE2?
|
||||
// RACK: N/A?
|
||||
// HOST: N/A?
|
||||
// there are no locations except the provider
|
||||
// bind(new TypeLiteral<Supplier<Location>>() {
|
||||
// }).to(OnlyLocationOrFirstZone.class);
|
||||
|
||||
// install(new FGCPBindComputeStrategiesByClass());
|
||||
// install(new FGCPBindComputeSuppliersByClass());
|
||||
// bind(ReviseParsedImage.class).to(AWSEC2ReviseParsedImage.class);
|
||||
// bind(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class).to(
|
||||
// CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
||||
// bind(EC2HardwareSupplier.class).to(AWSEC2HardwareSupplier.class);
|
||||
// bind(EC2TemplateBuilderImpl.class).to(AWSEC2TemplateBuilderImpl.class);
|
||||
// bind(EC2GetNodeMetadataStrategy.class).to(AWSEC2GetNodeMetadataStrategy.class);
|
||||
// bind(InstancePresent.class).to(AWSEC2InstancePresent.class);
|
||||
// bind(EC2CreateNodesInGroupThenAddToSet.class).to(AWSEC2CreateNodesInGroupThenAddToSet.class);
|
||||
// bind(RunningInstanceToNodeMetadata.class).to(AWSRunningInstanceToNodeMetadata.class);
|
||||
}
|
||||
|
||||
// @Provides
|
||||
// @Singleton
|
||||
// @Named("SECURITY")
|
||||
// protected Predicate<String> provideServerStopped(ServerStopped
|
||||
// serverStopped, Timeouts timeouts) {
|
||||
// return new RetryablePredicate<String>(serverStopped,
|
||||
// timeouts.nodeSuspended);
|
||||
// }
|
||||
|
||||
protected void installDependencies() {
|
||||
// install(new FGCPComputeServiceDependenciesModule());
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override protected TemplateBuilder provideTemplate(Injector injector,
|
||||
* TemplateBuilder template) { return
|
||||
* template.osFamily(CENTOS).os64Bit(true); }
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.compute.domain.Processor;
|
||||
import org.jclouds.fujitsu.fgcp.domain.CPU;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class CPUToProcessor implements Function<CPU, Processor> {
|
||||
|
||||
@Override
|
||||
public Processor apply(CPU cpu) {
|
||||
checkNotNull(cpu, "cpu");
|
||||
|
||||
return new Processor(Double.valueOf(cpu.getCores()), Double.valueOf(cpu
|
||||
.getSpeedPerCore()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.Image.Status;
|
||||
import org.jclouds.compute.domain.ImageBuilder;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
import org.jclouds.location.suppliers.all.RegionToProviderOrJustProvider;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class DiskImageToImage implements Function<DiskImage, Image> {
|
||||
|
||||
private final DiskImageToOperatingSystem diskImageToOperatingSystem;
|
||||
private final RegionToProviderOrJustProvider regionSupplier;
|
||||
|
||||
@Inject
|
||||
public DiskImageToImage(
|
||||
DiskImageToOperatingSystem diskImageToOperatingSystem,
|
||||
RegionToProviderOrJustProvider locationSupplier) {
|
||||
this.diskImageToOperatingSystem = checkNotNull(
|
||||
diskImageToOperatingSystem, "diskImageToOperatingSystem");
|
||||
this.regionSupplier = checkNotNull(locationSupplier, "locationProvider");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image apply(DiskImage from) {
|
||||
checkNotNull(from, "disk image");
|
||||
|
||||
ImageBuilder builder = new ImageBuilder();
|
||||
|
||||
builder.ids(from.getId());
|
||||
builder.name(from.getName());
|
||||
builder.description(from.getDescription());
|
||||
builder.location(Iterables.getOnlyElement(regionSupplier.get()));
|
||||
// in fgcp, if the image is listed it is available
|
||||
builder.status(Status.AVAILABLE);
|
||||
|
||||
OperatingSystem os = diskImageToOperatingSystem.apply(from);
|
||||
builder.operatingSystem(os);
|
||||
String user = os.getFamily() == OsFamily.WINDOWS ? "Administrator"
|
||||
: "root";
|
||||
builder.defaultCredentials(LoginCredentials.builder().identity(user)
|
||||
.noPassword().build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class DiskImageToOperatingSystem implements
|
||||
Function<DiskImage, OperatingSystem> {
|
||||
|
||||
private static final Pattern OS_VERSION_PATTERN = Pattern
|
||||
.compile("^.*?(\\d.*)\\s(32|64).*$");
|
||||
|
||||
@Override
|
||||
public OperatingSystem apply(DiskImage image) {
|
||||
checkNotNull(image, "disk image");
|
||||
|
||||
// convert to short name rhel to accommodate ComputeServiceUtils
|
||||
// conventions
|
||||
String shortOsName = image.getOsName().replace(
|
||||
"Red Hat Enterprise Linux", "rhel");
|
||||
OsFamily osFamily = ComputeServiceUtils
|
||||
.parseOsFamilyOrUnrecognized(shortOsName);
|
||||
OperatingSystem.Builder builder = OperatingSystem.builder();
|
||||
|
||||
builder.name(image.getOsName());
|
||||
builder.family(osFamily);
|
||||
builder.is64Bit(image.getOsName().contains("64bit")
|
||||
|| image.getOsName().contains("64 bit")
|
||||
|| image.getOsName().contains("x64"));
|
||||
// OsType returns guest type (hvm, pv), which aws-ec2 is mapping to arch
|
||||
builder.arch(image.getOsType());
|
||||
Matcher m = OS_VERSION_PATTERN.matcher(image.getOsName());
|
||||
if (m.matches()) {
|
||||
builder.version(m.group(1));
|
||||
}
|
||||
builder.description(image.getOsName());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.compute.domain.Volume;
|
||||
import org.jclouds.compute.domain.VolumeBuilder;
|
||||
import org.jclouds.fujitsu.fgcp.domain.Disk;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class DiskToVolume implements Function<Disk, Volume> {
|
||||
|
||||
@Override
|
||||
public Volume apply(Disk disk) {
|
||||
checkNotNull(disk, "disk");
|
||||
|
||||
VolumeBuilder builder = new VolumeBuilder();
|
||||
|
||||
builder.size(1000f * Float.valueOf(disk.getSize()));
|
||||
// "Disk"'s are additional disks; they can't be booted disk(?)
|
||||
builder.bootDevice(false);
|
||||
builder.durable(true);
|
||||
builder.type(Volume.Type.SAN);
|
||||
builder.id("type: " + disk.getType() + " usage: " + disk.getUsage());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* Determines the id of the firewall associated with a virtual system, server,
|
||||
* load balancer or disk.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class ResourceIdToFirewallId implements Function<String, String> {
|
||||
|
||||
private ResourceIdToSystemId toSystemId;
|
||||
|
||||
@Inject
|
||||
private ResourceIdToFirewallId(ResourceIdToSystemId resourceIdToSystemId) {
|
||||
this.toSystemId = checkNotNull(resourceIdToSystemId,
|
||||
"resourceIdToSystemId");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(String id) {
|
||||
checkNotNull(id, "resource id");
|
||||
|
||||
return toSystemId.apply(id) + "-S-0001";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* Determines the id of the virtual system that a server, load balancer or disk
|
||||
* is part of.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class ResourceIdToSystemId implements Function<String, String> {
|
||||
|
||||
@Override
|
||||
public String apply(String id) {
|
||||
checkNotNull(id, "resource id");
|
||||
|
||||
Pattern pattern = Pattern.compile("^(\\w+-\\w+)\\b.*");
|
||||
Matcher matcher = pattern.matcher((String) id);
|
||||
|
||||
checkArgument(matcher.find(),
|
||||
"no valid resource id found: " + id.toString());
|
||||
|
||||
return matcher.group(1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.HardwareBuilder;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.fujitsu.fgcp.domain.ServerType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class ServerTypeToHardware implements Function<ServerType, Hardware> {
|
||||
private final CPUToProcessor cpuToProcessor;
|
||||
private final DiskToVolume diskToVolume;
|
||||
|
||||
@Inject
|
||||
public ServerTypeToHardware(CPUToProcessor cpuToProcessor,
|
||||
DiskToVolume diskToVolume) {
|
||||
this.cpuToProcessor = checkNotNull(cpuToProcessor);
|
||||
this.diskToVolume = checkNotNull(diskToVolume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hardware apply(ServerType from) {
|
||||
checkNotNull(from, "ServerType");
|
||||
HardwareBuilder builder = new HardwareBuilder();
|
||||
|
||||
builder.ids(from.getId());
|
||||
builder.name(from.getName());
|
||||
builder.ram((int) (1000d * Double.valueOf(from.getMemory().getSize())));
|
||||
builder.processor(cpuToProcessor.apply(from.getCpu()));
|
||||
builder.supportsImage(Predicates.<Image> alwaysTrue());
|
||||
// all servers are 64bit. The OS however may be 32 bit.
|
||||
builder.is64Bit(true);
|
||||
builder.volumes(Iterables.transform(from.getDisks(), diskToVolume));
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.fujitsu.fgcp.xml.internal.SingleElementResponse;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
public class SingleElementResponseToElement implements
|
||||
Function<SingleElementResponse, Object> {
|
||||
|
||||
@Override
|
||||
public Object apply(SingleElementResponse r) {
|
||||
return checkNotNull(r, "response").getElement();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.collect.Memoized;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.fujitsu.fgcp.compute.strategy.VServerMetadata;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerWithVNICs;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class VServerMetadataToNodeMetadata implements
|
||||
Function<VServerMetadata, NodeMetadata> {
|
||||
|
||||
public static final Map<VServerStatus, Status> vServerToStatus = ImmutableMap
|
||||
.<VServerStatus, Status> builder()
|
||||
.put(VServerStatus.DEPLOYING, Status.PENDING)
|
||||
.put(VServerStatus.RUNNING, Status.RUNNING)
|
||||
.put(VServerStatus.STOPPING, Status.PENDING)
|
||||
.put(VServerStatus.STOPPED, Status.SUSPENDED)
|
||||
.put(VServerStatus.STARTING, Status.PENDING)
|
||||
.put(VServerStatus.FAILOVER, Status.RUNNING)
|
||||
.put(VServerStatus.UNEXPECTED_STOP, Status.SUSPENDED)
|
||||
.put(VServerStatus.RESTORING, Status.PENDING)
|
||||
.put(VServerStatus.BACKUP_ING, Status.PENDING)
|
||||
.put(VServerStatus.ERROR, Status.ERROR)
|
||||
.put(VServerStatus.START_ERROR, Status.ERROR)
|
||||
.put(VServerStatus.STOP_ERROR, Status.ERROR)
|
||||
.put(VServerStatus.CHANGE_TYPE, Status.PENDING)
|
||||
.put(VServerStatus.REGISTERING, Status.PENDING)
|
||||
.put(VServerStatus.UNRECOGNIZED, Status.UNRECOGNIZED).build();
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
protected final Supplier<Set<? extends Location>> locations;
|
||||
protected final Supplier<Set<? extends Image>> images;
|
||||
protected final Supplier<Set<? extends Hardware>> hardwares;
|
||||
protected final GroupNamingConvention nodeNamingConvention;
|
||||
|
||||
private static class FindImageForVServer implements Predicate<Image> {
|
||||
private final VServer server;
|
||||
|
||||
private FindImageForVServer(VServer server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(server.getDiskimageId());
|
||||
}
|
||||
}
|
||||
|
||||
protected Image parseImage(VServer from) {
|
||||
try {
|
||||
return Iterables.find(images.get(), new FindImageForVServer(from));
|
||||
} catch (NoSuchElementException e) {
|
||||
logger.warn("could not find a matching image for server %s", from);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class FindHardwareForServerType implements
|
||||
Predicate<Hardware> {
|
||||
private final String type;
|
||||
|
||||
private FindHardwareForServerType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Hardware input) {
|
||||
return input.getName().equals(type);
|
||||
}
|
||||
}
|
||||
|
||||
protected Hardware parseHardware(String from) {
|
||||
try {
|
||||
return Iterables.find(hardwares.get(),
|
||||
new FindHardwareForServerType(from));
|
||||
} catch (NoSuchElementException e) {
|
||||
logger.warn(
|
||||
"could not find a matching hardware for server type %s",
|
||||
from);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class FindLocationForVServer implements Predicate<Location> {
|
||||
private final VServerWithVNICs server;
|
||||
|
||||
private FindLocationForVServer(VServerWithVNICs server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Location input) {
|
||||
return input.getId().equals(
|
||||
Iterables.getLast(server.getVnics()).getNetworkId());
|
||||
}
|
||||
}
|
||||
|
||||
protected Location parseLocation(VServerWithVNICs from) {
|
||||
try {
|
||||
return Iterables.find(locations.get(), new FindLocationForVServer(
|
||||
from));
|
||||
} catch (NoSuchElementException e) {
|
||||
logger.warn("could not find a matching realm for server %s", from);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject
|
||||
VServerMetadataToNodeMetadata(
|
||||
@Memoized Supplier<Set<? extends Location>> locations,
|
||||
@Memoized Supplier<Set<? extends Image>> images,
|
||||
@Memoized Supplier<Set<? extends Hardware>> hardwares,
|
||||
GroupNamingConvention.Factory namingConvention) {
|
||||
this.images = checkNotNull(images, "images");
|
||||
this.locations = checkNotNull(locations, "locations");
|
||||
this.hardwares = checkNotNull(hardwares, "hardwares");
|
||||
this.nodeNamingConvention = checkNotNull(namingConvention,
|
||||
"namingConvention").createWithoutPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeMetadata apply(VServerMetadata from) {
|
||||
NodeMetadataBuilder builder = new NodeMetadataBuilder();
|
||||
|
||||
builder.ids(from.getId());
|
||||
builder.name(from.getName());
|
||||
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from
|
||||
.getName()));
|
||||
if (from.getStatus() == null)
|
||||
System.out.println("status null for: " + from.getId() + ": "
|
||||
+ from.getName());
|
||||
|
||||
builder.status(vServerToStatus.get(from.getStatus()));
|
||||
builder.privateAddresses(ImmutableSet.<String> of());
|
||||
builder.publicAddresses(ImmutableSet.<String> of());
|
||||
|
||||
//
|
||||
// if (from.getIps() != null) {
|
||||
//
|
||||
// builder.publicAddresses(Collections2.transform(from.getIps(),
|
||||
// new Function<PublicIP, String>() {
|
||||
//
|
||||
// @Override
|
||||
// public String apply(PublicIP input) {
|
||||
// return input.getAddress();
|
||||
// }
|
||||
//
|
||||
// }));
|
||||
// }
|
||||
|
||||
if (from.getServer() != null) {
|
||||
|
||||
builder.imageId(from.getServer().getDiskimageId());
|
||||
builder.hardware(parseHardware(from.getServer().getType()));
|
||||
|
||||
LoginCredentials.Builder credentialsBuilder = LoginCredentials
|
||||
.builder().password(from.getInitialPassword());
|
||||
|
||||
Image image = parseImage(from.getServer());
|
||||
// image will not be found if server was created a while back and
|
||||
// the image has since been destroyed or discontinued (like an old
|
||||
// CentOS version)
|
||||
if (image != null) {
|
||||
|
||||
builder.operatingSystem(image.getOperatingSystem());
|
||||
String user = image.getDefaultCredentials().getUser();
|
||||
credentialsBuilder.identity(user);
|
||||
}
|
||||
|
||||
builder.credentials(credentialsBuilder.build());
|
||||
|
||||
if (from.getServer() instanceof VServerWithVNICs) {
|
||||
|
||||
VServerWithVNICs server = (VServerWithVNICs) from.getServer();
|
||||
builder.location(parseLocation(server));
|
||||
List<String> ips = new ArrayList<String>();
|
||||
if (server.getVnics() != null && server.getVnics().iterator().next().getPrivateIp() != null) {
|
||||
ips.add(server.getVnics().iterator().next().getPrivateIp());
|
||||
}
|
||||
builder.privateAddresses(ips);
|
||||
}
|
||||
}
|
||||
if (from.getTemplate() != null) {
|
||||
// when creating a new node
|
||||
builder.location(from.getTemplate().getLocation());
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.options;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class FGCPTemplateOptions extends TemplateOptions {
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.fujitsu.fgcp.compute.predicates;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.fujitsu.fgcp.FGCPApi;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerStatus;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class ServerStopped implements Predicate<String> {
|
||||
|
||||
private final FGCPApi api;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public ServerStopped(FGCPApi api) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
public boolean apply(String serverId) {
|
||||
logger.trace("looking for status on server %s", serverId);
|
||||
|
||||
VServerStatus status = api.getVirtualServerApi().getStatus(serverId);
|
||||
logger.trace("looking for status on server %s: currently: %s",
|
||||
serverId, status);
|
||||
|
||||
if (status == VServerStatus.ERROR || status == VServerStatus.STOP_ERROR)
|
||||
throw new IllegalStateException("server not around or in error: "
|
||||
+ status);
|
||||
return status == VServerStatus.STOPPED;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.predicates;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.fujitsu.fgcp.FGCPApi;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystemStatus;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dies Koper
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class SystemStatusNormal implements Predicate<String> {
|
||||
|
||||
private final FGCPApi api;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public SystemStatusNormal(FGCPApi api) {
|
||||
this.api = api;
|
||||
}
|
||||
|
||||
public boolean apply(String systemId) {
|
||||
logger.trace("looking for status on system %s", systemId);
|
||||
|
||||
VSystemStatus status = api.getVirtualSystemApi().getStatus(systemId);
|
||||
logger.trace("looking for status on system %s: currently: %s",
|
||||
systemId, status);
|
||||
|
||||
if (status == VSystemStatus.ERROR)
|
||||
throw new IllegalStateException("system in error: " + status);
|
||||
return status == VSystemStatus.NORMAL;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,294 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.fujitsu.fgcp.compute.strategy;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceAdapter;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPApi;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.ResourceIdToFirewallId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.ResourceIdToSystemId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.predicates.ServerStopped;
|
||||
import org.jclouds.fujitsu.fgcp.compute.predicates.SystemStatusNormal;
|
||||
import org.jclouds.fujitsu.fgcp.compute.strategy.VServerMetadata.Builder;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerConfiguration;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
import org.jclouds.fujitsu.fgcp.domain.ServerType;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerWithDetails;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerWithVNICs;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystem;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystemWithDetails;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Defines the connection between the {@link org.jclouds.fujitsu.fgcp.FGCPApi}
|
||||
* implementation and the jclouds {@link org.jclouds.compute.ComputeService}.
|
||||
* Bound in FGCPComputeServiceAdapter.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class FGCPComputeServiceAdapter implements
|
||||
ComputeServiceAdapter<VServerMetadata, ServerType, DiskImage, Location> {
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private final FGCPApi api;
|
||||
private final FGCPAsyncApi asyncApi;
|
||||
protected Predicate<String> serverStopped = null;
|
||||
protected Predicate<String> serverCreated = null;
|
||||
protected Predicate<String> systemNormal = null;
|
||||
protected ResourceIdToFirewallId toFirewallId = null;
|
||||
protected ResourceIdToSystemId toSystemId = null;
|
||||
|
||||
@Inject
|
||||
public FGCPComputeServiceAdapter(FGCPApi api, FGCPAsyncApi asyncApi,
|
||||
ServerStopped serverStopped, SystemStatusNormal systemNormal,
|
||||
Timeouts timeouts, ResourceIdToFirewallId toFirewallId,
|
||||
ResourceIdToSystemId toSystemId) {
|
||||
this.api = checkNotNull(api, "api");
|
||||
this.asyncApi = checkNotNull(asyncApi, "asyncApi");
|
||||
this.serverStopped = new RetryablePredicate<String>(
|
||||
checkNotNull(serverStopped), timeouts.nodeSuspended);
|
||||
this.serverCreated = new RetryablePredicate<String>(
|
||||
checkNotNull(serverStopped), timeouts.nodeRunning);
|
||||
this.systemNormal = new RetryablePredicate<String>(
|
||||
checkNotNull(systemNormal), timeouts.nodeTerminated);
|
||||
this.toFirewallId = checkNotNull(toFirewallId, "ResourceIdToFirewallId");
|
||||
this.toSystemId = checkNotNull(toSystemId, "ResourceIdToSystemId");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public NodeAndInitialCredentials<VServerMetadata> createNodeWithGroupEncodedIntoName(
|
||||
String group, String name, Template template) {
|
||||
// Find vsys (how? create new? default to first found?)
|
||||
// Target network DMZ/SECURE1/SECURE2 (how? default to DMZ?)
|
||||
// Determine remaining params: [vserverType,diskImageId,networkId]
|
||||
// what if no vsys exists yet? Location.AU(.contractId) creates 3? tier
|
||||
// skeleton vsys and DMZ is picked?
|
||||
String id = api.getVirtualSystemApi().createServer(name,
|
||||
template.getHardware().getName(), template.getImage().getId(),
|
||||
template.getLocation().getId());
|
||||
|
||||
// wait until fully created (i.e. transitions to stopped status)
|
||||
serverCreated.apply(id);
|
||||
resumeNode(id);
|
||||
VServerMetadata server = getNode(id);
|
||||
|
||||
//do we need this?
|
||||
server.setTemplate(template);
|
||||
String user = template.getImage().getOperatingSystem().getFamily() == OsFamily.WINDOWS ? "Administrator"
|
||||
: "root";
|
||||
|
||||
return new NodeAndInitialCredentials<VServerMetadata>(server,
|
||||
id, LoginCredentials.builder().identity(user)
|
||||
.password(server.getInitialPassword()).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Iterable<ServerType> listHardwareProfiles() {
|
||||
return api.getVirtualDCApi().listServerTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Iterable<DiskImage> listImages() {
|
||||
return api.getVirtualDCApi().listDiskImages();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public DiskImage getImage(String id) {
|
||||
return api.getDiskImageApi().get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Iterable<Location> listLocations() {
|
||||
// Not using the adapter to determine locations
|
||||
// see SystemAndNetworkSegmentToLocationSupplier
|
||||
return ImmutableSet.<Location> of();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public VServerMetadata getNode(String id) {
|
||||
Builder builder = VServerMetadata.builder();
|
||||
builder.id(id);
|
||||
|
||||
List<ListenableFuture<?>> futures = new ArrayList<ListenableFuture<?>>();
|
||||
|
||||
futures.add(asyncApi.getVirtualServerApi().getDetails(id));
|
||||
futures.add(asyncApi.getVirtualServerApi().getStatus(id));
|
||||
futures.add(asyncApi.getVirtualServerApi().getInitialPassword(id));
|
||||
// mapped public ips?
|
||||
String fwId = toFirewallId.apply(id);
|
||||
// futures.add(asyncApi.getBuiltinServerApi().getConfiguration(fwId,
|
||||
// BuiltinServerConfiguration.SLB_RULE));
|
||||
try {
|
||||
List<Object> results = Futures.successfulAsList(futures).get();
|
||||
VServerWithDetails server = (VServerWithDetails) results.get(0);
|
||||
VServerStatus status = (VServerStatus) results.get(1);
|
||||
System.out.println("getNode(" + id + ")'s getDetails: " + status +" - " + server);
|
||||
if (server == null) {
|
||||
server = api.getVirtualServerApi().getDetails(id);
|
||||
System.out.println("getNode(" + id + ")'s getDetails(2) returns: " + server);
|
||||
}
|
||||
builder.serverWithDetails(server);
|
||||
builder.status(status == null ? VServerStatus.UNRECOGNIZED : status);
|
||||
// System.out.println("status in adapter#getNode: "
|
||||
// + (VServerStatus) results.get(1)
|
||||
// +" for "
|
||||
// + server.getId());
|
||||
builder.initialPassword((String) results.get(2));
|
||||
// SLB slb = ((BuiltinServer) results.get(4)).;
|
||||
// slb.
|
||||
} catch (InterruptedException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Iterable<VServerMetadata> listNodes() {
|
||||
ImmutableSet.Builder<VServerMetadata> servers = ImmutableSet
|
||||
.<VServerMetadata> builder();
|
||||
|
||||
Set<VSystem> systems = api.getVirtualDCApi().listVirtualSystems();
|
||||
List<ListenableFuture<VSystemWithDetails>> futures = new ArrayList<ListenableFuture<VSystemWithDetails>>();
|
||||
for (VSystem system : systems) {
|
||||
|
||||
futures.add(asyncApi.getVirtualSystemApi().getDetails(
|
||||
system.getId()));
|
||||
}
|
||||
try {
|
||||
for (VSystemWithDetails system : Futures.successfulAsList(futures)
|
||||
.get()) {
|
||||
|
||||
if (system != null) {
|
||||
|
||||
for (VServerWithVNICs server : system.getServers()) {
|
||||
|
||||
// skip FW (S-0001) and SLBs (>0 for SLB)
|
||||
if (!server.getId().endsWith("-S-0001") && server.getVnics().iterator().next().getNicNo() == 0) {
|
||||
|
||||
servers.add(getNode(server.getId()));
|
||||
// Builder builder = VServerMetadata.builder();
|
||||
// builder.server(server);
|
||||
// builder.status(VServerStatus.UNRECOGNIZED);
|
||||
// servers.add(builder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
||||
return servers.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void destroyNode(String id) {
|
||||
api.getVirtualServerApi().destroy(id);
|
||||
// wait until fully destroyed
|
||||
String systemId = toSystemId.apply(id);
|
||||
systemNormal.apply(systemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void rebootNode(String id) {
|
||||
suspendNode(id);
|
||||
// wait until fully stopped
|
||||
serverStopped.apply(id);
|
||||
resumeNode(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void resumeNode(String id) {
|
||||
api.getVirtualServerApi().start(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void suspendNode(String id) {
|
||||
api.getVirtualServerApi().stop(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.compute.strategy;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
import org.jclouds.fujitsu.fgcp.domain.PublicIP;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VServerWithVNICs;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Holds metadata on a virtual server, both static (name, id, type, etc.) and
|
||||
* dynamic (status, mapped public IPs, etc.).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class VServerMetadata {
|
||||
|
||||
protected VServer server;
|
||||
protected String id;
|
||||
protected String name;
|
||||
protected Template template;
|
||||
protected String initialPassword;
|
||||
protected VServerStatus status = VServerStatus.UNRECOGNIZED;
|
||||
protected Set<PublicIP> ips;
|
||||
protected DiskImage image;
|
||||
|
||||
public VServerMetadata(VServer server, String initialPassword,
|
||||
VServerStatus status, DiskImage image, Set<PublicIP> publicIps) {
|
||||
this.server = checkNotNull(server, "server");
|
||||
this.initialPassword = initialPassword;
|
||||
this.status = status;
|
||||
this.image = image;
|
||||
this.ips = publicIps;
|
||||
id = server.getId();
|
||||
name = server.getName();
|
||||
}
|
||||
|
||||
public VServerMetadata(String id, String name, Template template,
|
||||
VServerStatus status) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.template = checkNotNull(template, "template");
|
||||
this.status = checkNotNull(status, "status");
|
||||
}
|
||||
|
||||
public VServer getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Template getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
public void setTemplate(Template template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public String getInitialPassword() {
|
||||
return initialPassword;
|
||||
}
|
||||
|
||||
public VServerStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public Set<PublicIP> getIps() {
|
||||
return ips;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private VServer server;
|
||||
private VServerWithVNICs serverWithDetails;
|
||||
private String id;
|
||||
private String name;
|
||||
private Template template;
|
||||
private String initialPassword;
|
||||
private VServerStatus status = VServerStatus.UNRECOGNIZED;
|
||||
private Set<PublicIP> publicIps = ImmutableSet.of();
|
||||
private DiskImage image;
|
||||
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder template(Template template) {
|
||||
this.template = template;
|
||||
return this;
|
||||
}
|
||||
|
||||
// public Builder server(VServer server) {
|
||||
// this.server = server;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public Builder serverWithDetails(VServerWithVNICs serverWithDetails) {
|
||||
this.serverWithDetails = serverWithDetails;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder initialPassword(String password) {
|
||||
this.initialPassword = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder status(VServerStatus status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder image(DiskImage image) {
|
||||
this.image = image;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder publicIps(Set<PublicIP> publicIps) {
|
||||
this.publicIps = publicIps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VServerMetadata build() {
|
||||
if (initialPassword == null) initialPassword = "";
|
||||
if (server != null) {
|
||||
return new VServerMetadata(server, initialPassword, status,
|
||||
image, publicIps);
|
||||
} else if (serverWithDetails != null) {
|
||||
return new VServerMetadata(serverWithDetails, initialPassword,
|
||||
status, image, publicIps);
|
||||
} else {
|
||||
// sometimes these fields are null because the server is returning a verify error
|
||||
if (id == null) id = "dummy-id";
|
||||
if (name == null) name = "dummy-name";
|
||||
return new VServerMetadata(id, name, template, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* Describes the address range pool in a contract used for allocating private IP
|
||||
* address network segments for virtual systems.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "addressrange")
|
||||
public class AddressRange {
|
||||
private String range;
|
||||
|
||||
private String from;
|
||||
|
||||
private String to;
|
||||
|
||||
/**
|
||||
* @return the range
|
||||
*/
|
||||
public String getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the from
|
||||
*/
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the to
|
||||
*/
|
||||
public String getTo() {
|
||||
return to;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* Represents a built-in server, also called extended function module (EFM),
|
||||
* such as a firewall or load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "efm")
|
||||
public class BuiltinServer {
|
||||
@XmlElement(name = "efmId")
|
||||
private String id;
|
||||
@XmlElement(name = "efmType")
|
||||
private BuiltinServerType builtinServerType;
|
||||
@XmlElement(name = "efmName")
|
||||
private String name;
|
||||
private String creator;
|
||||
private String slbVip;
|
||||
private Firewall firewall;
|
||||
private SLB loadbalancer;
|
||||
|
||||
public enum BuiltinServerType {FW, SLB}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BuiltinServerType getType() {
|
||||
return builtinServerType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public String getSlbVip() {
|
||||
return slbVip;
|
||||
}
|
||||
|
||||
public Firewall getFirewall() {
|
||||
return firewall;
|
||||
}
|
||||
|
||||
public SLB getLoadbalancer() {
|
||||
return loadbalancer;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Holds information on a backup of a built-in server, such as a firewall or
|
||||
* load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "backup")
|
||||
public class BuiltinServerBackup {
|
||||
@XmlElement(name = "backupId")
|
||||
private String id;
|
||||
@XmlElement(name = "backupTime")
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the time
|
||||
*/
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
BuiltinServerBackup that = BuiltinServerBackup.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("time", time).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
/**
|
||||
* Possible statuses of a built-in server, also called extended function module
|
||||
* (EFM), such as a firewall or load balancer (SLB).
|
||||
* <p>
|
||||
* In addition to statuses that apply to regular virtual servers, it includes
|
||||
* statuses relevant to the upgrade process for functionality of the built-in
|
||||
* server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public enum BuiltinServerConfiguration {
|
||||
FW_NAT_RULE,
|
||||
FW_DNS,
|
||||
FW_POLICY,
|
||||
FW_LOG,
|
||||
FW_LIMIT_POLICY,
|
||||
SLB_RULE,
|
||||
SLB_LOAD_STATISTICS,
|
||||
SLB_ERROR_STATISTICS,
|
||||
SLB_CERTIFICATE_LIST,
|
||||
EFM_UPDATE,
|
||||
SLB_CONNECTION,
|
||||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static BuiltinServerConfiguration fromValue(String configuration) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(configuration, "configuration")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Possible statuses of a built-in server, also called extended function module
|
||||
* (EFM), such as a firewall or load balancer (SLB).
|
||||
* <p>
|
||||
* In addition to statuses that apply to regular virtual servers, it includes
|
||||
* statuses relevant to the upgrade process for functionality of the built-in
|
||||
* server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "efmStatus")
|
||||
public enum BuiltinServerStatus {
|
||||
DEPLOYING, RUNNING, STOPPING, STOPPED, STARTING, FAILOVER, UNEXPECTED_STOP, RESTORING, BACKUP_ING, ERROR, EXECUTE_NETWORK_SERVER, START_ERROR, STOP_ERROR, UPDATE, BACKOUT, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static BuiltinServerStatus fromValue(String status) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Describes the virtual CPU of a server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "cpu")
|
||||
public class CPU {
|
||||
@XmlElement(name = "cpuArch")
|
||||
private String arch;
|
||||
@XmlElement(name = "cpuPerf")
|
||||
private double speedPerCore;
|
||||
@XmlElement(name = "numOfCpu")
|
||||
private double cores;
|
||||
|
||||
public String getArch() {
|
||||
return arch;
|
||||
}
|
||||
|
||||
public double getSpeedPerCore() {
|
||||
return speedPerCore;
|
||||
}
|
||||
|
||||
public double getCores() {
|
||||
return cores;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(cores, speedPerCore, arch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CPU that = CPU.class.cast(obj);
|
||||
return Objects.equal(this.cores, that.cores)
|
||||
&& Objects.equal(this.speedPerCore, that.speedPerCore)
|
||||
&& Objects.equal(this.arch, that.arch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("cores", cores).add("speedPerCore", speedPerCore)
|
||||
.add("arch", arch).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a load balancer (SLB) log entry.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Cause {
|
||||
private String cat;
|
||||
|
||||
private String status;
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String current;
|
||||
|
||||
private String before;
|
||||
|
||||
private String today;
|
||||
|
||||
private String yesterday;
|
||||
|
||||
private String total;
|
||||
|
||||
/**
|
||||
* @return category
|
||||
*/
|
||||
public String getCat() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the filePath
|
||||
*/
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current
|
||||
*/
|
||||
public String getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the before
|
||||
*/
|
||||
public String getBefore() {
|
||||
return before;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the today
|
||||
*/
|
||||
public String getToday() {
|
||||
return today;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yesterday
|
||||
*/
|
||||
public String getYesterday() {
|
||||
return yesterday;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the total
|
||||
*/
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Grouping of firewall rules pertaining to a particular direction in network
|
||||
* traffic, e.g. from the Internet to a server in the DMZ zone, or from a server
|
||||
* in the SECURE2 zone to the SECURE1 zone, etc.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Direction {
|
||||
private String from;
|
||||
private String to;
|
||||
private Set<Policy> policies = new LinkedHashSet<Policy>();
|
||||
private Acceptable acceptable;
|
||||
private Prefix prefix;
|
||||
private int maxPolicyNum;
|
||||
|
||||
enum Acceptable {OK, NG}
|
||||
enum Prefix {free, src, dst, proto, srcport, dstport, action, rule, tab}
|
||||
|
||||
/**
|
||||
* @return the from
|
||||
*/
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the to
|
||||
*/
|
||||
public String getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the policies
|
||||
*/
|
||||
public Set<Policy> getPolicies() {
|
||||
return policies == null ? ImmutableSet.<Policy> of() : ImmutableSet
|
||||
.copyOf(policies);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the acceptable
|
||||
*/
|
||||
public Acceptable getAcceptable() {
|
||||
return acceptable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prefix
|
||||
*/
|
||||
public Prefix getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maxPolicyNum
|
||||
*/
|
||||
public int getMaxPolicyNum() {
|
||||
return maxPolicyNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Direction that = Direction.class.cast(obj);
|
||||
return Objects.equal(this.from, that.from)
|
||||
&& Objects.equal(this.to, that.to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("from", from)
|
||||
.add("to", to).add("prefix", prefix).add("policies", policies)
|
||||
.add("maxPolicyNum", maxPolicyNum)
|
||||
.add("acceptable", acceptable).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* Describes a disk as part of the description of hardware represented by a
|
||||
* virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement
|
||||
public class Disk {
|
||||
@XmlElement(name = "diskSize")
|
||||
private String size;
|
||||
|
||||
@XmlElement(name = "diskUsage")
|
||||
private String usage;
|
||||
|
||||
@XmlElement(name = "diskType")
|
||||
private String type;
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (!(o instanceof Disk))
|
||||
return false;
|
||||
|
||||
Disk disk = (Disk) o;
|
||||
|
||||
if (size != null ? !size.equals(disk.size) : disk.size != null)
|
||||
return false;
|
||||
if (type != null ? !type.equals(disk.type) : disk.type != null)
|
||||
return false;
|
||||
if (usage != null ? !usage.equals(disk.usage) : disk.usage != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = size != null ? size.hashCode() : 0;
|
||||
result = 31 * result + (usage != null ? usage.hashCode() : 0);
|
||||
result = 31 * result + (type != null ? type.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Disk{" + "size='" + size + '\'' + ", usage='" + usage + '\''
|
||||
+ ", type='" + type + '\'' + '}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Represents a disk image with pre-installed OS and/or software.
|
||||
* <p>
|
||||
* It is used as base for the system disk of a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "diskimage")
|
||||
public class DiskImage {
|
||||
@XmlElement(name = "diskimageId")
|
||||
private String id;
|
||||
|
||||
@XmlElement(name = "diskimageName")
|
||||
private String name;
|
||||
|
||||
private int size;
|
||||
|
||||
private String osName;
|
||||
|
||||
private String osType;
|
||||
|
||||
private String creatorName;
|
||||
|
||||
private String registrant;
|
||||
|
||||
private String licenseInfo;
|
||||
|
||||
private String description;
|
||||
|
||||
@XmlElementWrapper(name = "softwares")
|
||||
@XmlElement(name = "software")
|
||||
private Set<Software> software = new LinkedHashSet<Software>();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getOsName() {
|
||||
return osName;
|
||||
}
|
||||
|
||||
public String getOsType() {
|
||||
return osType;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public String getRegistrant() {
|
||||
return registrant;
|
||||
}
|
||||
|
||||
public String getLicenseInfo() {
|
||||
return licenseInfo;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Set<Software> getSoftware() {
|
||||
return software == null ? ImmutableSet.<Software> of() : ImmutableSet
|
||||
.copyOf(software);
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String id;
|
||||
private String name;
|
||||
private int size;
|
||||
private String osName;
|
||||
private String osType;
|
||||
private String creatorName;
|
||||
private String registrant;
|
||||
private String licenseInfo;
|
||||
private String description;
|
||||
private Set<Software> software;
|
||||
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder osName(String osName) {
|
||||
this.osName = osName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder osType(String osType) {
|
||||
this.osType = osType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder creatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder registrant(String registrant) {
|
||||
this.registrant = registrant;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiskImage build() {
|
||||
DiskImage image = new DiskImage();
|
||||
|
||||
image.id = id;
|
||||
image.name = name;
|
||||
image.size = size;
|
||||
image.osName = osName;
|
||||
image.osType = osType;
|
||||
image.creatorName = creatorName;
|
||||
image.registrant = registrant;
|
||||
image.licenseInfo = licenseInfo;
|
||||
image.description = description;
|
||||
image.software = software;
|
||||
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
DiskImage that = DiskImage.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("osName", osName).add("osType", osType)
|
||||
.add("size", size).add("creatorName", creatorName)
|
||||
.add("description", description)
|
||||
.add("licenseInfo", licenseInfo).add("registrant", registrant)
|
||||
.add("software", software).toString();
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Holds statistics of errors reported by a load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "errorstatistics")
|
||||
public class ErrorStatistics {
|
||||
private Period period;
|
||||
private Set<Group> groups = new LinkedHashSet<Group>();
|
||||
|
||||
/**
|
||||
* @return the period
|
||||
*/
|
||||
public Period getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groups
|
||||
*/
|
||||
public Set<Group> getGroups() {
|
||||
return groups == null ? ImmutableSet.<Group> of() : ImmutableSet
|
||||
.copyOf(groups);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents an entry in the event log.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "errorlog")
|
||||
public class EventLog {
|
||||
private String title;
|
||||
private String message;
|
||||
private String startDate;
|
||||
private String expiry;
|
||||
private String entryDate;
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the startDate
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expiry
|
||||
*/
|
||||
public String getExpiry() {
|
||||
return expiry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryDate
|
||||
*/
|
||||
public String getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(entryDate, message, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
EventLog that = EventLog.class.cast(obj);
|
||||
return Objects.equal(this.entryDate, that.entryDate)
|
||||
&& Objects.equal(this.message, that.message)
|
||||
&& Objects.equal(this.title, that.title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("entryDate", entryDate).add("title", title)
|
||||
.add("message", message).add("startDate", startDate)
|
||||
.add("expiry", expiry).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Represents a firewall (FW).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "fw")
|
||||
public class Firewall {
|
||||
private NAT nat;
|
||||
private Set<Direction> directions = new LinkedHashSet<Direction>();
|
||||
private String log;
|
||||
private String status;
|
||||
private String category;
|
||||
private String latestVersion;
|
||||
private String comment;
|
||||
private boolean firmUpdateExist;
|
||||
private boolean configUpdateExist;
|
||||
private String backout;
|
||||
private String updateDate;
|
||||
private String currentVersion;
|
||||
|
||||
/**
|
||||
* @return the nat
|
||||
*/
|
||||
public NAT getNat() {
|
||||
return nat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the directions
|
||||
*/
|
||||
public Set<Direction> getDirections() {
|
||||
return directions == null ? ImmutableSet.<Direction> of()
|
||||
: ImmutableSet.copyOf(directions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the log
|
||||
*/
|
||||
public String getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the category
|
||||
*/
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the latestVersion
|
||||
*/
|
||||
public String getLatestVersion() {
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the comment
|
||||
*/
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the firmUpdateExist
|
||||
*/
|
||||
public boolean getFirmUpdateExist() {
|
||||
return firmUpdateExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configUpdateExist
|
||||
*/
|
||||
public boolean getConfigUpdateExist() {
|
||||
return configUpdateExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the backout
|
||||
*/
|
||||
public String getBackout() {
|
||||
return backout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the updateDate
|
||||
*/
|
||||
public String getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentVersion
|
||||
*/
|
||||
public String getCurrentVersion() {
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Describes attributes of a software load balancer's (SLB) configuration.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Group {
|
||||
private int id;
|
||||
|
||||
private String protocol;
|
||||
|
||||
private int port1;
|
||||
|
||||
private int port2;
|
||||
|
||||
private String balanceType;
|
||||
|
||||
private String uniqueType;
|
||||
|
||||
private String monitorType;
|
||||
|
||||
private int maxConnection;
|
||||
|
||||
private int uniqueRetention;
|
||||
|
||||
private int interval;
|
||||
|
||||
private int timeout;
|
||||
|
||||
private int retryCount;
|
||||
|
||||
private int certNum;
|
||||
|
||||
private Set<Cause> causes;
|
||||
|
||||
private RecoveryAction recoveryAction;
|
||||
|
||||
private Set<Target> targets = new LinkedHashSet<Target>();
|
||||
|
||||
private String validity;
|
||||
|
||||
enum RecoveryAction {
|
||||
@XmlEnumValue("switch-back")
|
||||
SWITCH_BACK, @XmlEnumValue("maintenance")
|
||||
MAINTENANCE
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the protocol
|
||||
*/
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port1
|
||||
*/
|
||||
public int getPort1() {
|
||||
return port1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port2
|
||||
*/
|
||||
public int getPort2() {
|
||||
return port2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the balanceType
|
||||
*/
|
||||
public String getBalanceType() {
|
||||
return balanceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the uniqueType
|
||||
*/
|
||||
public String getUniqueType() {
|
||||
return uniqueType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the monitorType
|
||||
*/
|
||||
public String getMonitorType() {
|
||||
return monitorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maxConnection
|
||||
*/
|
||||
public int getMaxConnection() {
|
||||
return maxConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the uniqueRetention
|
||||
*/
|
||||
public int getUniqueRetention() {
|
||||
return uniqueRetention;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the interval
|
||||
*/
|
||||
public int getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the timeout
|
||||
*/
|
||||
public int getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the retryCount
|
||||
*/
|
||||
public int getRetryCount() {
|
||||
return retryCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the certNum
|
||||
*/
|
||||
public int getCertNum() {
|
||||
return certNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the causes
|
||||
*/
|
||||
public Set<Cause> getCauses() {
|
||||
return causes == null ? ImmutableSet.<Cause> of() : ImmutableSet
|
||||
.copyOf(causes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the recoveryAction
|
||||
*/
|
||||
public RecoveryAction getRecoveryAction() {
|
||||
return recoveryAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targets
|
||||
*/
|
||||
public Set<Target> getTargets() {
|
||||
return targets == null ? ImmutableSet.<Target> of() : ImmutableSet
|
||||
.copyOf(targets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the validity
|
||||
*/
|
||||
public String getValidity() {
|
||||
return validity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Group that = Group.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("protocol", protocol).add("port1", port1)
|
||||
.add("port2", port2).add("balanceType", balanceType)
|
||||
.add("uniqueType", uniqueType).add("monitorType", monitorType)
|
||||
.add("maxConnection", maxConnection)
|
||||
.add("uniqueRetention", uniqueRetention)
|
||||
.add("interval", interval).add("timeout", timeout)
|
||||
.add("retryCount", retryCount).add("certNum", certNum)
|
||||
.add("causes", causes).add("recoveryAction", recoveryAction)
|
||||
.add("targets", targets).add("validity", validity).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Holds information on the system disk image of a virtual server, including the
|
||||
* OS and software pre-installed on it.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Image {
|
||||
private String id;
|
||||
|
||||
private String serverCategory;
|
||||
|
||||
private String serverApplication;
|
||||
|
||||
private String cpuBit;
|
||||
|
||||
private float sysvolSize;
|
||||
|
||||
private int numOfMaxDisk;
|
||||
|
||||
private int numOfMaxNic;
|
||||
|
||||
@XmlElementWrapper(name = "softwares")
|
||||
@XmlElement(name = "software")
|
||||
private Set<Software> software = new LinkedHashSet<Software>();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getServerCategory() {
|
||||
return serverCategory;
|
||||
}
|
||||
|
||||
public String getServerApplication() {
|
||||
return serverApplication;
|
||||
}
|
||||
|
||||
public String getCpuBit() {
|
||||
return cpuBit;
|
||||
}
|
||||
|
||||
public float getSysvolSize() {
|
||||
return sysvolSize;
|
||||
}
|
||||
|
||||
public int getNumOfMaxDisk() {
|
||||
return numOfMaxDisk;
|
||||
}
|
||||
|
||||
public int getNumOfMaxNic() {
|
||||
return numOfMaxNic;
|
||||
}
|
||||
|
||||
public Set<Software> getSoftware() {
|
||||
return software == null ? ImmutableSet.<Software> of() : ImmutableSet
|
||||
.copyOf(software);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Image that = Image.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("serverCategory", serverCategory)
|
||||
.add("serverApplication", serverApplication)
|
||||
.add("cpuBit", cpuBit).add("sysvolSize", sysvolSize)
|
||||
.add("numOfMaxDisk", numOfMaxDisk)
|
||||
.add("numOfMaxNic", numOfMaxNic).toString();
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Holds information relating to the FGCP service.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Information {
|
||||
private int seqno;
|
||||
private String title;
|
||||
private String message;
|
||||
private String startDate;
|
||||
private String expiry;
|
||||
private String entryDate;
|
||||
|
||||
/**
|
||||
* @return the seqno
|
||||
*/
|
||||
public int getSeqno() {
|
||||
return seqno;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the startDate
|
||||
*/
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expiry
|
||||
*/
|
||||
public String getExpiry() {
|
||||
return expiry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryDate
|
||||
*/
|
||||
public String getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(seqno, entryDate, message, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Information that = Information.class.cast(obj);
|
||||
return Objects.equal(this.seqno, that.seqno)
|
||||
&& Objects.equal(this.entryDate, that.entryDate)
|
||||
&& Objects.equal(this.message, that.message)
|
||||
&& Objects.equal(this.title, that.title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("seqno", seqno).add("entryDate", entryDate)
|
||||
.add("title", title).add("message", message)
|
||||
.add("startDate", startDate).add("expiry", expiry).toString();
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Describes an intermediate CA certificate for use with a load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "ccacert")
|
||||
public class IntermediateCACert implements Comparable<IntermediateCACert> {
|
||||
private int ccacertNum;
|
||||
|
||||
private String description;
|
||||
|
||||
private String subject;
|
||||
|
||||
private String issuer;
|
||||
|
||||
private String validity;
|
||||
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* @return the ccacertNum
|
||||
*/
|
||||
public int getCcacertNum() {
|
||||
return ccacertNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the issuer
|
||||
*/
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the validity
|
||||
*/
|
||||
public String getValidity() {
|
||||
return validity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the detail
|
||||
*/
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(ccacertNum, issuer, subject, validity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
IntermediateCACert that = IntermediateCACert.class.cast(obj);
|
||||
return Objects.equal(this.ccacertNum, that.ccacertNum)
|
||||
&& Objects.equal(this.issuer, that.issuer)
|
||||
&& Objects.equal(this.subject, that.subject)
|
||||
&& Objects.equal(this.validity, that.validity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("ccacertNum", ccacertNum).add("issuer", issuer)
|
||||
.add("subject", subject).add("validity", validity)
|
||||
.add("description", description).add("detail", detail)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(IntermediateCACert o) {
|
||||
return ccacertNum - o.ccacertNum;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Holds statistics of the load on a load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "loadstatistics")
|
||||
public class LoadStatistics {
|
||||
private Set<Group> groups = new LinkedHashSet<Group>();
|
||||
|
||||
/**
|
||||
* @return the groups
|
||||
*/
|
||||
public Set<Group> getGroups() {
|
||||
return groups == null ? ImmutableSet.<Group> of() : ImmutableSet
|
||||
.copyOf(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
LoadStatistics that = LoadStatistics.class.cast(obj);
|
||||
return Objects.equal(this.groups, that.groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("groups", groups).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents the memory of a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Memory implements Comparable<Memory> {
|
||||
@XmlElement(name = "memorySize")
|
||||
private double size;
|
||||
|
||||
public double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Memory that = Memory.class.cast(obj);
|
||||
return Objects.equal(this.size, that.size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("size", size)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Memory o) {
|
||||
return Double.compare(size, o.size);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Holds the network address translation rules of a firewall.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class NAT {
|
||||
private Set<Rule> rules = new LinkedHashSet<Rule>();
|
||||
|
||||
/**
|
||||
* @return the rules
|
||||
*/
|
||||
public Set<Rule> getRules() {
|
||||
return rules == null ? ImmutableSet.<Rule> of() : ImmutableSet
|
||||
.copyOf(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
NAT that = NAT.class.cast(obj);
|
||||
return Objects.equal(this.rules, that.rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("rules", rules).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Holds the statistics of a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "performanceinfo")
|
||||
public class PerformanceInfo implements Comparable<PerformanceInfo> {
|
||||
private long recordTime;
|
||||
private double cpuUtilization;
|
||||
private long diskReadRequestCount;
|
||||
private long diskWriteRequestCount;
|
||||
private long diskReadSector;
|
||||
private long diskWriteSector;
|
||||
private long nicInputByte;
|
||||
private long nicOutputByte;
|
||||
private long nicInputPacket;
|
||||
private long nicOutputPacket;
|
||||
|
||||
/**
|
||||
* @return the recordTime
|
||||
*/
|
||||
public long getRecordTime() {
|
||||
return recordTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cpuUtilization
|
||||
*/
|
||||
public double getCpuUtilization() {
|
||||
return cpuUtilization;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the diskReadRequestCount
|
||||
*/
|
||||
public long getDiskReadRequestCount() {
|
||||
return diskReadRequestCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the diskWriteRequestCount
|
||||
*/
|
||||
public long getDiskWriteRequestCount() {
|
||||
return diskWriteRequestCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the diskReadSector
|
||||
*/
|
||||
public long getDiskReadSector() {
|
||||
return diskReadSector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the diskWriteSector
|
||||
*/
|
||||
public long getDiskWriteSector() {
|
||||
return diskWriteSector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nicInputByte
|
||||
*/
|
||||
public long getNicInputByte() {
|
||||
return nicInputByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nicOutputByte
|
||||
*/
|
||||
public long getNicOutputByte() {
|
||||
return nicOutputByte;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nicInputPacket
|
||||
*/
|
||||
public long getNicInputPacket() {
|
||||
return nicInputPacket;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nicOutputPacket
|
||||
*/
|
||||
public long getNicOutputPacket() {
|
||||
return nicOutputPacket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(recordTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PerformanceInfo that = PerformanceInfo.class.cast(obj);
|
||||
return Objects.equal(this.recordTime, that.recordTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("recordTime", recordTime)
|
||||
.add("cpuUtilization", cpuUtilization)
|
||||
.add("diskReadRequestCount", diskReadRequestCount)
|
||||
.add("diskWriteRequestCount", diskWriteRequestCount)
|
||||
.add("diskReadSector", diskReadSector)
|
||||
.add("diskWriteSector", diskWriteSector)
|
||||
.add("nicInputByte", nicInputByte)
|
||||
.add("nicOutputByte", nicOutputByte)
|
||||
.add("nicInputPacket", nicInputPacket)
|
||||
.add("nicOutputPacket", nicOutputPacket).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PerformanceInfo o) {
|
||||
return (int) (recordTime - o.recordTime);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
/**
|
||||
* Describes the period over which error statistics of a load balancer (SLB) are
|
||||
* kept.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Period {
|
||||
private String current;
|
||||
private String before;
|
||||
private String today;
|
||||
private String yesterday;
|
||||
|
||||
/**
|
||||
* @return the current
|
||||
*/
|
||||
public String getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the before
|
||||
*/
|
||||
public String getBefore() {
|
||||
return before;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the today
|
||||
*/
|
||||
public String getToday() {
|
||||
return today;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yesterday
|
||||
*/
|
||||
public String getYesterday() {
|
||||
return yesterday;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Describes a firewall rule in detail.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Policy implements Comparable<Policy> {
|
||||
private int id;
|
||||
|
||||
private String src;
|
||||
|
||||
private PolicyType srcType;
|
||||
|
||||
private String srcPort;
|
||||
|
||||
private Service dstService;
|
||||
|
||||
private String dst;
|
||||
|
||||
private PolicyType dstType;
|
||||
|
||||
private String dstPort;
|
||||
|
||||
private Protocol protocol;
|
||||
|
||||
private Action action;
|
||||
|
||||
private Log log;
|
||||
|
||||
enum Service {
|
||||
NONE, WSUS, DNS, NTP, @XmlEnumValue("yum")
|
||||
YUM, KMS, @XmlEnumValue("Symantec")
|
||||
SYMANTEC, RHUI
|
||||
}
|
||||
|
||||
enum PolicyType {IP, FQDN, FQDNF}
|
||||
|
||||
enum Protocol {
|
||||
@XmlEnumValue("tcp")
|
||||
TCP, @XmlEnumValue("udp")
|
||||
UDP, @XmlEnumValue("tcp-udp")
|
||||
TCP_UDP, @XmlEnumValue("icmp")
|
||||
ICMP
|
||||
}
|
||||
|
||||
enum Action {
|
||||
@XmlEnumValue("Accept")
|
||||
ACCEPT, @XmlEnumValue("Deny")
|
||||
DENY
|
||||
}
|
||||
|
||||
enum Log {
|
||||
@XmlEnumValue("On")
|
||||
ON, @XmlEnumValue("Off")
|
||||
OFF
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the src
|
||||
*/
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the srcType
|
||||
*/
|
||||
public PolicyType getSrcType() {
|
||||
return srcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the srcPort
|
||||
*/
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstService
|
||||
*/
|
||||
public Service getDstService() {
|
||||
return dstService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dst
|
||||
*/
|
||||
public String getDst() {
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstType
|
||||
*/
|
||||
public PolicyType getDstType() {
|
||||
return dstType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dstPort
|
||||
*/
|
||||
public String getDstPort() {
|
||||
return dstPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the protocol
|
||||
*/
|
||||
public Protocol getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the action
|
||||
*/
|
||||
public Action getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the log
|
||||
*/
|
||||
public Log getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Policy that = Policy.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("id", id)
|
||||
.add("src", src)
|
||||
.add("srcType", srcType)
|
||||
.add("srcPort", srcPort)
|
||||
.add("dstService", dstService)
|
||||
.add("dst", dst)
|
||||
.add("dstType", dstType)
|
||||
.add("dstPort", dstPort)
|
||||
.add("protocol", protocol)
|
||||
.add("action", action)
|
||||
.add("log", log).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Policy o) {
|
||||
return id - o.id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a product for which usage information can be queried.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Product {
|
||||
@XmlElement(name = "productName")
|
||||
private String name;
|
||||
|
||||
private String unitName;
|
||||
|
||||
private String usedPoints;
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unitName
|
||||
*/
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the usedPoints
|
||||
*/
|
||||
public String getUsedPoints() {
|
||||
return usedPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, unitName, usedPoints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Product that = Product.class.cast(obj);
|
||||
return Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.unitName, that.unitName)
|
||||
&& Objects.equal(this.usedPoints, that.usedPoints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("name", name)
|
||||
.add("unitName", unitName).add("usedPoints", usedPoints)
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a public IP address.
|
||||
* <p>
|
||||
* A public IP address can be allocated to a virtual system, then needs to be
|
||||
* enabled/attached before it can be mapped to a virtual server by configuring
|
||||
* the NAT settings of virtual system's firewall.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class PublicIP {
|
||||
|
||||
public static enum Version {
|
||||
IPv4, IPv6, UNRECOGNIZED;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL,
|
||||
name());
|
||||
}
|
||||
|
||||
public static Version fromValue(String version) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL.to(
|
||||
CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(version, "version")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected String address;
|
||||
@XmlElement(name = "v4v6Flag")
|
||||
protected Version version;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public Version getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PublicIP that = PublicIP.class.cast(obj);
|
||||
return Objects.equal(this.address, that.address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("address", address).add("version", version).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Possible statuses of a public IP address.
|
||||
* <p>
|
||||
* An attached public IP address is enabled for a particular virtual system and
|
||||
* or may not be mapped to a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "publicipStatus")
|
||||
public enum PublicIPStatus {
|
||||
ATTACHED, ATTACHING, DETACHING, DETACHED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static PublicIPStatus fromValue(String status) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a network address translation or network address port translation
|
||||
* rule.
|
||||
* <p>
|
||||
* A rule either maps a public IP address to the NIC of a virtual server for
|
||||
* incoming network traffic, or specifies the public IP address used as source
|
||||
* address for traffic from all servers in the virtual system.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Rule {
|
||||
private String publicIp;
|
||||
private String privateIp;
|
||||
private boolean snapt;
|
||||
|
||||
/**
|
||||
* @return the publicIp
|
||||
*/
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the privateIp
|
||||
*/
|
||||
public String getPrivateIp() {
|
||||
return privateIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the snapt
|
||||
*/
|
||||
public boolean isSnapt() {
|
||||
return snapt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(privateIp, publicIp, snapt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Rule that = Rule.class.cast(obj);
|
||||
return Objects.equal(this.privateIp, that.privateIp)
|
||||
&& Objects.equal(this.publicIp, that.publicIp)
|
||||
&& Objects.equal(this.snapt, that.snapt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("privateIp", privateIp).add("publicIp", publicIp)
|
||||
.add("snapt", snapt).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Represents a software load balancer.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "slb")
|
||||
public class SLB extends BuiltinServer {
|
||||
private String ipAddress;
|
||||
|
||||
private Set<IntermediateCACert> ccacerts = new LinkedHashSet<IntermediateCACert>();
|
||||
|
||||
private Set<ServerCert> servercerts = new LinkedHashSet<ServerCert>();
|
||||
|
||||
private Set<Group> groups;
|
||||
|
||||
private String srcType;
|
||||
|
||||
private String srcPort;
|
||||
|
||||
private String status;
|
||||
|
||||
private ErrorStatistics errorStatistics;
|
||||
|
||||
private LoadStatistics loadStatistics;
|
||||
|
||||
private String category;
|
||||
|
||||
private String latestVersion;
|
||||
|
||||
private String comment;
|
||||
|
||||
private boolean firmUpdateExist;
|
||||
|
||||
private boolean configUpdateExist;
|
||||
|
||||
private boolean backout;
|
||||
|
||||
private String updateDate;
|
||||
|
||||
private String currentVersion;
|
||||
|
||||
private String webAccelerator;
|
||||
|
||||
/**
|
||||
* @return the ipAddress
|
||||
*/
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ccacerts
|
||||
*/
|
||||
public Set<IntermediateCACert> getCcacerts() {
|
||||
return ccacerts == null ? ImmutableSet.<IntermediateCACert> of()
|
||||
: ImmutableSet.copyOf(ccacerts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the servercerts
|
||||
*/
|
||||
public Set<ServerCert> getServercerts() {
|
||||
return servercerts == null ? ImmutableSet.<ServerCert> of()
|
||||
: ImmutableSet.copyOf(servercerts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groups
|
||||
*/
|
||||
public Set<Group> getGroups() {
|
||||
return groups == null ? ImmutableSet.<Group> of() : ImmutableSet
|
||||
.copyOf(groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the srcType
|
||||
*/
|
||||
public String getSrcType() {
|
||||
return srcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the srcPort
|
||||
*/
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the errorStatistics
|
||||
*/
|
||||
public ErrorStatistics getErrorStatistics() {
|
||||
return errorStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loadStatistics
|
||||
*/
|
||||
public LoadStatistics getLoadStatistics() {
|
||||
return loadStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the category
|
||||
*/
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the latestVersion
|
||||
*/
|
||||
public String getLatestVersion() {
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the comment
|
||||
*/
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the firmUpdateExist
|
||||
*/
|
||||
public boolean getFirmUpdateExist() {
|
||||
return firmUpdateExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configUpdateExist
|
||||
*/
|
||||
public boolean getConfigUpdateExist() {
|
||||
return configUpdateExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the backout
|
||||
*/
|
||||
public boolean getBackout() {
|
||||
return backout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the updateDate
|
||||
*/
|
||||
public String getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentVersion
|
||||
*/
|
||||
public String getCurrentVersion() {
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the webAccelerator
|
||||
*/
|
||||
public String getWebAccelerator() {
|
||||
return webAccelerator;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Describes a server certificate for use with a load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "servercert")
|
||||
public class ServerCert implements Comparable<ServerCert> {
|
||||
private int certNum;
|
||||
|
||||
private String subject;
|
||||
|
||||
private String issuer;
|
||||
|
||||
private String validity;
|
||||
|
||||
private int groupId;
|
||||
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* @return the certNum
|
||||
*/
|
||||
public int getCertNum() {
|
||||
return certNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the issuer
|
||||
*/
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the validity
|
||||
*/
|
||||
public String getValidity() {
|
||||
return validity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groupId
|
||||
*/
|
||||
public int getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the detail
|
||||
*/
|
||||
public String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(certNum, groupId, issuer, subject, validity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServerCert that = ServerCert.class.cast(obj);
|
||||
return Objects.equal(this.certNum, that.certNum)
|
||||
&& Objects.equal(this.groupId, that.groupId)
|
||||
&& Objects.equal(this.issuer, that.issuer)
|
||||
&& Objects.equal(this.subject, that.subject)
|
||||
&& Objects.equal(this.validity, that.validity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("certNum", certNum).add("issuer", issuer)
|
||||
.add("subject", subject).add("validity", validity)
|
||||
.add("groupId", groupId).add("detail", detail).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ServerCert o) {
|
||||
return (certNum - o.certNum) == 0 ? (groupId - o.groupId)
|
||||
: (certNum - o.certNum);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Describes the hardware of a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "servertype")
|
||||
public class ServerType implements Comparable<ServerType> {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String label;
|
||||
|
||||
private String comment;
|
||||
|
||||
private String productId;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String price;
|
||||
|
||||
private String chargeType;
|
||||
|
||||
private String expectedUsage;
|
||||
|
||||
private CPU cpu;
|
||||
|
||||
private Memory memory;
|
||||
|
||||
@XmlElementWrapper(name = "disks")
|
||||
@XmlElement(name = "disk")
|
||||
private Set<Disk> disks = Sets.newLinkedHashSet();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public String getChargeType() {
|
||||
return chargeType;
|
||||
}
|
||||
|
||||
public String getExpectedUsage() {
|
||||
return expectedUsage;
|
||||
}
|
||||
|
||||
public CPU getCpu() {
|
||||
return cpu;
|
||||
}
|
||||
|
||||
public Memory getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
public Set<Disk> getDisks() {
|
||||
return disks == null ? ImmutableSet.<Disk> of() : ImmutableSet
|
||||
.copyOf(disks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ServerType that = ServerType.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("label", label).add("comment", comment)
|
||||
.add("productId", productId).add("productName", productName)
|
||||
.add("price", price).add("chargeType", chargeType)
|
||||
.add("expectedUsage", expectedUsage).add("cpu", cpu)
|
||||
.add("memory", memory).add("disks", disks).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ServerType o) {
|
||||
return memory == null ? -1 : memory.compareTo(o.memory);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents the software installed on a disk.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Software {
|
||||
private String name;
|
||||
|
||||
private String id;
|
||||
|
||||
private String category;
|
||||
|
||||
private String version;
|
||||
|
||||
private String officialVersion;
|
||||
|
||||
private String patch;
|
||||
|
||||
private String license;
|
||||
|
||||
private String support;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getOfficialVersion() {
|
||||
return officialVersion;
|
||||
}
|
||||
|
||||
public String getPatch() {
|
||||
return patch;
|
||||
}
|
||||
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
public String getSupport() {
|
||||
return support;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Software that = Software.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("category", category)
|
||||
.add("version", version)
|
||||
.add("officialVersion", officialVersion)
|
||||
.add("support", support).add("patch", patch)
|
||||
.add("license", license).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Describes the target server of a load balancer.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class Target {
|
||||
private String serverId;
|
||||
|
||||
private String serverName;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String port1;
|
||||
|
||||
private String port2;
|
||||
|
||||
private String status;
|
||||
|
||||
private String now;
|
||||
|
||||
private String peak;
|
||||
|
||||
/**
|
||||
* @return the serverId
|
||||
*/
|
||||
public String getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the serverName
|
||||
*/
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ipAddress
|
||||
*/
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port1
|
||||
*/
|
||||
public String getPort1() {
|
||||
return port1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port2
|
||||
*/
|
||||
public String getPort2() {
|
||||
return port2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the now
|
||||
*/
|
||||
public String getNow() {
|
||||
return now;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the peak
|
||||
*/
|
||||
public String getPeak() {
|
||||
return peak;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Target that = Target.class.cast(obj);
|
||||
return Objects.equal(this.serverId, that.serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("serverId", serverId).add("serverName", serverName)
|
||||
.add("ipAddress", ipAddress).add("port1", port1)
|
||||
.add("port2", port2).add("status", status).add("now", now)
|
||||
.add("peak", peak).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Describes the usage by a virtual system.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "usageinfo")
|
||||
public class UsageInfo {
|
||||
@XmlElement(name = "vsysId")
|
||||
private String systemId;
|
||||
@XmlElement(name = "vsysName")
|
||||
private String systemName;
|
||||
|
||||
@XmlElementWrapper(name = "products")
|
||||
@XmlElement(name = "product")
|
||||
private Set<Product> products = new LinkedHashSet<Product>();
|
||||
|
||||
/**
|
||||
* @return the systemId
|
||||
*/
|
||||
public String getSystemId() {
|
||||
return systemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the systemName
|
||||
*/
|
||||
public String getSystemName() {
|
||||
return systemName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the products
|
||||
*/
|
||||
public Set<Product> getProducts() {
|
||||
return products == null ? ImmutableSet.<Product> of() : ImmutableSet
|
||||
.copyOf(products);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(systemId, systemName, products);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
UsageInfo that = UsageInfo.class.cast(obj);
|
||||
return Objects.equal(this.systemId, that.systemId)
|
||||
&& Objects.equal(this.systemName, that.systemName)
|
||||
&& Objects.equal(this.products, that.products);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("systemId", systemId).add("systemName", systemName)
|
||||
.add("products", products).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents attachable storage in the form of a virtual disk.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vdisk")
|
||||
public class VDisk {
|
||||
@XmlElement(name = "diskId")
|
||||
private String id;
|
||||
@XmlElement(name = "diskName")
|
||||
private String name;
|
||||
@XmlElement(name = "attachedTo")
|
||||
private String attachedServer;
|
||||
private String creator;
|
||||
private double size;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getAttachedServer() {
|
||||
return attachedServer;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VDisk that = VDisk.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("attachedServer", attachedServer)
|
||||
.add("creator", creator).add("size", size).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Possible statuses of an attachable virtual disk.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vdiskStatus")
|
||||
public enum VDiskStatus {
|
||||
|
||||
NORMAL, BACKUP_ING, DEPLOYING, DETACHING, ATTACHING, RESTORING, ERROR, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static VDiskStatus fromValue(String status) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a virtual network interface card (NIC).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vnic")
|
||||
public class VNIC {
|
||||
private String networkId;
|
||||
|
||||
private String privateIp;
|
||||
|
||||
private int nicNo;
|
||||
|
||||
public String getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getPrivateIp() {
|
||||
return privateIp;
|
||||
}
|
||||
|
||||
public int getNicNo() {
|
||||
return nicNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(networkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VNIC that = VNIC.class.cast(obj);
|
||||
return Objects.equal(this.networkId, that.networkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues()
|
||||
.add("networkId", networkId).add("privateIp", privateIp)
|
||||
.add("nicNo", nicNo).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a virtual network.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vnet")
|
||||
public class VNet {
|
||||
|
||||
private String networkId;
|
||||
|
||||
public String getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(networkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VNet that = VNet.class.cast(obj);
|
||||
return Objects.equal(this.networkId, that.networkId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("networkId", networkId)
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class VServer {
|
||||
@XmlElement(name = "vserverId")
|
||||
protected String id;
|
||||
@XmlElement(name = "vserverName")
|
||||
protected String name;
|
||||
@XmlElement(name = "vserverType")
|
||||
protected String type;
|
||||
protected String diskimageId;
|
||||
protected String creator;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getDiskimageId() {
|
||||
return diskimageId;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VServer that = VServer.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("type", type).add("creator", creator)
|
||||
.add("diskimageId", diskimageId).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Possible statuses of a virtual server.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vserverStatus")
|
||||
public enum VServerStatus {
|
||||
DEPLOYING, RUNNING, STOPPING, STOPPED, STARTING, FAILOVER, UNEXPECTED_STOP, RESTORING, BACKUP_ING, ERROR, START_ERROR, STOP_ERROR, CHANGE_TYPE, REGISTERING, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static VServerStatus fromValue(String status) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Represents a virtual server with virtual storage and NICs.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vserver")
|
||||
public class VServerWithDetails extends VServerWithVNICs {
|
||||
@XmlElementWrapper(name = "vdisks")
|
||||
@XmlElement(name = "vdisk")
|
||||
protected Set<VDisk> vdisks = new LinkedHashSet<VDisk>();
|
||||
protected Image image;
|
||||
|
||||
public Set<VDisk> getVdisks() {
|
||||
return vdisks == null ? ImmutableSet.<VDisk> of() : ImmutableSet
|
||||
.copyOf(vdisks);
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("type", type).add("creator", creator)
|
||||
.add("diskimageId", diskimageId).add("vdisks", vdisks)
|
||||
.add("vnics", vnics).add("image", image).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package org.jclouds.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public class VServerWithVNICs extends VServer {
|
||||
|
||||
@XmlElementWrapper(name = "vnics")
|
||||
@XmlElement(name = "vnic")
|
||||
protected Set<VNIC> vnics = new LinkedHashSet<VNIC>();
|
||||
|
||||
public Set<VNIC> getVnics() {
|
||||
return vnics == null ? ImmutableSet.<VNIC> of() : ImmutableSet
|
||||
.copyOf(vnics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("type", type).add("creator", creator)
|
||||
.add("diskimageId", diskimageId).add("vnics", vnics).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Represents a virtual system.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public class VSystem {
|
||||
@XmlElement(name = "vsysId")
|
||||
protected String id;
|
||||
@XmlElement(name = "vsysName")
|
||||
protected String name;
|
||||
protected String creator;
|
||||
@XmlElement(name = "baseDescriptor")
|
||||
protected String template;
|
||||
protected String description;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public String getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VSystem that = VSystem.class.cast(obj);
|
||||
return Objects.equal(this.id, that.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("creator", creator)
|
||||
.add("template", template).add("description", description)
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Describes a virtual system template.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vsysdescriptor")
|
||||
public class VSystemDescriptor {
|
||||
@XmlElement(name = "vsysdescriptorId")
|
||||
private String id;
|
||||
|
||||
@XmlElement(name = "vsysdescriptorName")
|
||||
private String name;
|
||||
|
||||
private String creatorName;
|
||||
|
||||
private String registrant;
|
||||
|
||||
private String description;
|
||||
|
||||
private String keyword;
|
||||
|
||||
@XmlElementWrapper(name = "vservers")
|
||||
@XmlElement(name = "vserver")
|
||||
private Set<VServerWithDetails> servers = new LinkedHashSet<VServerWithDetails>();
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the creatorName
|
||||
*/
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the registrant
|
||||
*/
|
||||
public String getRegistrant() {
|
||||
return registrant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keyword
|
||||
*/
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the servers
|
||||
*/
|
||||
public Set<VServerWithDetails> getServers() {
|
||||
return servers == null ? ImmutableSet.<VServerWithDetails> of()
|
||||
: ImmutableSet.copyOf(servers);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Possible statuses of a virtual system.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vsysStatus")
|
||||
public enum VSystemStatus {
|
||||
NORMAL, RECONFIG_ING, DEPLOYING, ERROR, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static VSystemStatus fromValue(String status) {
|
||||
try {
|
||||
return valueOf(CaseFormat.UPPER_CAMEL
|
||||
.to(CaseFormat.UPPER_UNDERSCORE,
|
||||
checkNotNull(status, "status")));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.domain;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Represents a virtual system with servers, additional storage, public IP
|
||||
* addresses and networks.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@XmlRootElement(name = "vsys")
|
||||
public class VSystemWithDetails extends VSystem {
|
||||
@XmlElementWrapper(name = "vservers")
|
||||
@XmlElement(name = "vserver")
|
||||
private Set<VServerWithVNICs> servers = new LinkedHashSet<VServerWithVNICs>();
|
||||
@XmlElementWrapper(name = "vdisks")
|
||||
@XmlElement(name = "vdisk")
|
||||
private Set<VDisk> disks = new LinkedHashSet<VDisk>();
|
||||
@XmlElementWrapper(name = "publicips")
|
||||
@XmlElement(name = "publicip")
|
||||
private Set<PublicIP> publicips = new LinkedHashSet<PublicIP>();
|
||||
@XmlElementWrapper(name = "vnets")
|
||||
@XmlElement(name = "vnet")
|
||||
private Set<VNet> networks = new LinkedHashSet<VNet>();
|
||||
|
||||
public Set<VServerWithVNICs> getServers() {
|
||||
return servers == null ? ImmutableSet.<VServerWithVNICs> of() : ImmutableSet
|
||||
.copyOf(servers);
|
||||
}
|
||||
|
||||
public Set<VDisk> getDisks() {
|
||||
return disks == null ? ImmutableSet.<VDisk> of() : ImmutableSet
|
||||
.copyOf(disks);
|
||||
}
|
||||
|
||||
public Set<PublicIP> getPublicips() {
|
||||
return publicips == null ? ImmutableSet.<PublicIP> of() : ImmutableSet
|
||||
.copyOf(publicips);
|
||||
}
|
||||
|
||||
public Set<VNet> getNetworks() {
|
||||
return networks == null ? ImmutableSet.<VNet> of() : ImmutableSet
|
||||
.copyOf(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("id", id)
|
||||
.add("name", name).add("creator", creator)
|
||||
.add("template", template).add("description", description)
|
||||
.add("disks", disks).add("networks", networks)
|
||||
.add("publicips", publicips).add("servers", servers).toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
@XmlSchema(namespace = "http://apioviss.jp.fujitsu.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
package org.jclouds.fujitsu.fgcp.domain;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.filters;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.Signature;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
import javax.ws.rs.HttpMethod;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.crypto.CryptoStreams;
|
||||
import org.jclouds.date.TimeStamp;
|
||||
import org.jclouds.encryption.internal.Base64;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.http.HttpException;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpRequestFilter;
|
||||
import org.jclouds.http.HttpUtils;
|
||||
import org.jclouds.http.internal.SignatureWire;
|
||||
import org.jclouds.http.utils.Queries;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.RequestSigner;
|
||||
import org.jclouds.rest.annotations.ApiVersion;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
/**
|
||||
* Generates and signs the access key id and adds the mandatory http header and
|
||||
* request parameters to the request.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class RequestAuthenticator implements HttpRequestFilter, RequestSigner {
|
||||
|
||||
@Resource
|
||||
@Named(Constants.LOGGER_SIGNATURE)
|
||||
private Logger signatureLog = Logger.NULL;
|
||||
|
||||
final Provider<Calendar> calendarProvider;
|
||||
final Signature signer;
|
||||
final Provider<UriBuilder> builder;
|
||||
final String apiVersion;
|
||||
|
||||
public String signatureVersion = "1.0";
|
||||
public String signatureMethod = "SHA1withRSA";
|
||||
|
||||
private HttpUtils utils;
|
||||
|
||||
@Inject
|
||||
public RequestAuthenticator(@TimeStamp Provider<Calendar> calendarProvider,
|
||||
Provider<KeyStore> keyStoreProvider,
|
||||
@Credential String keyPassword, Provider<UriBuilder> builder,
|
||||
HttpUtils utils, SignatureWire signatureWire,
|
||||
@ApiVersion String apiVersion) throws NoSuchAlgorithmException,
|
||||
InvalidKeyException, KeyStoreException, UnrecoverableKeyException {
|
||||
this.calendarProvider = checkNotNull(calendarProvider);
|
||||
this.builder = checkNotNull(builder);
|
||||
this.utils = checkNotNull(utils, "utils");
|
||||
this.apiVersion = checkNotNull(apiVersion, "apiVersion");
|
||||
|
||||
signer = Signature.getInstance(signatureMethod);
|
||||
|
||||
KeyStore keyStore = checkNotNull(keyStoreProvider).get();
|
||||
String alias = keyStore.aliases().nextElement(); // there should be only
|
||||
// one private key
|
||||
PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias,
|
||||
keyPassword.toCharArray());
|
||||
|
||||
signer.initSign(privateKey);
|
||||
}
|
||||
|
||||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
||||
checkNotNull(request, "request must be present");
|
||||
|
||||
utils.logRequest(signatureLog, request, ">>");
|
||||
|
||||
// create accesskeyid
|
||||
String accessKeyId = createStringToSign(request);
|
||||
String signature = sign(accessKeyId);
|
||||
|
||||
// leaving this in for now for reference in case I need it for multipart
|
||||
// POSTs
|
||||
// add parameters. Note that in case of a GET, url escaping is required
|
||||
/*
|
||||
* Multimap<String, String> decodedParams = null; if
|
||||
* (HttpMethod.GET.equals(request.getMethod())) { decodedParams =
|
||||
* ModifyRequest.parseQueryToMap(request.getEndpoint().getRawQuery());
|
||||
*
|
||||
* } else if (HttpMethod.POST.equals(request.getMethod())) {
|
||||
* decodedParams =
|
||||
* ModifyRequest.parseQueryToMap(request.getPayload().getRawContent()
|
||||
* .toString()); }
|
||||
*
|
||||
* checkNotNull(decodedParams, "no query params found");
|
||||
* System.out.println("filter: request params before: " +
|
||||
* decodedParams.toString()); addAuthenticationParams(decodedParams,
|
||||
* accessKeyId, signature); addLocaleParam(decodedParams);
|
||||
* System.out.println("filter: request params after : " +
|
||||
* decodedParams.toString()); if (signatureWire.enabled())
|
||||
* signatureWire.output(decodedParams);
|
||||
*
|
||||
*
|
||||
* request = setPayload(request, decodedParams);
|
||||
*/
|
||||
// only "en" and "ja" are allowed
|
||||
String lang = Locale.JAPANESE.getLanguage().equals(
|
||||
Locale.getDefault().getLanguage()) ? Locale.JAPANESE
|
||||
.getLanguage() : Locale.ENGLISH.getLanguage();
|
||||
|
||||
if (HttpMethod.GET.equals(request.getMethod())) {
|
||||
Multimap<String, String> decodedParams = Queries
|
||||
.parseQueryToMap(request.getEndpoint().getRawQuery());
|
||||
|
||||
if (!decodedParams.containsKey(RequestParameters.VERSION)) {
|
||||
decodedParams.put(RequestParameters.VERSION, apiVersion);
|
||||
}
|
||||
decodedParams.put(RequestParameters.LOCALE, lang);
|
||||
decodedParams.put(RequestParameters.ACCESS_KEY_ID, accessKeyId);
|
||||
decodedParams.put(RequestParameters.SIGNATURE, signature);
|
||||
request = request.toBuilder().replaceQueryParams(decodedParams)
|
||||
.build();
|
||||
} else {
|
||||
|
||||
String payload = request.getPayload().getRawContent().toString();
|
||||
payload = createXmlElementWithValue(payload,
|
||||
RequestParameters.VERSION, apiVersion);
|
||||
payload = createXmlElementWithValue(payload,
|
||||
RequestParameters.LOCALE, lang);
|
||||
payload = createXmlElementWithValue(payload,
|
||||
RequestParameters.ACCESS_KEY_ID, accessKeyId);
|
||||
payload = createXmlElementWithValue(payload,
|
||||
RequestParameters.SIGNATURE, signature);
|
||||
|
||||
// ensure there are no other query params left
|
||||
request.setPayload(payload);
|
||||
request.getPayload().getContentMetadata()
|
||||
.setContentType(MediaType.TEXT_XML);
|
||||
}
|
||||
|
||||
// may need to do this elsewhere (see ConvertToGaeRequest)
|
||||
HttpRequest filteredRequest = request.toBuilder()
|
||||
.replaceHeader(HttpHeaders.USER_AGENT, "OViSS-API-CLIENT")
|
||||
.build();
|
||||
|
||||
utils.logRequest(signatureLog, filteredRequest, ">>->");
|
||||
|
||||
return filteredRequest;
|
||||
}
|
||||
|
||||
String createXmlElementWithValue(String payload, String tag, String value) {
|
||||
String startTag = String.format("<%s>", tag);
|
||||
String endTag = String.format("</%s>", tag);
|
||||
|
||||
return payload.replace(startTag + endTag, startTag + value + endTag);
|
||||
}
|
||||
|
||||
/*
|
||||
* HttpRequest setPayload(HttpRequest request, Multimap<String, String>
|
||||
* decodedParams) {
|
||||
* request.setPayload(ModifyRequest.makeQueryLine(decodedParams, null)); //
|
||||
* request.getPayload().getContentMetadata().setContentType(
|
||||
* "application/x-www-form-urlencoded"); return request; }
|
||||
*/
|
||||
|
||||
@VisibleForTesting
|
||||
public String sign(String stringToSign) {
|
||||
String signed;
|
||||
|
||||
try {
|
||||
signer.update(stringToSign.getBytes("UTF-8"));
|
||||
signed = Base64.encodeBytes(signer.sign()).replace("\n", "\r\n");
|
||||
// signed = CryptoStreams.base64(signer.sign());
|
||||
} catch (Exception e) {
|
||||
throw new HttpException("error signing request", e);
|
||||
}
|
||||
// if (signatureWire.enabled())
|
||||
// signatureWire.input(Strings2.toInputStream(signed));
|
||||
|
||||
return signed;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public String generateAccessKeyId() {
|
||||
Calendar cal = calendarProvider.get();
|
||||
String timezone = cal.getTimeZone().getDisplayName(Locale.ENGLISH);
|
||||
String expires = String.valueOf(cal.getTime().getTime());
|
||||
|
||||
String signatureData = String.format("%s&%s&%s&%s", timezone, expires,
|
||||
signatureVersion, signatureMethod);
|
||||
try {
|
||||
String accessKeyId = Base64.encodeBytes(signatureData.getBytes("UTF-8"));
|
||||
return accessKeyId.replace("\n", "\r\n");
|
||||
// return CryptoStreams.base64(signatureData.getBytes("UTF-8")).;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e); // should never happen as
|
||||
// signatureData contains only ASCII
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createStringToSign(HttpRequest input) {
|
||||
return generateAccessKeyId();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.handlers;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import org.jclouds.http.HttpCommand;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.http.HttpRetryHandler;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class FGCPRetryIfNotProxyAuthenticationFailureHandler implements
|
||||
HttpRetryHandler {
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Override
|
||||
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
|
||||
int statusCode = response.getStatusCode();
|
||||
System.out.println("Response status code: " + statusCode);
|
||||
logger.error("StatusCode", statusCode);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.http;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.jclouds.http.HttpUtils;
|
||||
import org.jclouds.http.config.SSLModule.TrustAllCerts;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
||||
/**
|
||||
* SSLContext supplier with a configured key manager to enable client
|
||||
* authentication with certificates.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class SSLContextWithKeysSupplier implements Supplier<SSLContext> {
|
||||
private SSLContext sc;
|
||||
|
||||
@Inject
|
||||
SSLContextWithKeysSupplier(KeyStore keyStore,
|
||||
@Credential String keyStorePassword, HttpUtils utils,
|
||||
TrustAllCerts trustAllCerts) throws NoSuchAlgorithmException,
|
||||
KeyStoreException, UnrecoverableKeyException,
|
||||
KeyManagementException {
|
||||
|
||||
TrustManager[] trustManager = null;
|
||||
if (utils.trustAllCerts()) {
|
||||
trustManager = new TrustManager[] { trustAllCerts };
|
||||
}
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(keyStore, keyStorePassword.toCharArray());
|
||||
sc = SSLContext.getInstance("TLS");
|
||||
sc.init(kmf.getKeyManagers(), trustManager, new SecureRandom());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SSLContext get() {
|
||||
return sc;
|
||||
}
|
||||
}
|
|
@ -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.fujitsu.fgcp.location;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VNet;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystem;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystemWithDetails;
|
||||
import org.jclouds.location.suppliers.LocationsSupplier;
|
||||
import org.jclouds.location.suppliers.all.RegionToProviderOrJustProvider;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Builds location hierarchy by querying the back-end for the networks of all
|
||||
* virtual systems.
|
||||
* <p>
|
||||
* Example:
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* >location provider fgcp(-au)
|
||||
* -> location region au/nsw
|
||||
* --> location system vsys
|
||||
* ---> location network DMZ/SECURE1/SECURE2
|
||||
* </pre>
|
||||
*
|
||||
* Todo: caching - provider/region won't change. if vsys still exists, network
|
||||
* won't change
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Singleton
|
||||
public class SystemAndNetworkSegmentToLocationSupplier implements
|
||||
LocationsSupplier {
|
||||
|
||||
private final RegionToProviderOrJustProvider regionProvider;
|
||||
private FGCPAsyncApi api;
|
||||
|
||||
@Inject
|
||||
SystemAndNetworkSegmentToLocationSupplier(
|
||||
RegionToProviderOrJustProvider regionProvider, FGCPAsyncApi api) {
|
||||
this.regionProvider = checkNotNull(regionProvider,
|
||||
"regionToProviderOrJustProvider");
|
||||
this.api = checkNotNull(api, "api");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Location> get() {
|
||||
Builder<Location> locations = ImmutableSet.builder();
|
||||
try {
|
||||
List<ListenableFuture<VSystemWithDetails>> futures = new ArrayList<ListenableFuture<VSystemWithDetails>>();
|
||||
for (VSystem system : api.getVirtualDCApi().listVirtualSystems()
|
||||
.get()) {
|
||||
|
||||
futures.add(api.getVirtualSystemApi()
|
||||
.getDetails(system.getId()));
|
||||
}
|
||||
for (VSystemWithDetails system : Futures.successfulAsList(futures)
|
||||
.get()) {
|
||||
|
||||
Location systemLocation = new LocationBuilder()
|
||||
.scope(LocationScope.SYSTEM)
|
||||
.parent(Iterables.getOnlyElement(regionProvider.get()))
|
||||
.description(system.getName()).id(system.getId())
|
||||
.build();
|
||||
|
||||
for (VNet net : system.getNetworks()) {
|
||||
|
||||
locations.add(new LocationBuilder()
|
||||
.scope(LocationScope.NETWORK)
|
||||
.parent(systemLocation)
|
||||
.description(
|
||||
net.getNetworkId().replaceFirst(
|
||||
".+(DMZ|SECURE.)", "\\1"))
|
||||
.id(net.getNetworkId()).build());
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
return locations.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.reference;
|
||||
|
||||
/**
|
||||
* Configuration parameters and constants used in HTTP requests.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
public interface RequestParameters {
|
||||
|
||||
/**
|
||||
* Indicates the action to perform. Example: ListVSYS
|
||||
*/
|
||||
public static final String ACTION = "Action";
|
||||
|
||||
/**
|
||||
* The API version to use. Example: 2011-01-31
|
||||
*/
|
||||
public static final String VERSION = "Version";
|
||||
|
||||
/**
|
||||
* The locale to use. Example: en
|
||||
*/
|
||||
public static final String LOCALE = "Locale";
|
||||
|
||||
/**
|
||||
* The Access Key ID for the request sender. This identifies the account
|
||||
* which will be charged for usage of the service. The account with which
|
||||
* the Access Key ID is associated must be signed up for FGCP, or requests
|
||||
* will not be accepted. AKIADQKE4SARGYLE
|
||||
*/
|
||||
public static final String ACCESS_KEY_ID = "AccessKeyId";
|
||||
|
||||
/**
|
||||
* The date and time at which the request is signed, in the format
|
||||
* YYYY-MM-DDThh:mm:ssZ. For more information, go to ISO 8601. Example:
|
||||
* 2006-07-07T15:04:56Z
|
||||
*/
|
||||
public static final String TIMESTAMP = "Timestamp";
|
||||
|
||||
/**
|
||||
* The date and time at which the signer included in the request expires, in
|
||||
* the format YYYY-MM-DDThh:mm:ssZ. Example: 2006-07-07T15:04:56Z
|
||||
*/
|
||||
public static final String EXPIRES = "Expires";
|
||||
|
||||
/**
|
||||
* The request signer. For more information, go to the Amazon Elastic
|
||||
* Compute Cloud Developer Guide. Example: Qnpl4Qk/7tINHzfXCiT7VbBatDA=
|
||||
*/
|
||||
public static final String SIGNATURE = "Signature";
|
||||
|
||||
/**
|
||||
* The hash algorithm you use to create the request signer. Valid value:
|
||||
* SHA1withRSA.
|
||||
*/
|
||||
public static final String SIGNATURE_METHOD = "SignatureMethod";
|
||||
|
||||
/**
|
||||
* The signer version you use to sign the request. Set this value to 1.0.
|
||||
*
|
||||
*/
|
||||
public static final String SIGNATURE_VERSION = "SignatureVersion";
|
||||
}
|
|
@ -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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VDisk;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VDiskStatus;
|
||||
|
||||
/**
|
||||
* API relating to additional storage.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface AdditionalDiskApi {
|
||||
|
||||
VDiskStatus getStatus(String id);
|
||||
|
||||
VDisk get(String id);
|
||||
|
||||
void update(String id, String name, String value);
|
||||
|
||||
void backup(String id);
|
||||
|
||||
void restore(String systemId, String backupId);
|
||||
|
||||
void destroy(String id);
|
||||
|
||||
void detach(String diskId, String serverId);
|
||||
|
||||
void destroyBackup(String sysId, String backupId);
|
||||
|
||||
// Set<> listBackups(String sysId);
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.binders.BindAlsoToSystemId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VDisk;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VDiskStatus;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to additional storage.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface AdditionalDiskAsyncApi {
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetVDiskStatus")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<VDiskStatus> getStatus(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetVDiskAttributes")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<VDisk> get(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String id);
|
||||
|
||||
@GET
|
||||
@QueryParams(keys = "Action", values = "UpdateVDiskAttribute")
|
||||
ListenableFuture<Void> update(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String id,
|
||||
@QueryParam("attributeName") String name,
|
||||
@QueryParam("attributeValue") String value);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "BackupVDisk")
|
||||
ListenableFuture<Void> backup(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "RestoreVDisk")
|
||||
ListenableFuture<Void> restore(@QueryParam("vsysId") String systemId,
|
||||
@QueryParam("backupId") String backupId);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DestroyVDisk")
|
||||
ListenableFuture<Void> destroy(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DetachVDisk")
|
||||
ListenableFuture<Void> detach(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("vdiskId") String diskId,
|
||||
@QueryParam("vserverId") String serverId);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DestroyVDiskBackup")
|
||||
ListenableFuture<Void> destroyBackup(@QueryParam("vsysId") String sysId,
|
||||
@QueryParam("backupId") String backupId);
|
||||
|
||||
// Set<> listBackups(String sysId);
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerBackup;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerConfiguration;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerStatus;
|
||||
|
||||
/**
|
||||
* API relating to built-in servers, also called extended function module (EFM),
|
||||
* such as a firewall or load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface BuiltinServerApi {
|
||||
|
||||
void start(String id);
|
||||
|
||||
void stop(String id);
|
||||
|
||||
void destroy(String id);
|
||||
|
||||
void backup(String id);
|
||||
|
||||
void restore(String id, String backupId);
|
||||
|
||||
Set<BuiltinServerBackup> listBackups(String id);
|
||||
|
||||
void destroyBackup(String id, String backupId);
|
||||
|
||||
BuiltinServer get(String id);
|
||||
|
||||
void update(String id, String name, String value);
|
||||
|
||||
BuiltinServerStatus getStatus(String id);
|
||||
|
||||
BuiltinServer getConfiguration(String id, BuiltinServerConfiguration configuration);
|
||||
|
||||
// BuiltinServer getConfiguration(String id, BuiltinServerConfiguration configuration, ConfigurationRequest request);
|
||||
// void updateConfiguration(String id, xml?);
|
||||
/*
|
||||
getDNSConfiguration(String id)
|
||||
getNATConfiguration(String id)
|
||||
getPolicyConfiguration(String id)
|
||||
getLBConfiguration(String id)
|
||||
|
||||
* UpdateEFMConfiguration
|
||||
BuiltinServer getConfiguration(String id, BuiltinServerConfiguration configuration);
|
||||
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.binders.BindAlsoToSystemId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerBackup;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerConfiguration;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to built-in servers, also called extended function
|
||||
* module (EFM), such as a firewall or load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface BuiltinServerAsyncApi {
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "StartEFM")
|
||||
ListenableFuture<Void> start(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "StopEFM")
|
||||
ListenableFuture<Void> stop(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DestroyEFM")
|
||||
ListenableFuture<Void> destroy(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "BackupEFM")
|
||||
ListenableFuture<Void> backup(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "RestoreEFM")
|
||||
ListenableFuture<Void> restore(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id,
|
||||
@QueryParam("backupId") String backupId);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "ListEFMBackup")
|
||||
ListenableFuture<Set<BuiltinServerBackup>> listBackups(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DestroyEFMBackup")
|
||||
ListenableFuture<Void> destroyBackup(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id,
|
||||
@QueryParam("backupId") String backupId);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetEFMAttributes")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<BuiltinServer> get(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UpdateEFMAttribute")
|
||||
ListenableFuture<Void> update(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id,
|
||||
@QueryParam("attributeName") String name,
|
||||
@QueryParam("attributeValue") String value);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetEFMStatus")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<BuiltinServerStatus> getStatus(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetEFMConfiguration")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<BuiltinServer> getConfiguration(
|
||||
@BinderParam(BindAlsoToSystemId.class) @QueryParam("efmId") String id,
|
||||
@QueryParam("configurationName") BuiltinServerConfiguration configuration);
|
||||
|
||||
// @POST
|
||||
// @JAXBResponseParser
|
||||
// @QueryParams(keys = "Action", values = "GetEFMConfiguration")
|
||||
// @Transform(SingleElementResponseToElement.class)
|
||||
// ListenableFuture<Set<Rule>> getUpdateDetails(String id);
|
||||
|
||||
// ListenableFuture<Void>
|
||||
// updateConfiguration(@BinderParam(BindAlsoToSystemId.class)
|
||||
// @QueryParam("efmId") String id, xml?);
|
||||
// EFM_UPDATE, getUpdateStatus(String id);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
|
||||
/**
|
||||
* API relating to disk images.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface DiskImageApi {
|
||||
|
||||
DiskImage get(String id);
|
||||
|
||||
void update(String diskImageId, String localeId, String name, String value);
|
||||
|
||||
void deregister(String id);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.DiskImage;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to disk images.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface DiskImageAsyncApi {
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetDiskImageAttributes")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<DiskImage> get(@QueryParam("diskImageId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UpdateDiskImageAttribute")
|
||||
ListenableFuture<Void> update(
|
||||
@QueryParam("diskImageId") String diskImageId,
|
||||
@QueryParam("updateLcId") String localeId,
|
||||
@QueryParam("attributeName") String name,
|
||||
@QueryParam("attributeValue") String value);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UnregisterDiskImage")
|
||||
ListenableFuture<Void> deregister(@QueryParam("diskImageId") String id);
|
||||
}
|
|
@ -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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.Rule;
|
||||
|
||||
/**
|
||||
* API relating to a system's built-in server of type firewall.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface FirewallApi extends BuiltinServerApi {
|
||||
|
||||
Set<Rule> getNATConfiguration(String id);
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.binders.BindAlsoToSystemId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerBackup;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerConfiguration;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.domain.Rule;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to a built-in server, also called extended function
|
||||
* module (EFM), of type firewall.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface FirewallAsyncApi extends BuiltinServerAsyncApi {
|
||||
|
||||
@POST
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetEFMConfiguration")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<Set<Rule>> getNATConfiguration(String id);
|
||||
|
||||
/*
|
||||
FW_NAT_RULE, getNATConfiguration(String id)
|
||||
|
||||
FW_DNS, getDNSConfiguration(String id)
|
||||
FW_POLICY, getPolicyConfiguration(String id)
|
||||
|
||||
FW_LOG, getFirewallLogs(String id);
|
||||
FW_LIMIT_POLICY,
|
||||
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
||||
/**
|
||||
* API relating to a built-in server of type software load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface LoadBalancerApi extends BuiltinServerApi {
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.binders.BindAlsoToSystemId;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServer;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerBackup;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerConfiguration;
|
||||
import org.jclouds.fujitsu.fgcp.domain.BuiltinServerStatus;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to a built-in server, also called extended function
|
||||
* module (EFM), of type load balancer (SLB).
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface LoadBalancerAsyncApi extends BuiltinServerAsyncApi {
|
||||
|
||||
/*
|
||||
SLB_RULE, getLBConfiguration(String id)
|
||||
SLB_LOAD_STATISTICS, getLoadBalancerStats(String id)
|
||||
SLB_ERROR_STATISTICS, getLoadBalancerErrorStats(String id)
|
||||
SLB_CERTIFICATE_LIST, getLoadBalancerCerts(String id)
|
||||
SLB_CONNECTION, getLoadBalancerConnection(String id)
|
||||
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.PublicIP;
|
||||
import org.jclouds.fujitsu.fgcp.domain.PublicIPStatus;
|
||||
|
||||
/**
|
||||
* API relating to public IP addresses.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface PublicIPAddressApi {
|
||||
|
||||
void attach(String systemId, String ip);
|
||||
|
||||
void detach(String systemId, String ip);
|
||||
|
||||
void free(String systemId, String ip);
|
||||
|
||||
PublicIPStatus getStatus(String ip);
|
||||
|
||||
PublicIP get(String ip);
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.PublicIP;
|
||||
import org.jclouds.fujitsu.fgcp.domain.PublicIPStatus;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to public IP addresses.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface PublicIPAddressAsyncApi {
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "AttachPublicIP")
|
||||
ListenableFuture<Void> attach(@QueryParam("vsysId") String systemId,
|
||||
@QueryParam("publicIp") String ip);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "DetachPublicIP")
|
||||
ListenableFuture<Void> detach(@QueryParam("vsysId") String systemId,
|
||||
@QueryParam("publicIp") String ip);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetPublicIPStatus")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<PublicIPStatus> getStatus(
|
||||
@QueryParam("publicIp") String ip);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetPublicIPAttributes")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<PublicIP> get(@QueryParam("publicIp") String ip);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "FreePublicIP")
|
||||
ListenableFuture<Void> free(@QueryParam("vsysId") String systemId,
|
||||
@QueryParam("publicIp") String ip);
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystemDescriptor;
|
||||
|
||||
/**
|
||||
* API relating to system templates, also referred to as virtual system
|
||||
* descriptors.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface SystemTemplateApi {
|
||||
|
||||
VSystemDescriptor get(String id);
|
||||
|
||||
void update(String id, String localeId, String name, String value);
|
||||
|
||||
void deregister(String id);
|
||||
|
||||
void deregisterPrivateTemplate(String id);
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.FGCPAsyncApi;
|
||||
import org.jclouds.fujitsu.fgcp.compute.functions.SingleElementResponseToElement;
|
||||
import org.jclouds.fujitsu.fgcp.domain.VSystemDescriptor;
|
||||
import org.jclouds.fujitsu.fgcp.filters.RequestAuthenticator;
|
||||
import org.jclouds.fujitsu.fgcp.reference.RequestParameters;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.Transform;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Non-blocking API relating to system templates, also referred to as virtual
|
||||
* system descriptors.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@RequestFilters(RequestAuthenticator.class)
|
||||
@QueryParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@PayloadParams(keys = RequestParameters.VERSION, values = FGCPAsyncApi.VERSION)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface SystemTemplateAsyncApi {
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "GetVSYSDescriptorConfiguration")
|
||||
@Transform(SingleElementResponseToElement.class)
|
||||
ListenableFuture<VSystemDescriptor> get(
|
||||
@QueryParam("vsysDescriptorId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UpdateVSYSDescriptorAttribute")
|
||||
ListenableFuture<Void> update(@QueryParam("vsysDescriptorId") String id,
|
||||
@QueryParam("updateLcId") String localeId,
|
||||
@QueryParam("attributeName") String name,
|
||||
@QueryParam("attributeValue") String value);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UnregisterVSYSDescriptor")
|
||||
ListenableFuture<Void> deregister(
|
||||
@QueryParam("vsysDescriptorId") String id);
|
||||
|
||||
@GET
|
||||
@JAXBResponseParser
|
||||
@QueryParams(keys = "Action", values = "UnregisterPrivateVSYSDescriptor")
|
||||
ListenableFuture<Void> deregisterPrivateTemplate(
|
||||
@QueryParam("vsysDescriptorId") String id);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* 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.fujitsu.fgcp.services;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.fujitsu.fgcp.domain.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* API relating to the virtual data center.
|
||||
*
|
||||
* @author Dies Koper
|
||||
*/
|
||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface VirtualDCApi {
|
||||
|
||||
String createVirtualSystem(String descriptorId, String name);
|
||||
|
||||
Set<VSystem> listVirtualSystems();
|
||||
|
||||
// according to the manual it takes a 'String diskImageId' but value seems
|
||||
// to be ignored
|
||||
Set<ServerType> listServerTypes();
|
||||
|
||||
Set<DiskImage> listDiskImages();
|
||||
|
||||
Set<DiskImage> listDiskImages(String serverCategory,
|
||||
String vsysDescriptorId);
|
||||
|
||||
Map<PublicIP, String> listPublicIPs();
|
||||
|
||||
void addAddressRange(String pipFrom, String pipTo);
|
||||
|
||||
void createAddressPool(String pipFrom, String pipTo);
|
||||
|
||||
void deleteAddressRange(String pipFrom, String pipTo);
|
||||
|
||||
Set<AddressRange> getAddressRange();
|
||||
|
||||
Set<VSystemDescriptor> listVSYSDescriptor();
|
||||
|
||||
Set<VSystemDescriptor> listVSYSDescriptor(String keyword, int estimateFrom,
|
||||
int estimateTo);
|
||||
|
||||
Set<EventLog> getEventLogs(boolean all);
|
||||
|
||||
Set<EventLog> getEventLogs();
|
||||
|
||||
Set<Information> getInformation(boolean all);
|
||||
|
||||
Set<Information> getInformation();
|
||||
|
||||
Set<UsageInfo> getSystemUsage();
|
||||
|
||||
Set<UsageInfo> getSystemUsage(String systemIds);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue