mirror of https://github.com/apache/jclouds.git
Issue 36: reorganized and revamped codegen
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1410 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
ecc067e119
commit
500cc335e8
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
|
||||||
|
|
||||||
|
====================================================================
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF 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.html 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/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>jclouds-codegen-project</artifactId>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../project/pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>jclouds-codegen-ec2</artifactId>
|
||||||
|
<name>jclouds code generator for amazon ec2</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<description>jclouds code generator</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/codegen/ec2</connection>
|
||||||
|
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/codegen/ec2</developerConnection>
|
||||||
|
<url>http://jclouds.googlecode.com/svn/trunk/codegen/ec2</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-codegen-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-codegen-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class AmazonEC2QueryAPI {
|
||||||
|
private Map<String, Category> categories;
|
||||||
|
private Map<String, DataType> dataTypes;
|
||||||
|
private Set<String> see;
|
||||||
|
|
||||||
|
public void setCategories(Map<String, Category> categories) {
|
||||||
|
this.categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Category> getCategories() {
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataTypes(Map<String, DataType> dataTypes) {
|
||||||
|
this.dataTypes = dataTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, DataType> getDataTypes() {
|
||||||
|
return dataTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSee(Set<String> see) {
|
||||||
|
this.see = see;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getSee() {
|
||||||
|
return see;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,46 +21,42 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.ec2.queryapi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author James Murty
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class Parameter {
|
public class Category {
|
||||||
private String javaName;
|
private Map<String, Query> queries;
|
||||||
private String name;
|
|
||||||
private String type;
|
@Override
|
||||||
private String javaType;
|
public String toString() {
|
||||||
private String param;
|
final StringBuilder sb = new StringBuilder();
|
||||||
private String desc;
|
sb.append("Category");
|
||||||
|
sb.append("{queries=").append(queries);
|
||||||
|
sb.append(", name='").append(name).append('\'');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public void setQueries(Map<String, Query> categories) {
|
||||||
|
this.queries = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Query> getQueries() {
|
||||||
|
return queries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJavaType() {
|
|
||||||
return javaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParam() {
|
|
||||||
return param;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJavaName(String javaName) {
|
|
||||||
this.javaName = javaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJavaName() {
|
|
||||||
return javaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class Content {
|
||||||
|
|
||||||
|
private String constraints;
|
||||||
|
private String defaultValue;
|
||||||
|
private String desc;
|
||||||
|
private Map<String, String> valueMap;
|
||||||
|
private String name;
|
||||||
|
private String optional;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public void setConstraints(String constraints) {
|
||||||
|
this.constraints = constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConstraints() {
|
||||||
|
return constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(String defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueMap(Map<String, String> valueMap) {
|
||||||
|
this.valueMap = valueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getValueMap() {
|
||||||
|
return valueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptional(String optional) {
|
||||||
|
this.optional = optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOptional() {
|
||||||
|
return optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class DataType {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
private String ancestor;
|
||||||
|
private Set<String> see;
|
||||||
|
private String exampleCode;
|
||||||
|
private String exampleHTML;
|
||||||
|
private Set<Content> contents;
|
||||||
|
|
||||||
|
public DataType() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAncestor(String ancestor) {
|
||||||
|
this.ancestor = ancestor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAncestor() {
|
||||||
|
return ancestor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSee(Set<String> see) {
|
||||||
|
this.see = see;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getSee() {
|
||||||
|
return see;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExampleCode(String exampleCode) {
|
||||||
|
this.exampleCode = exampleCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExampleCode() {
|
||||||
|
return exampleCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContents(Set<Content> contents) {
|
||||||
|
this.contents = contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Content> getContents() {
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExampleHTML(String exampleHTML) {
|
||||||
|
this.exampleHTML = exampleHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExampleHTML() {
|
||||||
|
return exampleHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,25 +21,31 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.ec2.queryapi;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author James Murty
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class Response extends BaseBean {
|
public class Query extends DataType {
|
||||||
private List<ResponseField> fields;
|
|
||||||
private List<String> see;
|
|
||||||
|
|
||||||
public List<ResponseField> getFields() {
|
private String responseType;
|
||||||
return fields;
|
private String description;
|
||||||
}
|
|
||||||
|
|
||||||
|
public void setResponseType(String responseType) {
|
||||||
|
this.responseType = responseType;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getSee() {
|
public String getResponseType() {
|
||||||
return see;
|
return responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,283 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi.parser;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.testng.v6.Sets;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
public class AmazonEC2QueryAPIExpectations {
|
||||||
|
protected final Set<String> queryNames;
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPIExpectations() {
|
||||||
|
queryNames = Sets.newHashSet();
|
||||||
|
for (Set<String> qNames : expectedQueryNamesForCategoryName.values()) {
|
||||||
|
queryNames.addAll(qNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Please do not reformat this class, as it will not likely look as nice.
|
||||||
|
protected static final Map<String, Set<String>> expectedQueryNamesForCategoryName = new ImmutableMap.Builder<String, Set<String>>()
|
||||||
|
.put("Amazon DevPay", ImmutableSet.of("ConfirmProductInstance")).put(
|
||||||
|
"AMIs",
|
||||||
|
ImmutableSet.of("DeregisterImage", "ModifyImageAttribute",
|
||||||
|
"DescribeImageAttribute", "DescribeImages")).put(
|
||||||
|
"Availability Zones and Regions",
|
||||||
|
ImmutableSet.of("DescribeAvailabilityZones", "DescribeRegions")).put(
|
||||||
|
"Elastic Block Store",
|
||||||
|
ImmutableSet.of("DeleteVolume", "DescribeSnapshots", "DescribeVolumes",
|
||||||
|
"DetachVolume", "AttachVolume", "CreateSnapshot", "CreateVolume",
|
||||||
|
"DeleteSnapshot")).put(
|
||||||
|
"Elastic IP Addresses",
|
||||||
|
ImmutableSet.of("AllocateAddress", "DisassociateAddress", "ReleaseAddress",
|
||||||
|
"AssociateAddress", "DescribeAddresses")).put("General",
|
||||||
|
ImmutableSet.of("GetConsoleOutput")).put("Images",
|
||||||
|
ImmutableSet.of("ResetImageAttribute", "RegisterImage")).put(
|
||||||
|
"Instances",
|
||||||
|
ImmutableSet.of("TerminateInstances", "DescribeInstances", "RunInstances",
|
||||||
|
"RebootInstances")).put("Key Pairs",
|
||||||
|
ImmutableSet.of("DescribeKeyPairs", "CreateKeyPair", "DeleteKeyPair")).put(
|
||||||
|
"Monitoring", ImmutableSet.of("MonitorInstances", "UnmonitorInstances")).put(
|
||||||
|
"Reserved Instances",
|
||||||
|
ImmutableSet.of("DescribeReservedInstances",
|
||||||
|
"DescribeReservedInstancesOfferings",
|
||||||
|
"PurchaseReservedInstancesOffering")).put(
|
||||||
|
"Security Groups",
|
||||||
|
ImmutableSet.of("DescribeSecurityGroups", "AuthorizeSecurityGroupIngress",
|
||||||
|
"CreateSecurityGroup", "DeleteSecurityGroup",
|
||||||
|
"RevokeSecurityGroupIngress")).put("Windows",
|
||||||
|
ImmutableSet.of("CancelBundleTask", "DescribeBundleTasks", "BundleInstance"))
|
||||||
|
.build();
|
||||||
|
protected static final Map<String, Set<String>> expectedFieldNamesForDataTypeName = new ImmutableMap.Builder<String, Set<String>>()
|
||||||
|
.put("ReservationSetType", ImmutableSet.of("item")).put("DeleteKeyPairResponse",
|
||||||
|
ImmutableSet.of("return", "requestId")).put(
|
||||||
|
"DescribeKeyPairsResponseInfoType", ImmutableSet.of("item")).put(
|
||||||
|
"AuthorizeSecurityGroupIngressResponse",
|
||||||
|
ImmutableSet.of("return", "requestId")).put("AttachmentSetItemResponseType",
|
||||||
|
ImmutableSet.of("device", "status", "volumeId", "instanceId", "attachTime"))
|
||||||
|
.put("DescribeAddressesResponseInfoType", ImmutableSet.of("item")).put(
|
||||||
|
"DescribeReservedInstancesResponse",
|
||||||
|
ImmutableSet.of("requestId", "reservedInstancesSet")).put(
|
||||||
|
"DescribeVolumesSetItemResponseType",
|
||||||
|
ImmutableSet.of("status", "size", "createTime", "snapshotId",
|
||||||
|
"availabilityZone", "volumeId", "attachmentSet")).put(
|
||||||
|
"LaunchPermissionItemType", ImmutableSet.of("group", "userId")).put(
|
||||||
|
"DescribeSnapshotsSetItemResponseType",
|
||||||
|
ImmutableSet.of("status", "snapshotId", "volumeId", "startTime", "progress"))
|
||||||
|
.put(
|
||||||
|
"RunningInstancesItemType",
|
||||||
|
ImmutableSet.of("dnsName", "instanceState", "launchTime", "privateDnsName",
|
||||||
|
"reason", "monitoring", "platform", "productCodes", "amiLaunchIndex",
|
||||||
|
"keyName", "ramdiskId", "kernelId", "imageId", "instanceType",
|
||||||
|
"instanceId", "placement")).put(
|
||||||
|
"DescribeReservedInstancesOfferingsResponse",
|
||||||
|
ImmutableSet.of("requestId", "reservedInstancesOfferingsSet")).put(
|
||||||
|
"BlockDeviceMappingType", ImmutableSet.of("item")).put(
|
||||||
|
"ResetImageAttributeResponse", ImmutableSet.of("requestId", "imageId")).put(
|
||||||
|
"AvailabilityZoneSetType", ImmutableSet.of("item")).put(
|
||||||
|
"RevokeSecurityGroupIngressResponse", ImmutableSet.of("return", "requestId"))
|
||||||
|
.put("ReservationInfoType",
|
||||||
|
ImmutableSet.of("groupSet", "reservationId", "instancesSet", "ownerId")).put(
|
||||||
|
"RebootInstancesResponse", ImmutableSet.of("return", "requestId")).put(
|
||||||
|
"GroupItemType", ImmutableSet.of("groupId")).put("AvailabilityZoneItemType",
|
||||||
|
ImmutableSet.of("regionName", "zoneName", "zoneState")).put(
|
||||||
|
"RunningInstancesSetType", ImmutableSet.of("item")).put(
|
||||||
|
"CreateSecurityGroupResponse", ImmutableSet.of("return", "requestId")).put(
|
||||||
|
"ReleaseAddressResponse", ImmutableSet.of("return", "requestId")).put(
|
||||||
|
"SecurityGroupItemType",
|
||||||
|
ImmutableSet.of("groupName", "ipPermissions", "groupDescription", "ownerId"))
|
||||||
|
.put("NullableAttributeValueType", ImmutableSet.of("value")).put(
|
||||||
|
"DescribeSnapshotsResponse", ImmutableSet.of("requestId", "snapshotSet")).put(
|
||||||
|
"BundleInstanceResponse", ImmutableSet.of("bundleInstanceTask", "requestId"))
|
||||||
|
.put("DescribeKeyPairsResponseItemType", ImmutableSet.of("keyName", "keyFingerprint"))
|
||||||
|
.put("BundleInstanceTasksSetType", ImmutableSet.of("bundleInstanceTask"))
|
||||||
|
.put("DescribeAddressesResponseItemType", ImmutableSet.of("publicIp", "instanceId"))
|
||||||
|
.put("MonitorInstancesResponse", ImmutableSet.of("requestId", "instancesSet")).put(
|
||||||
|
"DescribeImagesResponse", ImmutableSet.of("imagesSet", "requestId")).put(
|
||||||
|
"MonitorInstancesResponseSetItemType",
|
||||||
|
ImmutableSet.of("monitoring", "instanceId")).put(
|
||||||
|
"BundleInstanceTaskErrorType", ImmutableSet.of("code", "message")).put(
|
||||||
|
"ProductCodesSetType", ImmutableSet.of("item")).put(
|
||||||
|
"UnmonitorInstancesResponse", ImmutableSet.of("instancesSet", "requestId"))
|
||||||
|
.put(
|
||||||
|
"IpPermissionType",
|
||||||
|
ImmutableSet.of("groups", "portRange", "fromPort", "ipProtocol", "icmpPort",
|
||||||
|
"toPort", "ipRanges")).put("IpPermissionSetType",
|
||||||
|
ImmutableSet.of("item")).put("DeleteSecurityGroupResponse",
|
||||||
|
ImmutableSet.of("requestId", "return")).put(
|
||||||
|
"RunInstancesResponse",
|
||||||
|
ImmutableSet.of("instancesSet", "requesterId", "groupSet", "reservationId",
|
||||||
|
"requestId", "ownerId")).put("DeregisterImageResponse",
|
||||||
|
ImmutableSet.of("return", "requestId")).put("TerminateInstancesResponse",
|
||||||
|
ImmutableSet.of("requestId", "instancesSet")).put(
|
||||||
|
"DescribeSnapshotsSetResponseType", ImmutableSet.of("item")).put(
|
||||||
|
"DescribeReservedInstancesOfferingsResponseSetType", ImmutableSet.of("item"))
|
||||||
|
.put(
|
||||||
|
"BundleInstanceTaskType",
|
||||||
|
ImmutableSet.of("updateTime", "startTime", "progress", "instanceId", "state",
|
||||||
|
"bundleId", "storage", "error")).put(
|
||||||
|
"ConfirmProductInstanceResponse",
|
||||||
|
ImmutableSet.of("ownerId", "requestId", "return")).put(
|
||||||
|
"CreateKeyPairResponse",
|
||||||
|
ImmutableSet.of("keyName", "keyMaterial", "requestId", "keyFingerprint")).put(
|
||||||
|
"RegisterImageResponse", ImmutableSet.of("imageId", "requestId")).put(
|
||||||
|
"IpRangeSetType", ImmutableSet.of("item")).put("RegionSetType",
|
||||||
|
ImmutableSet.of("item")).put("InstanceStateType",
|
||||||
|
ImmutableSet.of("name", "code")).put(
|
||||||
|
"DescribeReservedInstancesOfferingsResponseSetItemType",
|
||||||
|
ImmutableSet.of("productDescription", "reservedInstancesOfferingId",
|
||||||
|
"usagePrice", "fixedPrice", "availabilityZone", "duration",
|
||||||
|
"instanceType")).put(
|
||||||
|
"BundleInstanceS3StorageType",
|
||||||
|
ImmutableSet.of("awsAccessKeyId", "uploadPolicy", "secret-access-key",
|
||||||
|
"bucket", "prefix", "uploadPolicySignature")).put(
|
||||||
|
"DescribeVolumesResponse", ImmutableSet.of("requestId", "volumeSet")).put(
|
||||||
|
"TerminateInstancesResponseInfoType", ImmutableSet.of("item")).put(
|
||||||
|
"DeleteSnapshotResponse", ImmutableSet.of("return", "requestId")).put(
|
||||||
|
"BundleInstanceTaskStorageType", ImmutableSet.of("S3")).put(
|
||||||
|
"DescribeAvailabilityZonesResponse",
|
||||||
|
ImmutableSet.of("requestId", "availabilityZoneInfo")).put(
|
||||||
|
"CreateVolumeResponse",
|
||||||
|
ImmutableSet.of("snapshotId", "size", "volumeId", "availabilityZone",
|
||||||
|
"requestId", "createTime", "status")).put(
|
||||||
|
"DescribeReservedInstancesResponseSetType", ImmutableSet.of("item")).put(
|
||||||
|
"DescribeAddressesResponse", ImmutableSet.of("requestId", "addressesSet"))
|
||||||
|
.put("InstanceMonitoringStateType", ImmutableSet.of("state")).put(
|
||||||
|
"DetachVolumeResponse",
|
||||||
|
ImmutableSet.of("status", "requestId", "instanceId", "volumeId", "device",
|
||||||
|
"attachTime")).put("DescribeKeyPairsResponse",
|
||||||
|
ImmutableSet.of("requestId", "keySet")).put(
|
||||||
|
"AttachVolumeResponse",
|
||||||
|
ImmutableSet.of("device", "attachTime", "requestId", "volumeId", "status",
|
||||||
|
"instanceId")).put("DescribeBundleTasksResponse",
|
||||||
|
ImmutableSet.of("bundleInstanceTasksSet", "requestId")).put(
|
||||||
|
"TerminateInstancesResponseItemType",
|
||||||
|
ImmutableSet.of("shutdownState", "previousState", "instanceId")).put(
|
||||||
|
"SecurityGroupSetType", ImmutableSet.of("item")).put(
|
||||||
|
"AttachmentSetResponseType", ImmutableSet.of("item")).put(
|
||||||
|
"DescribeImageAttributeResponse",
|
||||||
|
ImmutableSet.of("kernel", "productCodes", "requestId", "ramdisk",
|
||||||
|
"launchPermission", "blockDeviceMapping", "imageId")).put(
|
||||||
|
"PurchaseReservedInstancesOfferingResponse",
|
||||||
|
ImmutableSet.of("reservedInstancesId", "requestId")).put(
|
||||||
|
"CreateSnapshotResponse",
|
||||||
|
ImmutableSet.of("requestId", "status", "startTime", "volumeId", "snapshotId",
|
||||||
|
"progress")).put("GroupSetType", ImmutableSet.of("item")).put(
|
||||||
|
"ProductCodesSetItemType", ImmutableSet.of("productCode")).put(
|
||||||
|
"AllocateAddressResponse", ImmutableSet.of("requestId", "publicIp")).put(
|
||||||
|
"ProductCodeItemType", ImmutableSet.of("productCode")).put(
|
||||||
|
"UserIdGroupPairType", ImmutableSet.of("userId", "groupName ")).put(
|
||||||
|
"DescribeVolumesSetResponseType", ImmutableSet.of("item")).put(
|
||||||
|
"ProductCodeListType", ImmutableSet.of("item")).put("DescribeRegionsResponse",
|
||||||
|
ImmutableSet.of("requestId", "regionInfo")).put("RegionItemType",
|
||||||
|
ImmutableSet.of("regionEndpoint", "regionName")).put(
|
||||||
|
"DescribeInstancesResponse", ImmutableSet.of("requestId", "reservationSet"))
|
||||||
|
.put(
|
||||||
|
"DescribeImagesResponseItemType",
|
||||||
|
ImmutableSet.of("kernelId", "productCodes", "isPublic", "imageId",
|
||||||
|
"ramdiskId", "imageOwnerId", "platform", "imageType", "imageState",
|
||||||
|
"imageLocation", "architecture")).put("LaunchPermissionListType",
|
||||||
|
ImmutableSet.of("item")).put("BlockDeviceMappingItemType",
|
||||||
|
ImmutableSet.of("virtualName", "deviceName")).put("DeleteVolumeResponse",
|
||||||
|
ImmutableSet.of("return", "requestId")).put("DescribeImagesResponseInfoType",
|
||||||
|
ImmutableSet.of("item")).put("IpRangeItemType", ImmutableSet.of("cidrIp "))
|
||||||
|
.put("DisassociateAddressResponse", ImmutableSet.of("requestId", "return")).put(
|
||||||
|
"UserIdGroupPairSetType", ImmutableSet.of("item"))
|
||||||
|
.put("CancelBundleTaskResponse", ImmutableSet.of("bundleInstanceTask", "requestId"))
|
||||||
|
.put("MonitorInstancesResponseSetType", ImmutableSet.of("item")).put(
|
||||||
|
"DescribeReservedInstancesResponseSetItemType",
|
||||||
|
ImmutableSet.of("state", "duration", "usagePrice", "instanceType",
|
||||||
|
"instanceCount", "productDescription", "reservedInstancesId",
|
||||||
|
"fixedPrice", "availabilityZone", "start")).put(
|
||||||
|
"DescribeSecurityGroupsResponse",
|
||||||
|
ImmutableSet.of("requestId", "securityGroupInfo")).put(
|
||||||
|
"GetConsoleOutputResponse",
|
||||||
|
ImmutableSet.of("requestId", "output", "instanceId", "timestamp")).put(
|
||||||
|
"ModifyImageAttributeResponse", ImmutableSet.of("requestId", "return"))
|
||||||
|
.put("AssociateAddressResponse", ImmutableSet.of("requestId", "publicIp", "return"))
|
||||||
|
.put("ConfirmProductInstance", ImmutableSet.of("ProductCode", "InstanceId")).put(
|
||||||
|
"DeregisterImage", ImmutableSet.of("ImageId")).put(
|
||||||
|
"ModifyImageAttribute",
|
||||||
|
ImmutableSet.of("Group.n", "UserId.n", "ImageId", "ProductCode.n", "Group.n",
|
||||||
|
"UserId.n")).put(
|
||||||
|
"DescribeImageAttribute",
|
||||||
|
ImmutableSet.of("ProductCodes", "ImageId", "Platform", "BlockDeviceMapping",
|
||||||
|
"LaunchPermission", "Ramdisk", "Kernel")).put("DescribeImages",
|
||||||
|
ImmutableSet.of("explicit", "public", "implicit")).put(
|
||||||
|
"DescribeAvailabilityZones", ImmutableSet.of("ZoneName")).put(
|
||||||
|
"DescribeRegions", ImmutableSet.of("Region.n")).put("DeleteVolume",
|
||||||
|
ImmutableSet.of("VolumeId")).put("DescribeSnapshots",
|
||||||
|
ImmutableSet.of("SnapshotId.n")).put("DescribeVolumes",
|
||||||
|
ImmutableSet.of("VolumeId")).put("DetachVolume",
|
||||||
|
ImmutableSet.of("Device", "VolumeId", "InstanceId", "Force")).put(
|
||||||
|
"AttachVolume", ImmutableSet.of("InstanceId", "Device", "VolumeId")).put(
|
||||||
|
"CreateSnapshot", ImmutableSet.of("VolumeId")).put("CreateVolume",
|
||||||
|
ImmutableSet.of("SnapshotId", "Size", "AvailabilityZone")).put(
|
||||||
|
"DeleteSnapshot", ImmutableSet.of("SnapshotId")).put("AllocateAddress",
|
||||||
|
ImmutableSet.of("AllocateAddressResponse", "requestId", "publicIp")).put(
|
||||||
|
"DisassociateAddress", ImmutableSet.of("PublicIp")).put("ReleaseAddress",
|
||||||
|
ImmutableSet.of("PublicIp")).put("AssociateAddress",
|
||||||
|
ImmutableSet.of("InstanceId", "PublicIp")).put("DescribeAddresses",
|
||||||
|
ImmutableSet.of("PublicIp.n")).put("GetConsoleOutput",
|
||||||
|
ImmutableSet.of("InstanceId")).put("ResetImageAttribute",
|
||||||
|
ImmutableSet.of("ImageId")).put("RegisterImage",
|
||||||
|
ImmutableSet.of("ImageLocation")).put("TerminateInstances",
|
||||||
|
ImmutableSet.of("InstanceId.n")).put("DescribeInstances",
|
||||||
|
ImmutableSet.of("InstanceId.n")).put(
|
||||||
|
"RunInstances",
|
||||||
|
ImmutableSet.of("Monitoring.Enabled", "Encoding", "AvailabilityZone",
|
||||||
|
"KernelId", "MaxCount", "Data", "ImageId", "InstanceType",
|
||||||
|
"MinCount", "groupId", "VirtualName", "AddressingType", "KeyName",
|
||||||
|
"DeviceName", "Version", "RamdiskId")).put("RebootInstances",
|
||||||
|
ImmutableSet.of("InstanceId.n")).put("DescribeKeyPairs",
|
||||||
|
ImmutableSet.of("KeyName.n")).put("CreateKeyPair", ImmutableSet.of("KeyName"))
|
||||||
|
.put("DeleteKeyPair", ImmutableSet.of("KeyName")).put("MonitorInstances",
|
||||||
|
ImmutableSet.of("InstanceId.n")).put("UnmonitorInstances",
|
||||||
|
ImmutableSet.of("InstanceId.n")).put("DescribeReservedInstances",
|
||||||
|
ImmutableSet.of("ReservedInstancesId.n")).put(
|
||||||
|
"DescribeReservedInstancesOfferings",
|
||||||
|
ImmutableSet.of("ProductDescription", "ReservedInstancesOfferingId",
|
||||||
|
"AvailabilityZone", "InstanceType")).put(
|
||||||
|
"PurchaseReservedInstancesOffering",
|
||||||
|
ImmutableSet.of("ReservedInstancesOfferingId.n", "InstanceCount.n")).put(
|
||||||
|
"DescribeSecurityGroups", ImmutableSet.of("GroupName.n")).put(
|
||||||
|
"AuthorizeSecurityGroupIngress",
|
||||||
|
ImmutableSet.of("GroupName", "GroupName", "UserId", "IpProtocol", "CidrIp",
|
||||||
|
"ToPort", "FromPort", "UserId")).put("CreateSecurityGroup",
|
||||||
|
ImmutableSet.of("GroupDescription", "GroupName")).put("DeleteSecurityGroup",
|
||||||
|
ImmutableSet.of("GroupName")).put(
|
||||||
|
"RevokeSecurityGroupIngress",
|
||||||
|
ImmutableSet.of("IpProtocol", "GroupName", "UserId", "CidrIp", "FromPort",
|
||||||
|
"ToPort", "GroupName", "UserId")).put("CancelBundleTask",
|
||||||
|
ImmutableSet.of("BundleId")).put("DescribeBundleTasks",
|
||||||
|
ImmutableSet.of("BundleId")).put(
|
||||||
|
"BundleInstance",
|
||||||
|
ImmutableSet.of("Storage.S3.UploadPolicy", "InstanceId", "Storage.S3.Prefix",
|
||||||
|
"Storage.S3.AWSAccessKeyId", "Storage.S3.Bucket",
|
||||||
|
"Storage.S3.UploadPolicySignature")).build();
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi.parser;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.AmazonEC2QueryAPI;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts object models representing AWS API beans into Java classes.
|
||||||
|
* <p>
|
||||||
|
* This implementation is designed to perform the following steps:
|
||||||
|
* <ul>
|
||||||
|
* <li>Parse the JSON object representation produced by the <tt>parse_ec2.pl</tt> perl script</li>
|
||||||
|
* <li>Convert the JSON into Java object models (@see org.jclouds.aws.codegen.models)</li>
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class AmazonEC2QueryAPIParser {
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPI parseJSONResource(String resource) {
|
||||||
|
InputStream in = AmazonEC2QueryAPI.class.getResourceAsStream(resource);
|
||||||
|
return parseJSONInputStream(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPI parseJSONFile(File file) throws FileNotFoundException {
|
||||||
|
InputStream in = new FileInputStream(file);
|
||||||
|
return parseJSONInputStream(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPI parseJSONInputStream(InputStream in) {
|
||||||
|
assert in != null;
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
AmazonEC2QueryAPIValidator validator = new AmazonEC2QueryAPIValidator();
|
||||||
|
validator.setModel(gson.fromJson(new InputStreamReader(in), AmazonEC2QueryAPI.class));
|
||||||
|
validator.validateCategories().validateCommands().validateDomain();
|
||||||
|
return validator.getModel();
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi.parser;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.AmazonEC2QueryAPI;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Category;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Content;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.DataType;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Query;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
public class AmazonEC2QueryAPIValidator extends AmazonEC2QueryAPIExpectations {
|
||||||
|
protected AmazonEC2QueryAPIValidator validateQueriesInCategory(String categoryName) {
|
||||||
|
for (String query : expectedQueryNamesForCategoryName.get(categoryName)) {
|
||||||
|
validateQueryInCategory(query, categoryName);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AmazonEC2QueryAPIValidator validateQueryInCategory(String queryName,
|
||||||
|
String categoryName) {
|
||||||
|
Category category = getModel().getCategories().get(categoryName);
|
||||||
|
checkState(category != null, String.format("category %1$s not present", categoryName));
|
||||||
|
Query query = category.getQueries().get(queryName);
|
||||||
|
validateTopLevelType(query);
|
||||||
|
checkState(category != null, String.format("query %1$s not present in category %2$s",
|
||||||
|
queryName, categoryName));
|
||||||
|
checkState(query.getResponseType().equals(query.getType() + "Response"), String.format(
|
||||||
|
"Invalid responseType for %1$s [%2$s] should be %1$sResponse", queryName, query
|
||||||
|
.getResponseType()));
|
||||||
|
checkNotNull(query.getDescription(), String.format("%1$s: getDescription()", query.getType()));
|
||||||
|
|
||||||
|
validateTopLevelType(query);
|
||||||
|
|
||||||
|
DataType response = getModel().getDataTypes().get(query.getResponseType());
|
||||||
|
checkNotNull(response, String.format("response %1$s not present in domain for %2$s", query
|
||||||
|
.getResponseType(), query.getType()));
|
||||||
|
checkState(query.getResponseType().equals(query.getType() + "Response"));
|
||||||
|
checkState(response.getType().equals(query.getType() + "Response"));
|
||||||
|
validateTopLevelType(response);
|
||||||
|
return validateDataType(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void validateTopLevelType(DataType type) {
|
||||||
|
checkState(type.getAncestor() == null, String
|
||||||
|
.format("%1$s should not have an ancestor", type));
|
||||||
|
checkNotNull(type.getExampleCode(), String.format("%1$s: getExampleCode()", type.getType()));
|
||||||
|
checkNotNull(type.getExampleHTML(), String.format("%1$s: getExampleHTML()", type.getType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AmazonEC2QueryAPIValidator validateDataType(DataType dataType) {
|
||||||
|
checkState(dataType.getSee().size() >= 1, "see should have at least one entry");
|
||||||
|
Set<String> fieldNames = Sets.newTreeSet(Iterables.transform(dataType.getContents(),
|
||||||
|
new Function<Content, String>() {
|
||||||
|
public String apply(Content field) {
|
||||||
|
return field.getName();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
checkState(Sets.difference(fieldNames,
|
||||||
|
expectedFieldNamesForDataTypeName.get(dataType.getType())).size() == 0, String
|
||||||
|
.format("%1$s hasn't the correct fields. has [%2$s] should have [%3$s]", dataType
|
||||||
|
.getType(), fieldNames, expectedFieldNamesForDataTypeName.get(dataType
|
||||||
|
.getType())));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AmazonEC2QueryAPI model;
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPIValidator validateCommands() {
|
||||||
|
for (String categoryName : expectedQueryNamesForCategoryName.keySet()) {
|
||||||
|
for (String queryName : expectedQueryNamesForCategoryName.get(categoryName)) {
|
||||||
|
validateQueryInCategory(queryName, categoryName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPIValidator validateDomain() {
|
||||||
|
for (String dataTypeName : expectedFieldNamesForDataTypeName.keySet()) {
|
||||||
|
if (!this.queryNames.contains(dataTypeName))
|
||||||
|
validateDataType(checkNotNull(getModel().getDataTypes().get(dataTypeName), dataTypeName));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPIValidator validateCategories() {
|
||||||
|
checkState(Sets.difference(getModel().getCategories().keySet(),
|
||||||
|
expectedQueryNamesForCategoryName.keySet()).size() == 0);
|
||||||
|
checkState(getModel().getCategories().keySet().size() == expectedQueryNamesForCategoryName
|
||||||
|
.keySet().size());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModel(AmazonEC2QueryAPI model) {
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AmazonEC2QueryAPI getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,41 +21,28 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.ec2.queryapi.transform;
|
||||||
|
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.AmazonEC2QueryAPI;
|
||||||
|
import org.jclouds.codegen.model.API;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Converts object models representing AWS API beans into Java classes.
|
||||||
|
* <p>
|
||||||
|
* This implementation is designed to perform the following steps:
|
||||||
|
* <ul>
|
||||||
|
* <li>Parse the JSON object representation produced by the <tt>parse_ec2.pl</tt> perl script</li>
|
||||||
|
* <li>Convert the JSON into Java object models (@see org.jclouds.aws.codegen.models)</li>
|
||||||
*
|
*
|
||||||
* @author James Murty
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public abstract class BaseBean {
|
public class AmazonEC2QueryAPITransformer {
|
||||||
private String className;
|
|
||||||
private String packageName;
|
|
||||||
private String awsType;
|
|
||||||
private String javaType;
|
|
||||||
private String javaName;
|
|
||||||
|
|
||||||
public String getJavaType() {
|
public API transform(AmazonEC2QueryAPI amazonAPI) {
|
||||||
return javaType;
|
API api = new API();
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassName() {
|
return api;
|
||||||
return className;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackageName() {
|
|
||||||
return packageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAwsType() {
|
|
||||||
return awsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJavaName(String javaName) {
|
|
||||||
this.javaName = javaName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJavaName() {
|
|
||||||
return javaName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi.transform;
|
||||||
|
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Content;
|
||||||
|
import org.jclouds.codegen.model.Field;
|
||||||
|
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts object models representing AWS API beans into Java classes.
|
||||||
|
* <p>
|
||||||
|
* This implementation is designed to perform the following steps:
|
||||||
|
* <ul>
|
||||||
|
* <li>Parse the JSON object representation produced by the <tt>parse_ec2.pl</tt> perl script</li>
|
||||||
|
* <li>Convert the JSON into Java object models (@see org.jclouds.aws.codegen.models)</li>
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class ConvertContentToField implements Function<Content, Field> {
|
||||||
|
|
||||||
|
public Field apply(Content from) {
|
||||||
|
Field field = new Field();
|
||||||
|
field.setConstraints(from.getConstraints());
|
||||||
|
field.setDefaultValue(from.getDefaultValue());
|
||||||
|
field.setDesc(from.getDesc());
|
||||||
|
field.setName(from.getName());
|
||||||
|
field.setJavaName(parseJavaName(from.getName()));
|
||||||
|
field.setOptional(Boolean.parseBoolean(from.getOptional()));
|
||||||
|
field.setType(from.getType());
|
||||||
|
field.setValueMap(from.getValueMap());
|
||||||
|
field.setJavaType(parseJavaType(from.getType()));
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
String parseJavaType(String type) {
|
||||||
|
if (type.indexOf("xsd:") >= 0) {
|
||||||
|
return parseJavaTypeForXsd(type);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
String parseJavaTypeForXsd(String type) {
|
||||||
|
if (type.equals("xsd:string")) {
|
||||||
|
return "String";
|
||||||
|
} else if (type.equals("xsd:Int")) {
|
||||||
|
return "Integer";
|
||||||
|
} else if (type.equals("xsd:boolean")) {
|
||||||
|
return "Boolean";
|
||||||
|
} else if (type.equals("xsd:dateTime")) {
|
||||||
|
return "org.joda.time.DateTime";
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("type not supported: " + type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
String parseJavaName(String name) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,904 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.ec2.queryapi.parser;
|
||||||
|
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Category;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Content;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.DataType;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.Query;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.parser.AmazonEC2QueryAPIParser;
|
||||||
|
import org.jclouds.codegen.ec2.queryapi.parser.AmazonEC2QueryAPIValidator;
|
||||||
|
import org.testng.annotations.AfterTest;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests to ensure that the json file parsed from the EC2 site appears correct.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(testName = "ec2.AmazonEC2QueryAPIParser")
|
||||||
|
public class AmazonEC2QueryAPIParserTest extends AmazonEC2QueryAPIValidator {
|
||||||
|
@BeforeTest
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
setModel(new AmazonEC2QueryAPIParser().parseJSONResource("/objmodels/ec2.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCategoriesParsedNames() {
|
||||||
|
super.validateCategories();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTest
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
setModel(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private void codeUsedToGenerateThisClass() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder
|
||||||
|
.append(" private Map<String, Set<String>> expectedQueryNamesForCategoryName = new ImmutableMap.Builder");
|
||||||
|
builder.append("<String, Set<String>>()").append("\n");
|
||||||
|
|
||||||
|
for (Category category : getModel().getCategories().values()) {
|
||||||
|
builder.append(String.format(".put(\"%1$s\",%n ImmutableSet.of(", category.getName()));
|
||||||
|
for (String string : category.getQueries().keySet()) {
|
||||||
|
builder.append(String.format("\"%1$s\",", string));
|
||||||
|
}
|
||||||
|
builder.append(String.format("))%n"));
|
||||||
|
}
|
||||||
|
builder.append(String.format(".build();"));
|
||||||
|
System.out.println(builder.toString().replaceAll(",\\)", ")"));
|
||||||
|
|
||||||
|
builder = new StringBuilder();
|
||||||
|
builder
|
||||||
|
.append(" private Map<String, Set<String>> expectedFieldNamesForBeanName = new ImmutableMap.Builder");
|
||||||
|
builder.append("<String, Set<String>>()").append("\n");
|
||||||
|
|
||||||
|
for (DataType bean : getModel().getDataTypes().values()) {
|
||||||
|
builder.append(String.format(".put(\"%1$s\",%n ImmutableSet.of(", bean.getType()));
|
||||||
|
for (Content field : bean.getContents()) {
|
||||||
|
builder.append(String.format("\"%1$s\",", field.getName()));
|
||||||
|
}
|
||||||
|
builder.append(String.format("))%n"));
|
||||||
|
}
|
||||||
|
for (Category category : getModel().getCategories().values()) {
|
||||||
|
for (DataType bean : category.getQueries().values()) {
|
||||||
|
builder.append(String.format(".put(\"%1$s\",%n ImmutableSet.of(", bean.getType()));
|
||||||
|
for (Content field : bean.getContents()) {
|
||||||
|
builder.append(String.format("\"%1$s\",", field.getName()));
|
||||||
|
}
|
||||||
|
builder.append(String.format("))%n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.append(String.format(".build();"));
|
||||||
|
System.out.println(builder.toString().replaceAll(",\\)", ")"));
|
||||||
|
|
||||||
|
for (String string : getModel().getCategories().keySet()) {
|
||||||
|
System.out.printf(" @Test%n public void test%1$sQueryNames(){%n "
|
||||||
|
+ "validateQueriesInCategory(\"%2$s\");" + "}%n", string.replaceAll(" ", ""),
|
||||||
|
string);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Category cat : getModel().getCategories().values()) {
|
||||||
|
for (Query bean : cat.getQueries().values()) {
|
||||||
|
System.out.printf(" @Test%n public void test%1$sQuery(){%n "
|
||||||
|
+ "validateQueryInCategory(\"%1$s\", \"%2$s\");%n}%n", bean.getType(), cat
|
||||||
|
.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for (DataType bean : getModel().getDataTypes().values()) {
|
||||||
|
System.out.printf(" @Test%n public void test%1$sBean(){%n "
|
||||||
|
+ "validateFieldsOfBean(getModel().getDomain().get(\"%1$s\"));%n}%n", bean
|
||||||
|
.getType());
|
||||||
|
}
|
||||||
|
System.out.printf(" public EC2ModelValidator validateCommands() {%n");
|
||||||
|
for (Category cat : getModel().getCategories().values()) {
|
||||||
|
for (Query bean : cat.getQueries().values()) {
|
||||||
|
System.out.printf("validateQueryInCategory(\"%1$s\", \"%2$s\");%n", bean.getType(), cat
|
||||||
|
.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.printf("return this;%n }%n");
|
||||||
|
|
||||||
|
System.out.printf(" public EC2ModelValidator validateDomain() {%n");
|
||||||
|
for (DataType bean : getModel().getDataTypes().values()) {
|
||||||
|
System.out.printf("validateFieldsOfBean(getModel().getDomain().get(\"%1$s\"));%n", bean
|
||||||
|
.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.printf("return this;%n }%n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAmazonDevPayQueryNames() {
|
||||||
|
validateQueriesInCategory("Amazon DevPay");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAMIsQueryNames() {
|
||||||
|
validateQueriesInCategory("AMIs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAvailabilityZonesandRegionsQueryNames() {
|
||||||
|
validateQueriesInCategory("Availability Zones and Regions");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testElasticBlockStoreQueryNames() {
|
||||||
|
validateQueriesInCategory("Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testElasticIPAddressesQueryNames() {
|
||||||
|
validateQueriesInCategory("Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGeneralQueryNames() {
|
||||||
|
validateQueriesInCategory("General");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImagesQueryNames() {
|
||||||
|
validateQueriesInCategory("Images");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInstancesQueryNames() {
|
||||||
|
validateQueriesInCategory("Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testKeyPairsQueryNames() {
|
||||||
|
validateQueriesInCategory("Key Pairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMonitoringQueryNames() {
|
||||||
|
validateQueriesInCategory("Monitoring");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReservedInstancesQueryNames() {
|
||||||
|
validateQueriesInCategory("Reserved Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSecurityGroupsQueryNames() {
|
||||||
|
validateQueriesInCategory("Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWindowsQueryNames() {
|
||||||
|
validateQueriesInCategory("Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfirmProductInstanceQuery() {
|
||||||
|
validateQueryInCategory("ConfirmProductInstance", "Amazon DevPay");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeregisterImageQuery() {
|
||||||
|
validateQueryInCategory("DeregisterImage", "AMIs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testModifyImageAttributeQuery() {
|
||||||
|
validateQueryInCategory("ModifyImageAttribute", "AMIs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImageAttributeQuery() {
|
||||||
|
validateQueryInCategory("DescribeImageAttribute", "AMIs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImagesQuery() {
|
||||||
|
validateQueryInCategory("DescribeImages", "AMIs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAvailabilityZonesQuery() {
|
||||||
|
validateQueryInCategory("DescribeAvailabilityZones", "Availability Zones and Regions");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeRegionsQuery() {
|
||||||
|
validateQueryInCategory("DescribeRegions", "Availability Zones and Regions");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteVolumeQuery() {
|
||||||
|
validateQueryInCategory("DeleteVolume", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSnapshotsQuery() {
|
||||||
|
validateQueryInCategory("DescribeSnapshots", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeVolumesQuery() {
|
||||||
|
validateQueryInCategory("DescribeVolumes", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDetachVolumeQuery() {
|
||||||
|
validateQueryInCategory("DetachVolume", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAttachVolumeQuery() {
|
||||||
|
validateQueryInCategory("AttachVolume", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateSnapshotQuery() {
|
||||||
|
validateQueryInCategory("CreateSnapshot", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateVolumeQuery() {
|
||||||
|
validateQueryInCategory("CreateVolume", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteSnapshotQuery() {
|
||||||
|
validateQueryInCategory("DeleteSnapshot", "Elastic Block Store");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAllocateAddressQuery() {
|
||||||
|
validateQueryInCategory("AllocateAddress", "Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDisassociateAddressQuery() {
|
||||||
|
validateQueryInCategory("DisassociateAddress", "Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReleaseAddressQuery() {
|
||||||
|
validateQueryInCategory("ReleaseAddress", "Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssociateAddressQuery() {
|
||||||
|
validateQueryInCategory("AssociateAddress", "Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAddressesQuery() {
|
||||||
|
validateQueryInCategory("DescribeAddresses", "Elastic IP Addresses");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetConsoleOutputQuery() {
|
||||||
|
validateQueryInCategory("GetConsoleOutput", "General");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testResetImageAttributeQuery() {
|
||||||
|
validateQueryInCategory("ResetImageAttribute", "Images");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegisterImageQuery() {
|
||||||
|
validateQueryInCategory("RegisterImage", "Images");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTerminateInstancesQuery() {
|
||||||
|
validateQueryInCategory("TerminateInstances", "Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeInstancesQuery() {
|
||||||
|
validateQueryInCategory("DescribeInstances", "Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRunInstancesQuery() {
|
||||||
|
validateQueryInCategory("RunInstances", "Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRebootInstancesQuery() {
|
||||||
|
validateQueryInCategory("RebootInstances", "Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeKeyPairsQuery() {
|
||||||
|
validateQueryInCategory("DescribeKeyPairs", "Key Pairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateKeyPairQuery() {
|
||||||
|
validateQueryInCategory("CreateKeyPair", "Key Pairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteKeyPairQuery() {
|
||||||
|
validateQueryInCategory("DeleteKeyPair", "Key Pairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMonitorInstancesQuery() {
|
||||||
|
validateQueryInCategory("MonitorInstances", "Monitoring");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnmonitorInstancesQuery() {
|
||||||
|
validateQueryInCategory("UnmonitorInstances", "Monitoring");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesQuery() {
|
||||||
|
validateQueryInCategory("DescribeReservedInstances", "Reserved Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesOfferingsQuery() {
|
||||||
|
validateQueryInCategory("DescribeReservedInstancesOfferings", "Reserved Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPurchaseReservedInstancesOfferingQuery() {
|
||||||
|
validateQueryInCategory("PurchaseReservedInstancesOffering", "Reserved Instances");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSecurityGroupsQuery() {
|
||||||
|
validateQueryInCategory("DescribeSecurityGroups", "Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAuthorizeSecurityGroupIngressQuery() {
|
||||||
|
validateQueryInCategory("AuthorizeSecurityGroupIngress", "Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateSecurityGroupQuery() {
|
||||||
|
validateQueryInCategory("CreateSecurityGroup", "Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteSecurityGroupQuery() {
|
||||||
|
validateQueryInCategory("DeleteSecurityGroup", "Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRevokeSecurityGroupIngressQuery() {
|
||||||
|
validateQueryInCategory("RevokeSecurityGroupIngress", "Security Groups");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCancelBundleTaskQuery() {
|
||||||
|
validateQueryInCategory("CancelBundleTask", "Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeBundleTasksQuery() {
|
||||||
|
validateQueryInCategory("DescribeBundleTasks", "Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceQuery() {
|
||||||
|
validateQueryInCategory("BundleInstance", "Windows");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReservationSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ReservationSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteKeyPairResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DeleteKeyPairResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeKeyPairsResponseInfoTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeKeyPairsResponseInfoType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAuthorizeSecurityGroupIngressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AuthorizeSecurityGroupIngressResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAttachmentSetItemResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AttachmentSetItemResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAddressesResponseInfoTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeAddressesResponseInfoType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeReservedInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeVolumesSetItemResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeVolumesSetItemResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLaunchPermissionItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("LaunchPermissionItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSnapshotsSetItemResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeSnapshotsSetItemResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRunningInstancesItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RunningInstancesItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesOfferingsResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeReservedInstancesOfferingsResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBlockDeviceMappingTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BlockDeviceMappingType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testResetImageAttributeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ResetImageAttributeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAvailabilityZoneSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AvailabilityZoneSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRevokeSecurityGroupIngressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RevokeSecurityGroupIngressResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReservationInfoTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ReservationInfoType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRebootInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RebootInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGroupItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("GroupItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAvailabilityZoneItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AvailabilityZoneItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRunningInstancesSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RunningInstancesSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateSecurityGroupResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("CreateSecurityGroupResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReleaseAddressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ReleaseAddressResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSecurityGroupItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("SecurityGroupItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNullableAttributeValueTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("NullableAttributeValueType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSnapshotsResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeSnapshotsResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeKeyPairsResponseItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeKeyPairsResponseItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceTasksSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceTasksSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAddressesResponseItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeAddressesResponseItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMonitorInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("MonitorInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImagesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeImagesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMonitorInstancesResponseSetItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("MonitorInstancesResponseSetItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceTaskErrorTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceTaskErrorType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProductCodesSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ProductCodesSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnmonitorInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("UnmonitorInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIpPermissionTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("IpPermissionType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIpPermissionSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("IpPermissionSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteSecurityGroupResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DeleteSecurityGroupResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRunInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RunInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeregisterImageResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DeregisterImageResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTerminateInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("TerminateInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSnapshotsSetResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeSnapshotsSetResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesOfferingsResponseSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get(
|
||||||
|
"DescribeReservedInstancesOfferingsResponseSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceTaskTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceTaskType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfirmProductInstanceResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ConfirmProductInstanceResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateKeyPairResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("CreateKeyPairResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegisterImageResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RegisterImageResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIpRangeSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("IpRangeSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegionSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RegionSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInstanceStateTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("InstanceStateType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesOfferingsResponseSetItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get(
|
||||||
|
"DescribeReservedInstancesOfferingsResponseSetItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceS3StorageTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceS3StorageType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeVolumesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeVolumesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTerminateInstancesResponseInfoTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("TerminateInstancesResponseInfoType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteSnapshotResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DeleteSnapshotResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBundleInstanceTaskStorageTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BundleInstanceTaskStorageType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAvailabilityZonesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeAvailabilityZonesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateVolumeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("CreateVolumeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesResponseSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeReservedInstancesResponseSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeAddressesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeAddressesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInstanceMonitoringStateTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("InstanceMonitoringStateType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDetachVolumeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DetachVolumeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeKeyPairsResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeKeyPairsResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAttachVolumeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AttachVolumeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeBundleTasksResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeBundleTasksResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTerminateInstancesResponseItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("TerminateInstancesResponseItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSecurityGroupSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("SecurityGroupSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAttachmentSetResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AttachmentSetResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImageAttributeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeImageAttributeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPurchaseReservedInstancesOfferingResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("PurchaseReservedInstancesOfferingResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateSnapshotResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("CreateSnapshotResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGroupSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("GroupSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProductCodesSetItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ProductCodesSetItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAllocateAddressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AllocateAddressResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProductCodeItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ProductCodeItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserIdGroupPairTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("UserIdGroupPairType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeVolumesSetResponseTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeVolumesSetResponseType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProductCodeListTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ProductCodeListType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeRegionsResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeRegionsResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRegionItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("RegionItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeInstancesResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeInstancesResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImagesResponseItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeImagesResponseItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLaunchPermissionListTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("LaunchPermissionListType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBlockDeviceMappingItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("BlockDeviceMappingItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteVolumeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DeleteVolumeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeImagesResponseInfoTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeImagesResponseInfoType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIpRangeItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("IpRangeItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDisassociateAddressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DisassociateAddressResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserIdGroupPairSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("UserIdGroupPairSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCancelBundleTaskResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("CancelBundleTaskResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMonitorInstancesResponseSetTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("MonitorInstancesResponseSetType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeReservedInstancesResponseSetItemTypeBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get(
|
||||||
|
"DescribeReservedInstancesResponseSetItemType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDescribeSecurityGroupsResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("DescribeSecurityGroupsResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetConsoleOutputResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("GetConsoleOutputResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testModifyImageAttributeResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("ModifyImageAttributeResponse"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAssociateAddressResponseBean() {
|
||||||
|
validateDataType(getModel().getDataTypes().get("AssociateAddressResponse"));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package org.jclouds.codegen.ec2.queryapi.transform;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests to ensure that we can transform EC2 {@link Content contents} to jclouds {@link Field
|
||||||
|
* fields}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(testName = "ec2.ConvertContentToFieldTest")
|
||||||
|
public class ConvertContentToFieldTest {
|
||||||
|
|
||||||
|
// sub parse_java_type {
|
||||||
|
// $_ = shift;
|
||||||
|
// s/xsd:string/String/;
|
||||||
|
// s/xsd:boolean/Boolean/;
|
||||||
|
// s/xsd:Int/Integer/;
|
||||||
|
// s/xsd:dateTime/DateTime/;
|
||||||
|
// if (/Type/ || /Item/ || /Info/) {
|
||||||
|
// my $awsType = $_;
|
||||||
|
// my $javaType = get_java_name($awsType);
|
||||||
|
// #if ( !/Response/ ) {
|
||||||
|
// $domain->{$awsType} = {
|
||||||
|
// awsType => $awsType,
|
||||||
|
// javaType => $javaType,
|
||||||
|
// packageName => $domain_package,
|
||||||
|
// className => $domain_package . "." . $javaType,
|
||||||
|
// see => ["${refUrl}/ApiReference-ItemType-${awsType}.html"],
|
||||||
|
// fields =>
|
||||||
|
// build_fields("${refUrl}/ApiReference-ItemType-$awsType.html")
|
||||||
|
// };
|
||||||
|
// #}
|
||||||
|
// $_ = $javaType;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return $_;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// sub get_java_name {
|
||||||
|
// $_ = shift;
|
||||||
|
// if (/sSetType/) {
|
||||||
|
// s/sSetType//;
|
||||||
|
// return "Set<$_>";
|
||||||
|
// }
|
||||||
|
// if (/ListType/) {
|
||||||
|
// s/ListType//;
|
||||||
|
// return "List<$_>";
|
||||||
|
// }
|
||||||
|
// if (/sResponseInfoType/){
|
||||||
|
// s/sResponseInfoType//;
|
||||||
|
// return "Set<$_>";
|
||||||
|
// }
|
||||||
|
// if (/sSetItemType/) {
|
||||||
|
// s/sSetItemType//;
|
||||||
|
// }
|
||||||
|
// if (/sResponseItemType/){
|
||||||
|
// s/sResponseItemType//;
|
||||||
|
// }
|
||||||
|
// if (/sItemType/) {
|
||||||
|
// s/sItemType//;
|
||||||
|
// }
|
||||||
|
// if (/sSet/) {
|
||||||
|
// s/sSet//;
|
||||||
|
// }
|
||||||
|
// if (/Set/) {
|
||||||
|
// s/Set//;
|
||||||
|
// }
|
||||||
|
// if (/Type/) {
|
||||||
|
// s/Type//;
|
||||||
|
// }
|
||||||
|
// if (/Item/) {
|
||||||
|
// s/Item//;
|
||||||
|
// }
|
||||||
|
// if (/Info/) {
|
||||||
|
// s/Info//;
|
||||||
|
// }
|
||||||
|
// return $_;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseJavaTypeForxsd_string() {
|
||||||
|
ConvertContentToField converter = new ConvertContentToField();
|
||||||
|
assertEquals(converter.parseJavaType("xsd:string"), "String");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseJavaTypeForxsd_Int() {
|
||||||
|
ConvertContentToField converter = new ConvertContentToField();
|
||||||
|
assertEquals(converter.parseJavaType("xsd:Int"), "Integer");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseJavaTypeForxsd_boolean() {
|
||||||
|
ConvertContentToField converter = new ConvertContentToField();
|
||||||
|
assertEquals(converter.parseJavaType("xsd:boolean"), "Boolean");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testParseJavaTypeForxsd_dateTime() {
|
||||||
|
ConvertContentToField converter = new ConvertContentToField();
|
||||||
|
assertEquals(converter.parseJavaType("xsd:dateTime"), "org.joda.time.DateTime");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
190
codegen/pom.xml
190
codegen/pom.xml
|
@ -1,108 +1,106 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
$HeadURL$
|
$HeadURL$ $Revision$ $Date$ Copyright (C) 2009 Adrian Cole
|
||||||
$Revision$
|
<adrian@jclouds.org>
|
||||||
$Date$
|
|
||||||
|
|
||||||
Copyright (C) 2009 Adrian Cole <adrian@jclouds.org>
|
====================================================================
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF 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.html Unless required by
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
applicable law or agreed to in writing, software distributed under the
|
||||||
or more contributor license agreements. See the NOTICE file
|
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
distributed with this work for additional information
|
CONDITIONS OF ANY KIND, either express or implied. See the License for
|
||||||
regarding copyright ownership. The ASF licenses this file
|
the specific language governing permissions and limitations under the
|
||||||
to you under the Apache License, Version 2.0 (the
|
License.
|
||||||
"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.html
|
|
||||||
|
|
||||||
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"
|
<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/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>jclouds-project</artifactId>
|
<artifactId>jclouds-codegen-project</artifactId>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<relativePath>../project/pom.xml</relativePath>
|
<relativePath>../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>jclouds-codegen</artifactId>
|
<artifactId>jclouds-codegen-core</artifactId>
|
||||||
<name>jclouds code generator</name>
|
<name>jclouds code generator</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>jclouds code generator</description>
|
<description>jclouds code generator</description>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/codegen</connection>
|
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/codegen/core</connection>
|
||||||
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/codegen</developerConnection>
|
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/codegen/core</developerConnection>
|
||||||
<url>http://jclouds.googlecode.com/svn/trunk/codegen</url>
|
<url>http://jclouds.googlecode.com/svn/trunk/codegen/core</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>gson</id>
|
<id>gson</id>
|
||||||
<url>http://google-gson.googlecode.com/svn/mavenrepo</url>
|
<url>http://google-gson.googlecode.com/svn/mavenrepo</url>
|
||||||
<snapshots>
|
</repository>
|
||||||
<enabled>true</enabled>
|
</repositories>
|
||||||
</snapshots>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>1.3</version>
|
<version>1.4</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.freemarker</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>freemarker</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.3.14</version>
|
<version>1.3</version>
|
||||||
</dependency>
|
<scope>compile</scope>
|
||||||
</dependencies>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.freemarker</groupId>
|
||||||
|
<artifactId>freemarker</artifactId>
|
||||||
|
<version>2.3.14</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.collections</groupId>
|
||||||
|
<artifactId>google-collections</artifactId>
|
||||||
|
<version>1.0-rc1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>org.jclouds.codegen.util.CodeGenerator</mainClass>
|
<mainClass>org.jclouds.codegen.util.CodeGenerator</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>make-assembly</id>
|
<id>make-assembly</id>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>single</goal>
|
<goal>single</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -27,23 +27,31 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Adrian Cole
|
||||||
* @author James Murty
|
* @author James Murty
|
||||||
*/
|
*/
|
||||||
public class Model {
|
public class API {
|
||||||
private List<Package> packages;
|
private List<Package> packages;
|
||||||
private Map<String, Value> domain;
|
private Map<String, DomainType> domain;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return packages.toString();
|
return getPackages().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackages(List<Package> packages) {
|
||||||
|
this.packages = packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Package> getPackages() {
|
public List<Package> getPackages() {
|
||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Value> getDomain() {
|
public void setDomain(Map<String, DomainType> domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, DomainType> getDomain() {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,37 +23,45 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.model;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Adrian Cole
|
||||||
* @author James Murty
|
* @author James Murty
|
||||||
*/
|
*/
|
||||||
public class Command extends BaseBean {
|
public class Command extends TopLevelType {
|
||||||
private List<Parameter> parameters;
|
private TopLevelType options;
|
||||||
private Options options;
|
private TopLevelType handler;
|
||||||
private Handler handler;
|
private DomainType response;
|
||||||
private Response response;
|
private String description;
|
||||||
private List<String> see;
|
|
||||||
|
|
||||||
public List<Parameter> getParameters() {
|
public void setDescription(String description) {
|
||||||
return parameters;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Options getOptions() {
|
public String getDescription() {
|
||||||
return options;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Handler getHandler() {
|
public void setOptions(TopLevelType options) {
|
||||||
return handler;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response getResponse() {
|
public TopLevelType getOptions() {
|
||||||
return response;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSee() {
|
public void setHandler(TopLevelType handler) {
|
||||||
return see;
|
this.handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TopLevelType getHandler() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponse(DomainType response) {
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DomainType getResponse() {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.model;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
public class DomainType extends Type {
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*/
|
|
||||||
public class Handler extends BaseBean {
|
|
||||||
private String example;
|
|
||||||
private List<String> see;
|
|
||||||
|
|
||||||
public String getExample() {
|
private String ancestor;
|
||||||
return example;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getSee() {
|
public void setAncestor(String ancestor) {
|
||||||
return see;
|
this.ancestor = ancestor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAncestor() {
|
||||||
|
return ancestor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF 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.codegen.model;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class Field {
|
||||||
|
|
||||||
|
private String constraints;
|
||||||
|
private String defaultValue;
|
||||||
|
private String desc;
|
||||||
|
private String name;
|
||||||
|
private String javaName;
|
||||||
|
private boolean optional = true;
|
||||||
|
private String type;
|
||||||
|
private String javaType;
|
||||||
|
private Map<String, String> valueMap;
|
||||||
|
|
||||||
|
public void setConstraints(String constraints) {
|
||||||
|
this.constraints = constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConstraints() {
|
||||||
|
return constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(String defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueMap(Map<String, String> valueMap) {
|
||||||
|
this.valueMap = valueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getValueMap() {
|
||||||
|
return valueMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptional(boolean optional) {
|
||||||
|
this.optional = optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOptional() {
|
||||||
|
return optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJavaName(String javaName) {
|
||||||
|
this.javaName = javaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJavaName() {
|
||||||
|
return javaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJavaType(String javaType) {
|
||||||
|
this.javaType = javaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJavaType() {
|
||||||
|
return javaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,48 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF 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.codegen.model;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*/
|
|
||||||
public class Options extends BaseBean {
|
|
||||||
private List<Parameter> parameters;
|
|
||||||
private String example;
|
|
||||||
private List<String> see;
|
|
||||||
|
|
||||||
public List<Parameter> getParameters() {
|
|
||||||
return parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExample() {
|
|
||||||
return example;
|
|
||||||
}
|
|
||||||
public List<String> getSee() {
|
|
||||||
return see;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -23,39 +23,35 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.codegen.model;
|
package org.jclouds.codegen.model;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*/
|
|
||||||
public class ResponseField {
|
|
||||||
private String javaName;
|
|
||||||
private String desc;
|
|
||||||
private String name;
|
|
||||||
private String type;
|
|
||||||
private String javaType;
|
|
||||||
|
|
||||||
public String getDesc() {
|
public class TopLevelType extends Type {
|
||||||
return desc;
|
|
||||||
|
private String ancestor;
|
||||||
|
private String exampleCode;
|
||||||
|
private String exampleHTML;
|
||||||
|
|
||||||
|
public void setAncestor(String ancestor) {
|
||||||
|
this.ancestor = ancestor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getAncestor() {
|
||||||
return name;
|
return ancestor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public void setExampleCode(String exampleCode) {
|
||||||
return type;
|
this.exampleCode = exampleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJavaType() {
|
public String getExampleCode() {
|
||||||
return javaType;
|
return exampleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJavaName(String javaName) {
|
public void setExampleHTML(String exampleHTML) {
|
||||||
this.javaName = javaName;
|
this.exampleHTML = exampleHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJavaName() {
|
public String getExampleHTML() {
|
||||||
return javaName;
|
return exampleHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* JBoss, Home of Professional Open Source.
|
||||||
|
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
||||||
|
* as indicated by the @author tags. See the copyright.txt file in the
|
||||||
|
* distribution for a full listing of individual contributors.
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this software; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||||
|
*/
|
||||||
|
package org.jclouds.codegen.model;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Type {
|
||||||
|
|
||||||
|
private String packageName;
|
||||||
|
private String name;
|
||||||
|
private String javaName;
|
||||||
|
private Set<String> see;
|
||||||
|
private Set<Field> fields;
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJavaName(String javaName) {
|
||||||
|
this.javaName = javaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJavaName() {
|
||||||
|
return javaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSee(Set<String> see) {
|
||||||
|
this.see = see;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getSee() {
|
||||||
|
return see;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields(Set<Field> fields) {
|
||||||
|
this.fields = fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Field> getFields() {
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageName(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF 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.codegen.model;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*/
|
|
||||||
public class Value extends BaseBean {
|
|
||||||
private List<ResponseField> fields;
|
|
||||||
private String javaType;
|
|
||||||
private List<String> see;
|
|
||||||
|
|
||||||
public List<ResponseField> getFields() {
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJavaType() {
|
|
||||||
return javaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getSee() {
|
|
||||||
return see;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF 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.codegen.model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*/
|
|
||||||
public class ValueField {
|
|
||||||
private String desc;
|
|
||||||
private String name;
|
|
||||||
private String type;
|
|
||||||
private String javaType;
|
|
||||||
|
|
||||||
public String getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJavaType() {
|
|
||||||
return javaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -32,11 +32,11 @@ import java.io.Writer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.codegen.model.BaseBean;
|
import org.jclouds.codegen.model.API;
|
||||||
import org.jclouds.codegen.model.Command;
|
import org.jclouds.codegen.model.Command;
|
||||||
import org.jclouds.codegen.model.Model;
|
import org.jclouds.codegen.model.DomainType;
|
||||||
import org.jclouds.codegen.model.Package;
|
import org.jclouds.codegen.model.Package;
|
||||||
import org.jclouds.codegen.model.Value;
|
import org.jclouds.codegen.model.Type;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
|
@ -89,10 +89,10 @@ public class CodeGenerator {
|
||||||
* @throws JsonParseException
|
* @throws JsonParseException
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
*/
|
*/
|
||||||
public Model parseModelFromJSON(File objectModelFile) throws JsonParseException,
|
public API parseModelFromJSON(File objectModelFile) throws JsonParseException,
|
||||||
FileNotFoundException {
|
FileNotFoundException {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
return gson.fromJson(new FileReader(objectModelFile), Model.class);
|
return gson.fromJson(new FileReader(objectModelFile), API.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@ public class CodeGenerator {
|
||||||
*/
|
*/
|
||||||
public void generateCode(File objectModelFile) throws JsonParseException, IOException,
|
public void generateCode(File objectModelFile) throws JsonParseException, IOException,
|
||||||
TemplateException {
|
TemplateException {
|
||||||
Model model = parseModelFromJSON(objectModelFile);
|
API model = parseModelFromJSON(objectModelFile);
|
||||||
|
|
||||||
for (Package pkg : model.getPackages()) {
|
for (Package pkg : model.getPackages()) {
|
||||||
for (Command command : pkg.getCommands()) {
|
for (Command command : pkg.getCommands()) {
|
||||||
|
@ -116,17 +116,17 @@ public class CodeGenerator {
|
||||||
generateClassFile(command.getHandler(), BEAN_TEMPLATE_FILENAME);
|
generateClassFile(command.getHandler(), BEAN_TEMPLATE_FILENAME);
|
||||||
}
|
}
|
||||||
if (command.getOptions() != null
|
if (command.getOptions() != null
|
||||||
&& command.getOptions().getClassName().indexOf(
|
&& command.getOptions().getJavaName().indexOf(
|
||||||
"BaseEC2RequestOptions<EC2RequestOptions>") == -1) {
|
"BaseEC2RequestOptions<EC2RequestOptions>") == -1) {
|
||||||
generateClassFile(command.getOptions(), OPTIONS_TEMPLATE_FILENAME);
|
generateClassFile(command.getOptions(), OPTIONS_TEMPLATE_FILENAME);
|
||||||
}
|
}
|
||||||
if (command.getResponse() != null
|
if (command.getResponse() != null
|
||||||
&& !command.getResponse().getJavaType().equals("Boolean")) {
|
&& !command.getResponse().getJavaName().equals("Boolean")) {
|
||||||
generateClassFile(command.getResponse(), RESPONSE_TEMPLATE_FILENAME);
|
generateClassFile(command.getResponse(), RESPONSE_TEMPLATE_FILENAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Value value : model.getDomain().values()) {
|
for (DomainType value : model.getDomain().values()) {
|
||||||
generateClassFile(value, VALUE_TEMPLATE_FILENAME);
|
generateClassFile(value, VALUE_TEMPLATE_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +141,10 @@ public class CodeGenerator {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws TemplateException
|
* @throws TemplateException
|
||||||
*/
|
*/
|
||||||
public void generateClassFile(BaseBean bean, String templateFileName) throws IOException,
|
public void generateClassFile(Type bean, String templateFileName) throws IOException,
|
||||||
TemplateException {
|
TemplateException {
|
||||||
String shortClassName = bean.getClassName().substring(
|
String shortClassName = bean.getJavaName().substring(
|
||||||
bean.getClassName().lastIndexOf('.') + 1);
|
bean.getJavaName().lastIndexOf('.') + 1);
|
||||||
|
|
||||||
Map<String, Object> objectMap = new HashMap<String, Object>();
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
objectMap.put("bean", bean);
|
objectMap.put("bean", bean);
|
||||||
|
|
Loading…
Reference in New Issue